7 years, 8 months ago.

how to make Library for X-NUCLEO-IKS01A1 expansion board output printf to Windows virtual COM port

Do imported https://developer.mbed.org/teams/ST/code/X_NUCLEO_IKS01A1/file/f507d4465c31/Components/lsm6ds3/lsm6ds3_class.h into mbed. How do I modify it so that printf goes out through Nucleo USB port to Windows-7 virtual COM port?

I added these lines: Serial pc(USBTX, USBRX); DigitalOut myled(LED1);

..and changed each printf to pc.printf, but it didn't work (no printf output at Windows terminal program through virtual port.

(Virtual port is working because I tried with the Nucleo_printf but with Serial pc(USBTX, USBRX);

I got it working with this:

Accel driver top page: https://developer.mbed.org/teams/ST/code/X_NUCLEO_IKS01A1/file/f507d4465c31/Components/lsm6ds3/lsm6ds3_class.h  HelloWord  Import to Compiler > Import Replace its main() with Serial pc(USBTX, USBRX);

DigitalOut myled(LED1);

int main() { int i = 1; pc.baud(9600); pc.printf("Hello World !\n"); while(1) { wait(1); pc.printf("Project HelloWord IKS: This program runs since %d seconds.\n\r", i++); myled = !myled; } }

 Compile > Save As > F:

posted by DOUG BELL 12 Aug 2016

1 Answer

7 years, 8 months ago.

Doug,

Have you followed the following guide for SerialPC and do you have an active VirtualCom port in device manager?

https://developer.mbed.org/handbook/SerialPC

Have you followed the Windows serial configuration and installed drivers here:

https://developer.mbed.org/handbook/Windows-serial-configuration

Let me know how you get on!

-Andrea

Hi, Andrea. Yes, I already did all that and it works great! I use Windows HyperTerminal Private Edition. But when I copy and paste """Serial pc(USBTX, USBRX); """ ..into my HelloWord_IKS01A1, and use pc.printf(), I get nothing at HyperTerminal.

Maybe my issue is moving the library for USBTX/USBRX from my SerialPC project (which works) to the HelloWorld_IKS01A1 project.

My goal is to get printf working from the HellowWorld_IKS01A1 project to my Windows Virtual com.

posted by DOUG BELL 09 Aug 2016