Open mark-psl opened 3 years ago
Thank you for raising this detailed GitHub issue. I am now notifying our internal issue triagers. Internal Jira reference: https://jira.arm.com/browse/IOTOSM-3515
Thanks for the report. @mark-psl can you please send a pull request fixing this?
Sure. Not sure how to do that correctly for this issue. Do you have a branch that I can refer to?
Create your own branch with a fix and send it via "new pull request"
I'm unable to create a branch from master. I can only filter on this repo.
you need to fork the repo first.
Done. PR#14387 submitted. I'm a noob at this so thanks for your patience.
Description of defect
A runtime assertion happens on FRDM-K64F when assigning a pin name as "NC". Specifically this happens on BufferedSerial() when assigning the Rx pin to be NC. This is in conflict with the mbed-os API document on BufferedSerial().
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.
The following is the assertion:
++ 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 --
It appears the assertion happens in the pin_function() routine called by the initialization code in serial_api.c for this target.
In other targets where this is not an issue (eg. FRDM-KL46Z) the call to pin_function() is first checked to ensure the pin is not NC.
In the target in question (FRDM-K64F) the pin_function() calls are done without the check even through if(!=NC) checks are done just below it to enable the Tx and Rx pins.
Starting at line 66 it currently looks like:
I moved the pin_function() calls into the if(!=NC) sections for Tx and Rx as such:
This corrects the issue and complies with the documentation on BufferedSerial() in the mbed-os API documentation.
Target(s) affected by this defect ?
FRDM-K64F
Toolchain(s) (name and version) displaying this defect ?
Mbed Studio v1.3.1
What version of Mbed-os are you using (tag or sha) ?
mbed-os v6.8
It also appears to be in v6.7
What version(s) of tools are you using. List all that apply (E.g. mbed-cli)
Mbed Studio v1.3.1
How is this defect reproduced ?
Set the Rx pin for BufferedSerial() to NC. This will compile and link cleanly but throw a runtime assertion and restart the board.