test code for bridging between USB virtual serial and UART3(PTC17, PTC16).

Dependencies:   BufferedSerial mbed

Update This issue has been fixed on GitHub. https://github.com/mbedmicro/mbed/commit/1519466bc8536b5445e01175b16d1cd1967782a9

Serial Bridge between USB and UART3(PTC17, PTC16)

Why I share such a simple project?

There's an issue in serial format function of FRDM64K mbed library. Setting stop bit to 1 ends up stop bit 2 in serial controller register. See line 13 in main.cpp

uart3.format(8, Serial::None, 1>>1);

To set stop bit as 1, third parameter should be 0.

Hope this issue will be fixed future release.

Files at this revision

API Documentation at this revision

Comitter:
mizmit1222
Date:
Mon Feb 16 05:50:47 2015 +0000
Commit message:
first commit (modem)

Changed in this revision

BufferedSerial.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/BufferedSerial.lib	Mon Feb 16 05:50:47 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/sam_grove/code/BufferedSerial/#9ee15ae3d1a3
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Mon Feb 16 05:50:47 2015 +0000
@@ -0,0 +1,23 @@
+#include "mbed.h"
+#include "BufferedSerial.h"
+
+BufferedSerial pc(USBTX, USBRX);
+BufferedSerial uart3(PTC17, PTC16);
+
+int main() {
+    pc.puts("\r\nscissors\r\n");
+    
+    uart3.baud(115200);
+    uart3.format(8, Serial::None, 1>>1);
+
+    while (true) {
+        if (pc.readable()) {
+            char c = pc.getc();
+            uart3.putc(c);
+        }
+        while (uart3.readable()) {
+            char d = uart3.getc();
+            pc.putc(d);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Mon Feb 16 05:50:47 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/e188a91d3eaa
\ No newline at end of file