-deleted-
9 years ago.

How to use USB0 as UART serial with the FRDM-K64F

How do I use the left side USB0 port for serial UART data communication between a PC running Tera-Term software and the FRDM-K64, per the following image where USB0 is circled in blue:

/media/uploads/ebowles/k64-usb0.jpg

I tested the following code which works: http://developer.mbed.org/handbook/USBSerial

USBSerial

include "mbed.h"
#include "USBSerial.h"
 
//Virtual serial port over USB
USBSerial serial;
 
int main(void) {
 
    while(1)
    {
        serial.printf("I am a virtual serial port\r\n");
        wait(1);
    }
}

.

The default baud rate seems to be 9600. How would I change this?

I looked in the mbed source code as follows and could not find the pin name for USB0: https://github.com/mbedmicro/mbed/blob/master/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_MCU_K64F/TARGET_FRDM/PeripheralNames.h and https://github.com/mbedmicro/mbed/blob/master/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_MCU_K64F/TARGET_FRDM/PinNames.h

1 Answer

9 years ago.

As you found that USB port is a different one: It runs directly on the K64F (while the other one is translated by the interface IC), and so you don't need to define pins, it runs a complete USB stack on your K64F. Baud rate is irrelevant since there is no real UART playing a role, if you set baud on 115200 in your terminal program it will still work.

Accepted Answer

Thank you Erik. It is good to know that the baud rate is not fixed.

posted by -deleted- 03 Apr 2015