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.
10 years ago.
mbed Serial Support?
Hi,
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
1 Answer
10 years 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 18 Nov 2014getc 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 18 Nov 2014OK, thank you. Is there any way to look at the getc source code? I haven't been able to access it.
posted by 18 Nov 2014Why do you want the source code? Here is part of it: http://developer.mbed.org/users/mbed_official/code/mbed-src/file/7b834b41c730/targets/hal/TARGET_STM/TARGET_NUCLEO_L152RE/serial_api.c
posted by 18 Nov 2014