Associate III
February 2, 2016
Question
DMA giving hardfault in STM32F4 Nucleo @84Mhz
- February 2, 2016
- 11 replies
- 2955 views
Posted on February 02, 2016 at 14:20
I have modified an STM32F4 example and developed a windows application to interact with it for sending data continuously.I am reading a file on PC line by line and sending continuously each line on a serial port (COM9) to which STM32F4Nucleo board is connected.
STM324 is running @84Mhz and UART is configured at 921600 Baudrate.Host code :
loop : while(1)//being while loop//read a line from a text file if(line == ''EOF'') breakelse{ send a line to COM Port delay 500 ms} //End while loopon STM32 :
int main(void){ HAL_Init(); /* Configure the System clock to 84 MHz */ SystemClock_Config(); /* Initialize UART */ USARTConfig(); /* Infinite loop */ while (1) { if (UART_ReceivedMSG((TMsg*) &Msg)) { //do the processing of the MSg data printf(Msg.Data);}attached is the file where UART_ReceivedMSG is defined.So here I am able to see the data coming (on console I/O of the IDE I am using - IAR)but at times I am getting a hardfault at Get_DMA_Flag_Status > uint32_t Get_DMA_Flag_Status(DMA_HandleTypeDef *handle_dma){ return (__HAL_DMA_GET_FLAG(handle_dma, __HAL_DMA_GET_FE_FLAG_INDEX(handle_dma)));}What could be the cause for this?Is it some sort of non atomic operation happening at the handle_dma.How can I avoid it.Thanks in advance ! #hardfault #hardfault #hardfault #uart #dma #dma #dma #stm32f4 #!stm32f4-!stm32f401