1 year, 10 months ago.

Reading and Writing to Registers in the STM32F746NG

I am trying to read and write to the registers in the STM32F749NG microcontroller and have two questions/problems that I can't seem to figure out.

1) How can I write and read to and from the registers in general? 2) I want to set the UE bit in the USART_CR1 register of UART4.

According to the register boundary address table of the datasheet, I found that UART4 has the following addresses: 0x4000 4C00 - 0x4000 4FFF

The UART Register map says that the USART_CR1 is at offset 0x00 and that the UE bit is bit 0 of that offset.

Did I understand it correct that - If I want to set the UE bit of the USART_CR1 register of UART4 - I have to set bit 0 of address 0x4000 4C00?

1 Answer

1 year, 10 months ago.

Yes, you have that all correct. However stm32f746xx.h has a lot of defines that make life a lot easier for you. UART4->CR1 |= 0x01; should do what you want.

Note that it's USART1,2,3 & 6 and UART4,5,7 & 8. But they are all pointers to a USART_TypeDef at the appropriate memory location which then defines CR1 as having an offset of 0

Accepted Answer