Test of UART RX overrun handling (lockup test)
Type in characters fast into serial terminal too see if lockup occurs from UART RX overrun.
main.cpp
- Committer:
- dudmuck
- Date:
- 2015-11-20
- Revision:
- 0:76154cf1151b
File content as of revision 0:76154cf1151b:
#include "mbed.h" //------------------------------------ // Hyperterminal configuration // 9600 bauds, 8-bit data, no parity // UART RX overrun: Type in characters quickly to see if program freezes //------------------------------------ Serial pc(USBTX, USBRX); DigitalOut myled(LED1); void rx_cb() { int i; pc.putc(pc.getc()); // echo myled = 1; /* delay is very bad action here, * but purpose is to create a UART RX overrun */ for (i = 0; i < 0x20000; i++) __nop(); myled = 0; } int main() { pc.printf("\r\nstart\r\n"); pc.attach(&rx_cb); while(1) { __nop(); } }