s32k144 can data variable

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

s32k144 can data variable

642 Views
kong1
Contributor I

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

kong1_0-1659952339376.png

 

2. but, is saved int the register

kong1_1-1659952418460.png

 

what's problem? 

0 Kudos
4 Replies

633 Views
Senlent
NXP TechSupport
NXP TechSupport

Hi@kong1

Please try suspending current debug while reading RxDATA data.

Senlent_0-1660010883857.png

If this issue still exists, I will test the project again.

0 Kudos

630 Views
kong1
Contributor I

Yes, I did suspending current debug while reading RxDATA data. 

But same result coming..

Is there other way? 

0 Kudos

618 Views
Senlent
NXP TechSupport
NXP TechSupport

Hi@kong1

I took the time to test this routine and everything works fine on my side.

Senlent_0-1660037539849.png

 

Senlent_1-1660037539940.png

 

Senlent_2-1660037539953.png

 

0 Kudos

606 Views
kong1
Contributor I

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?

0 Kudos