USB serial device with Maple Mini board.

Dependencies:   USBDevice_STM32F103 mbed-MapleMini mbed

Building a USB serial device with Maple Mini board

A USB device stack has been developed by mbed in order to provide all the great capabilities of USB. The USBdevice class has been extended by Norimasa Okamoto to support also the NUCLEO-F103RB boards (and others). For more information concerning the stack architecture, visit the USBDevice stack architecture.
The USBSerial class uses the USB interface to emulate a serial port. The Maple Mini board is recognized by the computer as a serial port. This is a great solution to communicate easily between the microcontroller and a computer. The mbed serial port works by default on Mac, Linux and Windows 10, but earlier version of Windows needs a driver. These instructions explain how to setup the mbed Microcontroller to use the USB serial port on Windows 7 and earlier.

NOTE:

If you build a USB serial device with the Maple Mini board then note that for the USB device to work the USB DP pin (PA_12) shall be connected to VCC over a 1.5k resistor (R10). Otherwise the host PC won't recognise the USB device and the USB device library code will hang. All parts are already installed on the board (see in the schematic below) and can be connected/disconnected using a DigitalOut on pin PB_9.

/media/uploads/hudakz/maple_usb.png

In this application, power the Maple Mini board over a USB cable connected to the Mini-B USB connector that you are going to use for the USB serial communication with the connected PC. Once the binary has been downloaded to the board, disconnect and then reconnect the USB cable to the Maple Mini board to start running the program and to get the USB serial connection work.

Files at this revision

API Documentation at this revision

Comitter:
hudakz
Date:
Sun Aug 14 10:02:02 2016 +0000
Parent:
0:d37938a78bc5
Commit message:
Updated.

Changed in this revision

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
diff -r d37938a78bc5 -r dd51a3c8ce18 main.cpp
--- a/main.cpp	Thu Aug 04 10:03:51 2016 +0000
+++ b/main.cpp	Sun Aug 14 10:02:02 2016 +0000
@@ -2,14 +2,16 @@
 #include "mbed.h"
 #include "USBSerial.h"
 
-Serial      pc(PA_2, PA_3);
 DigitalOut  myled(LED1);
-DigitalOut  usbEn(PB_9);    //Used for connecting/Disconnecting the 1k5 resistor to/from the USB DP pin
+DigitalOut  usbEn(PB_9);    //Used for connecting/disconnecting the 1k5 resistor to/from the USB DP pin
 
 int main() {
     confSysClock();         //Configure system clock (72MHz HSE clock, 48MHz USB clock)
+    
+    Serial      pc(PA_2, PA_3);
+    USBSerial   usbSerial;
+    
     usbEn = 0;              //Keep the on-board 1k5 resistor connected to the USB DP pin
-    USBSerial usbSerial;
     
     while(1) {
         myled = !myled;
diff -r d37938a78bc5 -r dd51a3c8ce18 mbed.bld
--- a/mbed.bld	Thu Aug 04 10:03:51 2016 +0000
+++ b/mbed.bld	Sun Aug 14 10:02:02 2016 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/mbed_official/code/mbed/builds/f9eeca106725
\ No newline at end of file
+http://mbed.org/users/mbed_official/code/mbed/builds/b0220dba8be7
\ No newline at end of file