Hang when using serial.attach
- This topic has 3 replies, 4 voices, and was last updated 6 years ago by .
Viewing 4 posts - 1 through 4 (of 4 total)
Viewing 4 posts - 1 through 4 (of 4 total)
- You must be logged in to reply to this topic.
Tagged: Serial Interrupts
Hi,
I was trying to read some data from the serial port using the serial.attach() function call, but everything hangs when I put a serial.getc() in the interrupt call. I´ve read here: https://developer.mbed.org/search/?q=serial+interrupt that it is not possible to use printf and interrupts. So I removed all of the loginfo from the code, but it seems that it always hangs even if there is no printf in the code. Is there any other way to read only one line from the serial port? I´ve tried with a while loop but it seems that there are some characters that are dropped. So I´m stuck.
Thanks.
Hi Alejandro,
I’m guessing you have looked at the mbed Serial page but I’ll include it in case you haven’t.
https://developer.mbed.org/handbook/Serial
You may also find our example code helpful.
https://developer.mbed.org/teams/MultiTech/code/Dot-Examples/
This page should provide all the information you need to get the examples running.
Kind regards,
Leon
Hi there,
i have the same problem, i use this https://os.mbed.com/cookbook/Serial-Interrupts to.
And a side note, dot examples doesn’t have a serial (uart) communication example.
Chears
The AT Firmware is an example of using the serial port with mDot
https://os.mbed.com/teams/MultiTech/code/Dot-AT-Firmware/
Here is the serial class used in AT Firmware
https://os.mbed.com/teams/MultiTech/code/MTS-Serial/