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.
10 years, 8 months ago.
What's the problem with my virtual USB serial port on FRDM-KL25Z?
I tested the code below on my FRDM-KL25 board, it didn'twork. But it did work sevral days ago. now i need to import another library(USBSerial.h) to carry on whit my project. anybody knows what the problem is? thankyou.
Best Regards, Eugene
/*---------------*/
- include "mbed.h"
DigitalOut myled(LED_GREEN); Serial pc(USBTX, USBRX);
int main() { int i = 0; pc.printf("\nHello World!\n");
while (true) { wait(0.5); pc.printf("%d \n", i); i++; myled = !myled; } }
1 Answer
10 years, 8 months ago.
Serial PC(USBTX, USBRX) is something different as USBSerial.
The first one, which you have in your code posted here, uses the SDA USB port of the KL25Z. It is a regular serial connection connected to an IC which makes it a USB com port. The USBSerial one makes the KL25Z itself act directly as USB com port, and requires the KL25's USB connector. They also require different drivers.
If the first one doesn't work, make sure you haven't connected anything to PTA1 and PTA2, since those pins are used for the connection.