cancel
Showing results for 
Search instead for 
Did you mean: 

How to trim the STM32 HSI easily

po221
Senior

Hello

I'm using a stm32L431 with an STLinkV3

https://www.st.com/en/microcontrollers-microprocessors/stm32l4x1.html#documentation

HSI is enabled at 16MHz for USART2, used to receive a 1200Bd signal.

I receive wrong characters because of the trim.

I understood the principle of trim and its registers, in particular thanks to this doc

dm00425536-how-to-optimize-stm32-mcus-internal-rc-oscillator-accuracy-stmicroelectronics-2.pdf

My question: is there a way to adjust this trim automatically via cubeIDE and stlinkV3?

Maybe another solution less practical but more practical than a manual adjustment?

Thanks in advance

11 REPLIES 11
po221
Senior

L431 has autobaud rate functionality on USART2 !

I'm not sure I understand ABRMOD and ABREN. Is the correction done automatically permanently by the usart?

Thanks

po221
Senior

It's definitely not a TRIM problem, I was able to reproduce the problem with a usb converter that knows how to transfer data as well.

I opened another topic: parity problem

https://community.st.com/s/question/0D53W00001ixfc7SAA/usart2-on-stm32l431-does-not-support-parity-with-cubemx

Thank you very much for your help and clarification.