UART & Serial Driver switching at run time Topic is solved

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

Moderators: barthess, RoccoMarco

Arjun Dongre
Posts: 1
Joined: Thu Apr 26, 2018 5:58 am
Has thanked: 2 times

UART & Serial Driver switching at run time

Postby Arjun Dongre » Sat Aug 04, 2018 11:02 am

Hi all,
I am using STM32F4 in my project.

Is there any way to switch serial port between "Serial Driver" & "UART Driver" at run time?

i.e Initially I want to initialize uart2 as "UARTD2". Then want to change it to "SD2". But as we need to configure/define serial ports in "mcuconfig.h", the configuration remains same untill program ends.

So is there any way to switch at run time?

User avatar
Giovanni
Site Admin
Posts: 11306
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 412 times
Been thanked: 342 times
Contact:

Re: UART & Serial Driver switching at run time  Topic is solved

Postby Giovanni » Sat Aug 04, 2018 4:01 pm

Hi,

It is not possible, the UART IRQ vector is statically linked to a driver. Would require hacks in both drivers (remove the default ISR and play with that).

Giovanni

steved
Posts: 550
Joined: Fri Nov 09, 2012 2:22 pm
Has thanked: 4 times
Been thanked: 58 times

Re: UART & Serial Driver switching at run time

Postby steved » Sun Aug 05, 2018 10:28 pm

Search the forum; some time ago I uploaded a version of the serial driver which also supports callbacks like the UART driver. You switch between the two based on whether the callbacks are defined or not. Quite possibly that will do what you want. (Note that it always uses interrupts; never DMA)


Return to “STM32 Support”

Who is online

Users browsing this forum: No registered users and 8 guests