2018-01-17 12:51 PM
When I initialize UART4 registers in STM32 micro-controller, I get this error,
*** error 65: access violation at 0x40004C0C : no 'read' permission
*** error 65: access violation at 0x40004C0C : no 'write' permissionHere's the code:
&sharpdefine UART4_SR (*((volatile unsigned long*) 0x40004C00)) // uart4 status register
&sharpdefine UART4_DR (*((volatile unsigned long*) 0x40004C04)) // uart4 data register&sharpdefine UART4_BRR (*((volatile unsigned long*) 0x40004C08)) // baudrate register&sharpdefine UART4_CR1 (*((volatile unsigned long*) 0x40004C0C)) // controll register_1&sharpdefine UART4_CR2 (*((volatile unsigned long*) 0x40004C10)) // controll register_2void UART_Init(unsigned int baudrate) //8 bit data, 1 stop bit, no parity bit{ RCC_APB1ENR |= 0x00080000; // enable clock for uart 4 UART4_CR1 |= 0x00002000; // enable UART UART4_CR1 = 0x00000000; // 8 bit data UART4_CR2 = 0x00000000; // 1 stop bit // setting the baudrate float calculation = 36000000.0 / ((baudrate)*16); UART4_BRR = calculation;}int main(void)
{ UART_Init(9600); while(1){ } return (1);}USART1,USART2, USART3 works fine. I get this error when I use UART4, UART5.
Why is that? Is it because,this microcontroller might not have UART interface?
#stm32f103rb #memory-mapped-peripherals #uart #nucleo-stm2018-01-17 01:08 PM
>>
Why is that? Is it because,this microcontroller might not have UART interface?
It means your simulator doesn't support them. Debug on the NUCLEO, not the simulator.
2018-01-17 01:10 PM
The Medium Density device has 3 USART, per specifications.