Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SoftwareSerial implementation #645

Merged
merged 5 commits into from
Sep 11, 2019
Merged

Conversation

ABOSTM
Copy link
Contributor

@ABOSTM ABOSTM commented Sep 9, 2019

Summary

This Pull Request is based on PR: Add SoftwareSerial #627 from @armint:
Add SoftwareSerial for STM32 boards.

This PR adds SoftwareSerial support for STM32 boards. The code was based on the SoftwareSerial implementation from the lpc176x arduino port and adapted for STM32. It uses the recently added HardwareTimer code for timing. The timer to be used can be defined in variant.h by defining TIMER_SERIAL. When no TIMER_SERIAL is defined it will use the simplest timer available.
Tested and working on STM32F446ZE and STM32F401RE. Works with existing SoftwareSerial example code. Tested at 9600 and 115200 baud by communicating with hardware serial interfaces and by logic analyser.

Besides PR #627, I also

  • remove the actual oversampling because I already have issue with baudrate 115200 (on NUCLEO_STM32L476RG @ 80MHz) because I spend 100% CPU load in intterrup, waiting for some RX. And thus unable to handle TX even when nothing is received. And actual oversampling would increase Interrupt overhead.
  • keep original (lpc176x) OVERSAMPLING management to sample in RX in the middle of the bit.
  • add some comment to explain the management of bits/tick

Tested on NUCLEO_STM32L476RG: up to Baudrate 57600 test passed. Failed at 115200(too much time spend in IT).
Both examples working:

  • SoftwareSerialExample
  • TwoPortReceive

Fixes #267

@fpistm fpistm self-requested a review September 9, 2019 14:50
@fpistm fpistm added this to the 1.7.0 milestone Sep 9, 2019
@ABOSTM ABOSTM mentioned this pull request Sep 9, 2019
* fix build warnings
* fix to allow pin number 0
* fix listen to do what it is expected
* add a check on _receivePin and _transmitPin

Signed-off-by: Frederic Pillon <frederic.pillon@st.com>
Copy link
Member

@fpistm fpistm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See ABOSTM#2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SoftwareSerial needed
3 participants