With this test, you can tie external TXD and RXD together, and on the USB console, see the characters entered be echo'd back. This is effectively a loopback test verifying the external hardware interface, through the USB console interface.
Revision 0:7ac9848b2e4b, committed 2013-12-13
- Comitter:
- dixter1
- Date:
- Fri Dec 13 23:45:09 2013 +0000
- Child:
- 1:ce52702074c2
- Commit message:
- First revision this code. If external pins D0/D1 are connected, this performs an external loopback test.
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/C027-REVB.lib Fri Dec 13 23:45:09 2013 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/dixter1/code/C027-REVB/#db7c445289f5
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Fri Dec 13 23:45:09 2013 +0000 @@ -0,0 +1,47 @@ +#include "mbed.h" +#include "C027.h" + +DigitalOut mdm_activity(LED); + +int main() +{ + int led_toggle_count = 5; + +#if 0 + while(1) { + mdm_activity = !mdm_activity; + wait(0.2); + } +#else + while( led_toggle_count-- > 0 ) + { + mdm_activity = !mdm_activity; + wait(0.2); + } +#endif + + // open the external serial port + Serial m3(D1, D0); + m3.baud(MDMBAUD); + + // open the USB console port and (use the same baudrate) + Serial pc(USBTX, USBRX); + pc.baud(MDMBAUD); + + if ( m3.writeable() ) pc.printf("m3 is writable\r\n"); + if ( m3.readable() ) pc.printf("m3 is readable\r\n"); + + pc.printf( "M3->EXT UART connection ready\r\n"); + + m3.printf( "TESTING\r\n"); + + while (1) + { + // transfer data from pc to modem + if (pc.readable() && m3.writeable()) + m3.putc(pc.getc()); + // transfer data from modem to pc + if (m3.readable() && pc.writeable()) + pc.putc(m3.getc()); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Fri Dec 13 23:45:09 2013 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/a9913a65894f \ No newline at end of file