UART driver & chprintf

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

Moderators: RoccoMarco, barthess

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

UART driver & chprintf

Postby sntnjrg » Sat Aug 10, 2019 2:11 pm

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: 14457
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1076 times
Been thanked: 922 times
Contact:

Re: UART driver & chprintf

Postby Giovanni » Sat Aug 10, 2019 5:09 pm

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


Return to “STM32 Support”

Who is online

Users browsing this forum: No registered users and 53 guests