4 years, 9 months ago.

mbed Serial Support?


Is there any mbed support for reading serial inputs off of pins? For example, my Nucleo L152RE can write to serial pins D1 and D8 seamlessly but there doesn't seem to be any built in functionality to read inputs on the serial pins. Do I have any other options for getting serial read working beyond writing my own serial driver?

Thank you, -Ian

Comment on this question

1 Answer

4 years, 9 months ago.

What do you mean by 'Serial'? There is the regular Serial (aka an UART) which has a TX for transmitting and an RX for receiving, which mbed supports. But pins D1-D8 do not all support that, including writing, so I guess you mean something else. But I don't know what.

I'm talking about UART communication with another device. I've been able to get my Nucleo to send commands to this device, but I don't know how to read incoming data. The only read support I see is through the getc() and putc() commands, but I don't understand how those are supposed to be used for reads.

posted by Ian Wichmann 18 Nov 2014

getc is a read command, it gets a character if one is available, otherwise it blocks until one is available. The .readable() command returns if there is a character available for read.

posted by Erik Olieman 18 Nov 2014

OK, thank you. Is there any way to look at the getc source code? I haven't been able to access it.

posted by Ian Wichmann 18 Nov 2014