structure - unaligned memory? hard fault

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

structure - unaligned memory? hard fault

Jump to solution
899 Views
mjg8t
Contributor IV

Hi There,

 

I think I may be having an unalignment memory hard fault occurring.  I am using some code which has run fine on the KL devices, but is giving the K22 a hard fault.  I have narrowed down the issue to writing to a structure variable.  

 

I have been happily naive about memory alignment and it appears it is time to learn more details about it in fixing my issue here.  I have attached the project which is running on the frdm-k22f board.  The main loop has a write to the structure and which seems to be casuing the issue.  

 

Can someone explain what is wrong with the structure defenition?  How I can avoid this in the future?  And how to fix it?

 

Thanks!

Original Attachment has been moved to: test_sd.zip

0 Kudos
1 Solution
769 Views
jingpan
NXP TechSupport
NXP TechSupport

Hi,

I read you code and found that pdev is a pointer. But I didn't see you initializing it. A pointer must point to a entity before you use it.

Regards

View solution in original post

0 Kudos
2 Replies
770 Views
jingpan
NXP TechSupport
NXP TechSupport

Hi,

I read you code and found that pdev is a pointer. But I didn't see you initializing it. A pointer must point to a entity before you use it.

Regards

0 Kudos
769 Views
mjg8t
Contributor IV

Thank you for having a look!  Very glad it was a something so simple.  

0 Kudos