AnsweredAssumed Answered

Error in UART4/UART5 in NUCLEO STM32F103RB

Question asked by Muzahir Hussain on Jan 17, 2018
Latest reply on Jan 17, 2018 by Clive One

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' permission



Here's the code:

#define UART4_SR (*((volatile unsigned long*) 0x40004C00))     // uart4 status register
#define UART4_DR (*((volatile unsigned long*) 0x40004C04))     // uart4 data register
#define UART4_BRR (*((volatile unsigned long*) 0x40004C08))   // baudrate register
#define UART4_CR1 (*((volatile unsigned long*) 0x40004C0C))   // controll register_1
#define UART4_CR2 (*((volatile unsigned long*) 0x40004C10))    // controll register_2

void 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)

    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?