cancel
Showing results for 
Search instead for 
Did you mean: 

Is it possible to implement a peripheral on-the-fly?

RobGeografo
Associate II

Hi everyone,

I am using a STM32G474VETx chip and I have an issue with two peripherals being in conflict.

I need to use the OPAMP1 input pin (PA1) for current sensing purposes. The OPAMP1 mode required is "PGA not connected" which automatically configures pin PA2 as OPAMP1_VOUT. On the other hand, I need to use LPUART1 peripheral with TX at PA2 and RX at PA3. Unfortunately, I don't have other pins available to remap one of these peripheral to.

Is it possible to pre-configure one of the 2 peripherals on the .ioc configuration file and force-enabling the other peripheral in software at runtime? If so, what steps do I need to take to achieve that?

NOTE: I am also using ChibiOS, in case it can also be done using its API.

Thanks,

Rob

12 REPLIES 12

Yes you can in runtime do all reconfigs, but need care hw connections.

For simple coding you can in MX generate code for all combinations and MX Inits copy to user parts code, as last generate boot configuration.

TDK
Guru

It is exceedingly difficult to kill an STM32 chip without applying voltage out of range. Misconfiguring is unlikely to harm anything.

Yes, of course you can edit user code to do what you want. HAL does not require use of CubeMX.

If you feel a post has answered your question, please click "Accept as Solution".

That's reassuring, thanks!