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, 2 months ago.
serial_api.c file in the FRDM-KL25Z
Does the overrun check required in the following function ?
Is that correct ?
int serial_writable(serial_t *obj) {
check overrun
if (obj->uart->S1 & UART_S1_OR_MASK) {
obj->uart->S1 |= UART_S1_OR_MASK;
}
return (obj->uart->S1 & UART_S1_TDRE_MASK);
}
Question relating to:
1 Answer
10 years, 2 months ago.
It seems like a fairly pointless check in the write function. Although also the read function ignores it anyway.
Heh editting answers still broken:
This is from the original KL25 mbed implementation, I think written by Freescale. Those parts of the code have never been modified anymore, since they do their job. But if you can verify those lines can be safely removed, go ahead and delete them, and if you want you can then submit a pull request on the mbed github.
posted by 22 Oct 2014I think, we can delete this code.
I am using this library (not in mbed ide) in my makefile based project. I see that write function is stuck after transmitting for a bit of time for higher baud rates. I can not re-produce the issue at lower rates.
There is a while loop in the serial write function to check whether the tx buffer is empty or not. I guess that my code stucks here.
The source code looks fine except the overrun code which also should not cause any issue.
Do you think any other flag in the status register to be checked before writing ?
posted by 24 Oct 2014