Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
9 years, 7 months 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:
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, 7 months 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.