Hi,   I am implementing a CAN controller on the HCS12X us...

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Hi,   I am implementing a CAN controller on the HCS12X us...

2,055件の閲覧回数
IanM
Contributor I
Hi,
 
I am implementing a CAN controller on the HCS12X using the x-gate based on AN2726, I have got the X-Gate to interrupt and handle an Rx CAN message no problem and create an event in the core micro once completed using the sif() instruction.  The issue that I am have is that when I try to update a variable that has been passed to the x-gate Rx Can handler I get a XGateError Interrupt raised.  As far as I can tell I have followed the application note but stil get this error, I have no problem reading the CAN registers in the Xgate interrupt handler, I am using the COSMIC compiler.
 
Example code below any help would be appreciated.
 
 
XGCANstruct XGCAN0 = {&CAN0
                     ,ID_Table_CAN0  
                     ,MsgData_CAN0
                     ,MsgLen_CAN0
                     ,MsgStatus 
           ,MsgIndex_CAN0};
 
@interrupt void Xgate_CAN_Receive(XGCANstruct channel)
{
 tU08 box;
 tU08 rxid;
 if(_ssem(CANSEMXG))
 { 
          _csem(CANSEMXG);
  
 //This line causes the error 
  *(tU16*)(channel.pBuffer[0]    ) = *(tU16*)(channel.pCAN->rxbuf.dsr    );
}
}
 
ラベル(1)
0 件の賞賛
返信
1 返信

1,199件の閲覧回数
Steve
NXP Employee
NXP Employee
It depends a bit on the S12X that you are using but have a look at AN3555 for some help on how to track down errors.
I would guess that you are probably trying to do a misaligned access when reading the variable
0 件の賞賛
返信