Hi,
I'm using the MCBSTM32E development board equiped with an STM32F103ZE microcontroller.
I configured the USART2 transmitter according the Reference Manual and it works fine.
I configured the USART2 receiver according the Reference Manual and it does not work.
3 hours of experimenting does not do the job. I did next steps: - set the CR1_UE Usart Enable bit - clr the CR1_M bit for selecting 8 data bits - set the CR2 register to 1 stopbit - set the BRR register to the desired bautrate - set the CR1_RE bit to enable the receiver - set the USART RX input pin PA3 to input float - enabled the GPIOA port pheripheral clock - enabled the USART2 peripheral clock - set the CR1_RXNEIE bit to activate receive interrupt - set the NVIC-ISER bit for USART2 (global interrupt) - write an interrupt handler
When I apply data to the RX-input nothing happens. I monitored the receive data (DR) register and status (SR) register but nothing changed. I scoped pin PA3 on the uC and it is toggling when receiving data.
When I force a receive interrupt by setting the USART2 bit in the ISPR register then the interrupt handler is executed.
I changed code to control USART1 but with same effect.
I must have forgotten some bit or made some configuration errer. It seems as if rx-data is not entering the internal shiftregister or is not sampled.
All hints and tips are welcome.
Thanks,
Henk
Hi readers,
I also posted on the http://www.st.com forum which finally helped me out. It turned out that I had to enable the Alternate Function clock but beneath that I made an and/or error setting the stopbits making all bits in register CR2 being set. But now: it runs!
Thanks everyone.
We are all happy that my advise helped.
Burp.
Of course i meant advice.
Of course i meant i'm an idiot.