I’ve created a class that uses a BufferedSerial object for communication with a serial LCD. The board is unidirectional in that it only needs Tx connected. The documentation for BufferedSerial says the following:
TX and RX pins - you can specify either pin as Not Connected (NC) for simplex (unidirectional) communication or both as valid pins for full duplex (bidirectional) communication.
I’m able to do this on a FRDM-KL46Z board where I set the Tx pin to one of the UART Tx pins and “NC” for the Rx in the constructor of the BufferedSerial object. When I try to use the same code on a FRDM-K64F board, albeit with a different Tx pin, the NC assignment throws a runtime error:
++ MbedOS Error Info ++
Error Status: 0x80FF0144 Code: 324 Module: 255
Error Message: Assertion failed: pin != (PinName)NC
Location: 0x85F7
File: ./mbed-os/targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/api/pinmap.c+27
Error Value: 0x0
Current Thread: main Id: 0x1FFF21DC Entry: 0x91CD StackSize: 0x1000 StackMem: 0x1FFF0C30 SP: 0x1FFF1AD0
For more info, visit: https://mbed.com/s/error?error=0x80FF0144&tgt=K64F
-- MbedOS Error Info --
I can get it to work by assigning a valid Rx pin for that UART but this means the docs on BufferedSerial are incorrect.
Is this a bug for this boards pin maps or am I missing something?
Under /mbed-os/targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_MCU_K64F/serial_api.c there are two calls to pin_function() in serial_init_direct() without a check to see if each pin is an NC. If you dig into pin_function() you’ll find that it assumes the pin is not NC and will throw an assertion otherwise.
Thanks Anna. I’ve submitted a fix on Git and the merge to master has been approved.
As a noob it was a little hard for me to figure out what to do with mbed on Github to make this happen. If you had a guide, even with links to helpful Github KB articles, it would have made the process a little less intimidating and might encourage others to contribute more readily.
thank you for the contribution it is very appreciated. Are you aware of all our documentation ? For example our workflow is documented here Workflow - Contributing | Mbed OS 6 Documentation . We don’t cover how to use GitHub / Git itself as that is a general tool that most open source developers are already aware of and there are a multitude of guides already out there
Thanks. No I did not see this as I never thought of myself as a contributor.
There is a section " Guidelines for GitHub pull requests" that looks like it should be useful to others in the same boat. I’m sure I violated a few of these.