I'm a newbie to STM32F334 MCU. I need help on setting USART3 clock.
Two USARTS are used on the board. USART1 is used for PC communication. USART3 is used for BLE device communication internally.
PC communication was not working at first, characters were broken. USART1 was operating on default clock - PCLK - 36MHz. Changed USART1 clock to 8MHz - HSI through below API and it was working.
/* Configure the HSI as USART1 clock */
/* Enable USART1 clocks */
8.4.13 Clock configuration register 3 (RCC_CFGR3)
Reset value: 0x0000 0000
Bits 19:18 USART3SW[1:0]: USART3 clock source selection
This bit is set and cleared by software to select the USART3 clock source.
00: PCLK selected as USART3 clock source (default)
01: System clock (SYSCLK) selected as USART3 clock
10: LSE clock selected as USART3 clock
11: HSI clock selected as USART3 clock
Bits 1:0 USART1SW[1:0]: USART1 clock source selection
This bit is set and cleared by software to select the USART1 clock source.
00: PCLK selected as USART1 clock source (default)
01: System clock (SYSCLK) selected as USART1 clock
10: LSE clock selected as USART1 clock
11: HSI clock selected as USART1 clock
Now similarly USART3 is not working with default clock -36MHz PCLK to BLE device.
I am trying to change USART3 clock to 8MHz HSI clock through below API.
/* Configure the HSI as USART3 clock */
/* Enable USART3 clocks */
But strangely USART3SW cannot be altered to 3 from 0. I tried to change USART3SW through JTAG but it was not changed.
Please help me to find out why USART3SW is not changed.
Thanks a lot for your help in advance.