Software Serial
The SoftwareSerial library can be used to add additional UART/Serial device to LinkIt 7697.
To use it, install Arduino BSP v0.10.7 or later, and open the `Examples > SoftwareSerial` for example sketches.
Using SoftwareSerial Library
To use SoftwareSerial, you need to assign pins for TX and RX. You can assign any digital pin as TX pin.
However, RX pin is limited to P2 and P3, which supports EINT function.
After setting up the TX and RX pins, simply call the begin() and print() methods just like the built-in Serial.
Why SoftwareSerial is Needed
LinkIt 7697 comes with 2 serial(UART) ports: Serial and Serial1. However,
Most of the time the Serial port is used for debugging purposes
And the Serial1 port has a limitation: the on-board P6 pin also serves as the bootstrap pin, therefore it must remain LOW during bootup. Since UART devices are HIGH during idling, you might see the board simply outputs `CCCCC....` in the Serial port and not executing your Arduino sketch. You need extra external circuit to ensure that the external UART device boots after MT7697.
SoftwareSerial can be useful when you want to quickly attach a Serial(UART) device to LinkIt 7697 without sacrificing the Serial port or design external circuits for the Serial1 port.
Implementation Notes
The SoftwareSerial library is based on the Arduino's SoftwareSerial library and replaces hardward-specific register writes to generic Arduino GPIO and EINT API calls. This introduces some overhead. However, thanks to the cache and higher clock frequency of MT7697, the SoftwareSerial library should be able to support up to 115200 baud rate. It is possible to replace these API calls to hardware register writes. If you are interested in doing so, you can refer to this discussion.
Last updated