As soon as an UART4 RX Interrupt occurs, a hard fault exception occurs Hard fault Status Register = 0x40000000 (bit 30 is set) As far as I know this indicates one of the following faults: 1. Bus fault, 2. Memory management fault 3. Usage fault Below is my code. UART initialization RCC->APB1ENR |= RCC_APB1Periph_UART4; //Enable clock for USART4 UART4->BRR = 0x0EA6; //Set baudrate UART4->CR1 = 0x00000000; //Set Data, Stop bits & Flow control UART4->CR1 |= (USART_CR1_RE | USART_CR1_TE); //RX, TX enable UART4->CR1 |= 0x20; //RXNE Interrupt Enable UART4->CR1 |= USART_CR1_UE; //USART enable Interrupt initialization NVIC_InitStructure.NVIC_IRQChannel = UART4_IRQChannel; NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 1; NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0; NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; NVIC_Init(&NVIC_InitStructure); Interrupt void UART4_IRQHandler(void) { u8 Rx_Char; if(UART4->SR & USART_FLAG_RXNE) //RX Character { UART4->SR &= ~USART_FLAG_RXNE; //Clear interrupt flag Rx_Char = UART4->DR & 0xFF; UART4_Flag = 0xFF; } } I used the same code for USART1, 2 and 3, all working.
Ah, fuck, code tag doesn't work for this... code :p
I know - it's pretty useless having a 'CODE' tag that doesn't actually work with source code, isn't it?! Who chose this forum software with such an obvious and fundamental flaw?! Previously noted nearly a year ago: