9 years, 11 months ago.

Replacing USBSerial with RawSerial

Hi,

I am working on a application using the FDRM-K64F. I want to use the USB port (not the HDK port) as a virtual serial port. I am having difficulties using the USBSerial object. Can I use the RawSerial object and route the traffic to the USB port? If yes, what are the pin assignments I need to use with the following statement:

RawSerial virtualPort(?, ?);

Thanks!

Tom Doyle

1 Answer

9 years, 11 months ago.

RawSerial is for UART hardware only. You cant use that for USBSerial. Make sure you have updated both the mbed lib AND the USBSerial lib in your project.

I'm a little confused then. The following statement allows me to send/receive information via the USB HDK port:

RawSerial virtalPort(USBTX, USBRX);

I am trying to do the same but to the other USB port.

Tom

posted by Tom Doyle 21 May 2014

The board has a USB interface chip that is used for flashing new code on the target k64 and that also acts as USB-Serial converter between a serial port on the k64 and the host PC. You declare the serialport on the target and you make sure that it uses the hardwired TX/RX pins that are used for this converter by selecting predefined names USBTX and USBRX. They are in fact just the pinnames of these hardwired pins. USBSerial pins can not be selected. They are tied to the specific pins reserved for the k64 native USB hardware.

posted by Wim Huiskamp 22 May 2014

It works in that situation because the built in USB serial port is actually a physical UART driven serial port, it's not a USB port at all.

On all mbed boards one of the CPU's physical serial ports is connected to a second small processor that is then connected to the USB port. That second small CPU handles programming the main CPU when you drag and drop some software and also handles the usb to serial conversion.

posted by Andy A 22 May 2014