cancel
Showing results for 
Search instead for 
Did you mean: 

WRITE_REG hard fault

IVent.1
Senior

Hallo,

I'm compiling with this option   <-fpack-struct=1>

Why, with this option, the instruction

<WRITE_REG(hdma->Instance->CBR1, 0U);>

generates hard fault? I don't understand, without changing nothing.

thank you.

1 ACCEPTED SOLUTION

Accepted Solutions
TDK
Guru

Either the handle points to an invalid value or you are making an unaligned access. Should be able to debug and investigate one way or the other. Look at the hdma handle and ensure the instance is valid. Look at the hard fault and understand why it occurred. The SCB register will have flags that explain why and where it happened.

The issue is not with the WRITE_REG macro.

If you feel a post has answered your question, please click "Accept as Solution".

View solution in original post

4 REPLIES 4
TDK
Guru

Either the handle points to an invalid value or you are making an unaligned access. Should be able to debug and investigate one way or the other. Look at the hdma handle and ensure the instance is valid. Look at the hard fault and understand why it occurred. The SCB register will have flags that explain why and where it happened.

The issue is not with the WRITE_REG macro.

If you feel a post has answered your question, please click "Accept as Solution".
PGump.1
Senior III

Hi,

Is CBR1 a valid DMA register?

Kind regards
Pedro

AI = Artificial Intelligence, NI = No Intelligence, RI = Real Intelligence.
Pavel A.
Evangelist III

> I don't understand, without changing nothing.

But you have changed the compiler option, an important one.

If you've changed anything and things break - undo your changes, re-think and move slower, in smaller steps.