Hi,
I have a K60. I tried to access FlexCan registers with a memcpy into a RAM buffer. But the program execution crashes as soon as memcpy is called.
//pCanReg=0x40024000
char buf[100];
memcpy((PCHAR)&(buf[0]), (PCHAR)&pCanReg->MCR, 0x20);
Do you know why?
Thank you,
David Zhou
Hello David,
What about this pointer PCHAR ? How about delete it like this :
memcpy(&(buf[0]), &pCanReg->MCR, 0x20);
if it still can not work , you can send you project to me , and tell me the part number of your chip .
Hope it helps
ALice
Hi Alice,
I tried without PCHAR or with (void*). It is the same. I was wandering it maybe lock the access by read. I don't know exactly how it is done but the access pCanReg->MB[0]->CS locks the mailbox. I tried that CS is not within the copy block address range. It still crashes. That's puzzling me.
Thank you,
David
Hi David,
Please attach it as this :
And do you want copy 0x20 byte ? it also said 8 registers ?
BR
Alice
ello David,
I don't know why your side is like that , on my side ,it is
then click Actions , it can show Edit.
If you still have not solve it , you can send the project to my mailbox
BR
Alice
Hi Alice,
The Action | Edit doesn't appear on my side. It might be related with IE setup. I may not pursue this issue anymore, because I am not planning to write some functions related with memcpy of CAN registers. So you can close this tick. In case if I need it again, I can repost the tick.
Thank you so much.
David Zhou
Hi Alice,
I want to copy as many as possible in one block, if there is no restriction. The mailbox (MB) structure CS is used for locking. It may not be able to be copied.@ !
In attached code, please find "For Alice: 1. memcpy ok" in the KzMain.c. the memcpy is currently commented out.
Thank you,
David Zhou