s32k144 project example use 's32k144_project_flexcan'
flexcan.c
void FLEXCAN0_receive_msg(void)
{
/*! Receive msg from ID 0x556 using msg buffer 4
* =============================================
*/
uint8_t j;
uint32_t dummy;
RxCODE = (CAN0->RAMn[ 4*MSG_BUF_SIZE + 0] & 0x07000000) >> 24; /* Read CODE field */
RxID = (CAN0->RAMn[ 4*MSG_BUF_SIZE + 1] & CAN_WMBn_ID_ID_MASK) >> CAN_WMBn_ID_ID_SHIFT; /* Read ID */
RxLENGTH = (CAN0->RAMn[ 4*MSG_BUF_SIZE + 0] & CAN_WMBn_CS_DLC_MASK) >> CAN_WMBn_CS_DLC_SHIFT; /* Read Message Length */
for (j=0; j<2; j++)
{ /* Read two words of data (8 bytes) */
RxDATA[j] = CAN0->RAMn[ 4*MSG_BUF_SIZE + 2 + j];
}
RxTIMESTAMP = (CAN0->RAMn[ 0*MSG_BUF_SIZE + 0] & 0x000FFFF);
dummy = CAN0->TIMER; /* Read TIMER to unlock message buffers */
CAN0->IFLAG1 = 0x00000010; /* Clear CAN 0 MB 4 flag without clearing others*/
}
1. RxDATA[j] data is not save
2. but, is saved int the register
what's problem?
Please try suspending current debug while reading RxDATA data.
If this issue still exists, I will test the project again.
Yes, I did suspending current debug while reading RxDATA data.
But same result coming..
Is there other way?
I used
int main(void)
{
for(;;) {FLEXCAN0_transmit_msg();}
}
this is not works.
But
void LPIT0_Ch0_IRQHandler (void)
{FLEXCAN0_transmit_msg();}
is works well.
What's problem?