8 years, 9 months ago.

Using USBSerial and Serial at the same time on FRDM-KL25Z?

Hi,
I have a problem using both USBSerial and Serial in the same program...
When I use them,one at time, they work fine but if I use both, only USBSerial works fine..

This code below is paste from USBSerial example and it doesn't work, Serial named pc doesn't write nothing

USBSerial echo

#include "mbed.h"
#include "USBSerial.h"
 
//Virtual serial port over USB
USBSerial serial;
Serial pc(USBTX, USBRX);
 
int main(void) {
    uint8_t buf[128];
    while(1)
    {
        serial.scanf("%s", buf);
        serial.printf("recv: %s", buf);
        pc.printf("recv: %s\r\n", buf);
    }
}


I try also other UART on FRDM-KL25Z and the problem is the same.
Anyone know why I cannot use both serial port and if there is a method to use both?
Thanks

Hi,
I retry with different usart so the configuration is: USBserial,UART0 and UART2 at the same time and all the 3 serial works!!
I don't know what was wrong the first time..sorry
However there are problem with the serial on OpenSDA connector yet..
For my application the problem is now solved, I don't know if anyone want to try the serial over OpenSDA for answer now for future problem.

posted by Mattia Benato 24 Jul 2015
Be the first to answer this question.