Page 1 of 1

UART driver & chprintf

Posted: Sat Aug 10, 2019 2:11 pm
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.

Re: UART driver & chprintf

Posted: Sat Aug 10, 2019 5:09 pm
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