Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
11 years, 2 months ago.
Serial::readable() always returns false!
I'm using termios to send a short message to the mbed. Here's the code.
/media/uploads/jford38/serial.c
I'm trying to get the mbed to respond to the messages by turning myled off. Unfortunately, it looks like device.readable() always returns false. What's the deal? Here's my mbed code.
I'm pretty confident the termios code is sending the messages. The usb led on the mbed flashes once a second. Unfortunately, led 1 stays on permanently because device.readable() never comes up true. Any help on this would be greatly appreciated!
1 Answer
11 years, 2 months ago.
First of all, short pieces of code you can just paste here between <<code>> and <</code>>
Second, I seem to have misplaced my own LPC1768, so I can't quickly test until I find it again. However did you already try if it works with a regular serial terminal program, and if not, if standard examples work?
Yep! I can receive messages from the mbed on my computer using both teraterm and similar C. My ultimate goal is to have the computer send gcode messages to the mbed and have it buffer and respond to them.
posted by 14 Dec 2013So I just checked, and it did work with teraterm. When I type something, it sends it to the mbed, the Serial::readable() returns true, and myled turns off.
This seems to rule out an error in the mbed code. Any idea what's wrong with my sending side code?
posted by 14 Dec 2013I don't have experience with that part, so I am afraid I can't help too much with it.
Some random ideas: Replace the \r with \n. I don't think that is it since your LED flashes, but in principle if it uses line buffering I don't know if it sees a \r as an end of line. And besides that make sure everything is equal to the situation in teraterm, like baud rate, parity, stop bits, etc. I would guess it is the standard format by default, but obviously something is off. It looks like you write it as a file, personally I have no idea what all those settings are, so I don't know if that is all correct.
posted by 14 Dec 2013