Where can i see the output of chprintf() ?

ChibiOS public support forum for topics related to the STMicroelectronics STM32 family of micro-controllers.

Moderator: RoccoMarco

Post Reply
qbertsuit
Posts: 2
Joined: Sun Jun 08, 2014 2:26 pm

Where can i see the output of chprintf() ?

Post by qbertsuit »

Hi,

I'm new to the STM32 and ChibiOS. I have successfully flashed the RT-STM32F407-DISCOVERY-MEMS demo project using st-util in one terminal, and arm-none-eabi-gdb in another terminal. The leds light up as expected, but I can't see any text printed in the console. In the main.c file I can see a lot of chprintf calls.

Am I looking in the wrong place for the chprintf output?

Thanks!
lesto
Posts: 55
Joined: Thu May 22, 2014 11:27 am

Re: Where can i see the output of chprintf() ?

Post by lesto »

as far as i know chpritnt is justa lightweight versione of printf, and by default it write to nothing. You have to create a stream (to serial, usb, even tcp) and then write into that
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: Where can i see the output of chprintf() ?

Post by Giovanni »

Hi,

The first parameter is the stream where the chprintf() writes on. If it is something like &SDx the it is a serial port, if you see &SDUx then it is a virtual COM port over USB.
The function can write on anything implementing a "stream interface".

Giovanni
qbertsuit
Posts: 2
Joined: Sun Jun 08, 2014 2:26 pm

Re: Where can i see the output of chprintf() ?

Post by qbertsuit »

I found this in the code, so I guess it's using a virtual COM port over USB:

sduObjectInit(&SDU1);
sduStart(&SDU1, &serusbcfg);

How can I acyually read the stream from a Linux terminal?
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: Where can i see the output of chprintf() ?

Post by Giovanni »

You need to plug the board on an USB port then a new TTY should be created, then you can use a terminal emulator and interact with the board.

Giovanni
Post Reply