cancel
Showing results for 
Search instead for 
Did you mean: 

How to solve this hardfault concerning memory access restriction?

jess
Associate II

The code goes to

HAL_I2S_Receive_DMA at __HAL_UNLOCK(hi2s);

and

void HAL_DMA_IRQHandler(DMA_HandleTypeDef *hdma)

{

 uint32_t tmpisr;

 __IO uint32_t count = 0;

 uint32_t timeout = SystemCoreClock / 9600;

 /* calculate DMA base and stream number */

 DMA_Base_Registers *regs = (DMA_Base_Registers *)hdma->StreamBaseAddress;

 tmpisr = regs->ISR; => hardfault_handler

Failed to execute MI command:

-data-evaluate-expression "((DMA_Base_Registers *)hdma->StreamBaseAddress)->ISR"

Error message from debugger back end:

Cannot access memory at address 0xf8960000

Failed to execute MI command:

-data-evaluate-expression "((DMA_Base_Registers *)hdma->StreamBaseAddress)->Reserved0"

Error message from debugger back end:

Cannot access memory at address 0xf89c0004

Failed to execute MI command:

-data-evaluate-expression "((DMA_Base_Registers *)hdma->StreamBaseAddress)->IFCR"

Error message from debugger back end:

Cannot access memory at address 0xf8870008

What did I miss here?

2 REPLIES 2
Bubbles
ST Employee

Hi @jess​ ,

looks like you made some error handling the pointers. Maybe dereferencing? Or maybe the hdma structure is not initialized? But there's really nothing at that memory address, so the error code will show until you fix your code.

BR,

J

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

BRusl.1
Associate III

This can happen with buffer overflow which corrupts DMA_HandleTypeDef