USBSerial not working over LPC1768

Hi everyone,
I am testing Virtual COM over USB using a custom board for LPC1768. I am using MBED Studio 1.3.1 in windows 10 with the target set to “mbed LPC1768”, build profile in “Debug” and the code what I am implementing is the next:

#include “mbed.h”
#include “USBSerial.h”

#define BLINKING_RATE 500ms
//Virtual serial port over USB
USBSerial serial;
DigitalOut led(LED1);

int main(void) {
while(1)
{
led = !led;
serial.printf(“I am a virtual serial port\n”);
ThisThread::sleep_for(BLINKING_RATE);
}
}

when I compile the this code i get only this warning: “[Warning] @0,0: L3912W: Option ‘legacyalign’ is deprecated.”. Then i take the .bin and convert it to .hex with “arm-none-eabi-objcopy” and then upload it to my custom board using FlashMargic. I am new whit this plataform, when i tested to blink a led it works very well, but the code that I attached above din’t work for me, after uploading the code y get a virtual com port in windows 10 but i receive nothing in a serial console. I read that in windows 10 there is no need for a driver. Also when i tested to blink a led and only adding this line “USBSerial serial;” the blink don’t works but it creates a virtual com.

Do you have any ideas why I can’t receive data in my serial console and why when I added “USBSerial serial;” the basic blink code stop working?

Many thanks for your help
Best Regards

Hi,

BR, Jan

1 Like

Thanks @JohnnyK , effectively your response solved my problem. I only needed to active DTR signal on my console. Now it works how it must be.

Best Regards

Hello fellow LPC1768 custom board user! One tip: We’ve found at my place that we have to edit Mbed OS and comment out this line, which seems to depend on the presence of the DAPLink chip on the dev board. Otherwise, certain things such as JTAG debugging will tend to crash the chip.

1 Like

thanks for your advice @MultipleMonomials. I am programming the LPC1768 only with ISP Mode, I don’t have a JTAG debugging option for now but I will considerate your advice if I have problems in the future.

Best Regards