MSCAN spamming CAN bus

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

MSCAN spamming CAN bus

跳至解决方案
1,454 次查看
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?

标记 (3)
0 项奖励
回复
1 解答
1,173 次查看
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 项奖励
回复
2 回复数
1,174 次查看
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 项奖励
回复
1,173 次查看
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 项奖励
回复