MSCAN spamming CAN bus

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

MSCAN spamming CAN bus

Jump to solution
773 Views
samkreuze
Contributor II

Hello, I'm trying to send CAN messages from a MKE06Z128VLH4 running MQXLite using the MSCAN processor expert component.  I am able to receive, however, when I try to transmit, I send one message then the processor keeps spamming the same message repeatedly.

I am sure my code is not sending the messages repeatedly. So the MSCAN driver must be...

My code is as follows:

LDD_CAN_TFrame FrameTX1;

uint8_t frameData[] =

    { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };

LDD_TError error;

FrameTX1.MessageID = (message.id | 0x00000000);

FrameTX1.FrameType = LDD_CAN_DATA_FRAME;

FrameTX1.Length = 8;

FrameTX1.Data = frameData;

error = CAN_SendFrame(g_CANPtr, 1U, &FrameTX1);

if (error)

{

    _mutex_lock(&g_printMutex);

    printf("CAN TX 1 ERROR : %d\n\r", error);

    _mutex_unlock(&g_printMutex);

}

I do not receive any errors. I can see the messages being spammed repeatedly on my scope. Is there something in the component I set up wrong?

0 Kudos
1 Solution
492 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello Sam
I see you use MQX-Lite, for "sending the messages repeatedly" , whether is the reason of the MQX task start repeatedly ?

If you not sure ,you can copy your code to bareboard(without MQX ) project to have a try .

Hope  it helps !

Alice

View solution in original post

0 Kudos
2 Replies
493 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello Sam
I see you use MQX-Lite, for "sending the messages repeatedly" , whether is the reason of the MQX task start repeatedly ?

If you not sure ,you can copy your code to bareboard(without MQX ) project to have a try .

Hope  it helps !

Alice

0 Kudos
492 Views
samkreuze
Contributor II

I had my usb-to-CAN device on "listen only", so the MSCAN device never saw the acknowledge for the message so it would send it again and again.  So really MQX-Lite was behaving correctly.

Thanks!

0 Kudos