2020-05-19 08:45 AM
The CR1 register stays 0 (as well as CR2, it looks like all UART2 registers are 0). My first thought was that the Bus is not enabled - as UART1 is on APB2 and UART 2 and 3 are on APB1 , but I enable UART2 bus - this is the enable code :
/* Enable GPIO */
RCC_APB2PeriphClockCmd( RCC_APB2Periph_GPIOD , ENABLE );
/* Enable USART2 and 3*/
RCC_APB2PeriphClockCmd( RCC_APB1Periph_USART2 | RCC_APB1Periph_USART3 | RCC_APB2Periph_AFIO, ENABLE );
What could be the reason for the CR1 register to not respond ?
Thanks
Anat
2020-05-19 10:35 AM
> RCC_APB2PeriphClockCmd( RCC_APB1Periph_USART2 | RCC_APB1Periph_USART3 | RCC_APB2Periph_AFIO, ENABLE );
You probably want to use RCC_APB1PeriphClockCmd(() for the USART clocks (and a separate command for the AFIO clock) enable.
Next time, don't forget to tell us also the STM32 model you are using.
JW
2020-05-19 10:17 PM