2017-07-19 07:18 PM
Hi Experts,
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 */
RCC_USARTCLKConfig(RCC_USART1CLK_HSI);/* Enable USART1 clocks */
RCC_APB2PeriphClockCmd(RCC_APB2Periph_USART1, ENABLE);8.4.13 Clock configuration register 3 (RCC_CFGR3)
Address: 0x30Reset value: 0x0000 0000Bits 19:18 USART3SW[1:0]: USART3 clock source selectionThis 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 clock10: LSE clock selected as USART3 clock11: HSI clock selected as USART3 clockBits 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 clock10: LSE clock selected as USART1 clock11: HSI clock selected as USART1 clockNow 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 */
RCC_USARTCLKConfig(RCC_USART3CLK_HSI);/* Enable USART3 clocks */
RCC_APB1PeriphClockCmd(RCC_APB1Periph_USART3, ENABLE);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.
BR,
Honggi
2017-07-25 08:58 PM
Hi
I have a similar issue, and I tried to modified the 'USART3SW' of 'RCC->CFGR3' by Keil debug mode, but it doesn't work.