Skip to main content
jess
Associate
February 24, 2023
Question

How to solve this hardfault concerning memory access restriction?

  • February 24, 2023
  • 2 replies
  • 1235 views

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?

This topic has been closed for replies.

2 replies

Bubbles
ST Employee
February 24, 2023

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 II
April 28, 2023

This can happen with buffer overflow which corrupts DMA_HandleTypeDef