structure - unaligned memory? hard fault

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

structure - unaligned memory? hard fault

跳至解决方案
1,071 次查看
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 项奖励
回复
1 解答
941 次查看
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 项奖励
回复
2 回复数
942 次查看
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 项奖励
回复
941 次查看
mjg8t
Contributor IV

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

0 项奖励
回复