Skip to content

Move Serial example 3 to RawSerial #634

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

Merged
merged 3 commits into from
Jul 30, 2018

Conversation

yennster
Copy link
Contributor

@yennster yennster commented Jul 19, 2018

Example three in the Serial API doc attaches an interrupt to the Serial pc object, and inside the callback function getc() and putc() are used. As of the latest version of Mbed OS, both of these functions use mutex locks which are not allowed in ISR context, and create the following error at runtime:

++ MbedOS Error Info ++
Error Status: 0x80010133 Code: 307 Module: 1
Error Message: Mutex: 0x20000F1C, Not allowed in ISR context
Location: 0x1002B29
Error Value: 0x20000F1C
Current Thread: Id: 0x20002850 Entry: 0x10040C9 StackSize: 0x1000 StackMem: 0x20001810 SP: 0x2003FE50 
-- MbedOS Error Info --

In order to use getc() and putc() in ISR context with a serial interrupt, you need to use a RawSerial object.

If these changes get approved, I can either make a new example for RawSerial or update the existing example 3 for Serial here: https://os.mbed.com/teams/mbed_example/code/Serial_ex_3/

Jenny Plunkett added 2 commits July 19, 2018 15:12
Example three should be moved to RawSerial
@AnotherButler AnotherButler requested a review from SenRamakri July 19, 2018 20:26

Attach a function to call during the generation of serial interrupts. This function defaults to interrupt on an RX pin.

[![View code](https://www.mbed.com/embed/?url=https://os.mbed.com/teams/mbed_example/code/Serial_ex_3/)](https://os.mbed.com/teams/mbed_example/code/Serial_ex_3/file/4ab47f33a1ae/main.cpp)
Copy link
Contributor

Choose a reason for hiding this comment

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

I looks like this example is still using the Serial class?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@geky Yeah, I would update that example if these docs changes get approved

Copy link
Contributor Author

Choose a reason for hiding this comment

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

And change the repo name to "RawSerial_ex_2"

@AnotherButler
Copy link
Contributor

@SenRamakri Are you happy for this to merge?

@yennster
Copy link
Contributor Author

@SenRamakri do you have any comments?

Copy link
Contributor

@SenRamakri SenRamakri left a comment

Choose a reason for hiding this comment

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

Looks good..

@yennster
Copy link
Contributor Author

@AnotherButler this is ready, and I've updated the example in https://os.mbed.com/teams/mbed_example/code/RawSerial_ex_2/

@AnotherButler AnotherButler merged commit 8bb7ce4 into ARMmbed:development Jul 30, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants