UART driver & chprintf

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

Moderator: RoccoMarco

Post Reply
sntnjrg
Posts: 65
Joined: Mon Jul 22, 2019 2:19 pm
Has thanked: 18 times
Been thanked: 3 times

UART driver & chprintf

Post by sntnjrg »

Hi,

I'm learning how to use the UART driver. I've checked that I can't use both the serial driver and the UART driver at the same time. If I try I get a link error:

Code: Select all

chibios (.text+0x0): multiple definition of `VectorDC'

I want to develop a small test program that uses the UART driver to send and receive text that is displayed on a terminal using chprintf.

Is this possible? In ChibiOS, is it too complicated to change the configuration to use both drivers at the same time? How would it be?

Thank you.
User avatar
Giovanni
Site Admin
Posts: 14893
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: UART driver & chprintf

Post by Giovanni »

Hi,

You can use the serial driver and the uart driver at same time but not on the same UART.

If you want to use chprintf() with the uart driver then you need to write a small "adapter" that implements a stream interface on the UART driver. Function chprintf() takes as first parameter a pointer to a structure whose first field is a pointer to a "VMT" structure defining the various get/put methods, use nullstream.c/.h as a starting point.

Giovanni
Post Reply