FreescaleCAN "CAN_SendFrame()"

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

FreescaleCAN "CAN_SendFrame()"

跳至解决方案
884 次查看
spojoe
Contributor I

Hello,

i´m using the MC56F8367 and the CW for MCU v10.3.

Everything is working fine, there are just some problems with sending a message using CAN_SendFrame().

When i try to send a frame, the function returns ERR_BUSY and the frame is not transmitted.

I builded a "for{...}" loop arround the send command that cals the function until the CAN-device is not longer busy.

In that way i found out that it needs arrount 10 calls until the device is not busy. After 10 cals the  "IDLE" bit is "1" and the transmission works.

Is there a important thing i forgot before starting a transmission. When is the "IDLE"-bit set by the Hardware?

Thank you for any answer!!!:smileyhappy:

Best Regards

joe

1 解答
490 次查看
Petr_H
NXP Employee
NXP Employee

Hi,

The ERR_BUSY is returned until the message is received by the target device. It might be OK that it takes 10 calls...

If you'd like to have information on when the message is successfully sent, you can use the OnFreeTxBuffer event (Events tab in the inspector) that is invoked after some buffer is empty so you don't have to wait till some send ends.

I recommend to enable also the generation of OnError event. This event is invoked in case of errors on the bus and you can use GetError function call inside to get details of the error.

There might be also some conflict or problem on the bus that prevents the message to be sent.

best regards

Petr Hradsky

Processor Expert Support Team

在原帖中查看解决方案

0 项奖励
2 回复数
491 次查看
Petr_H
NXP Employee
NXP Employee

Hi,

The ERR_BUSY is returned until the message is received by the target device. It might be OK that it takes 10 calls...

If you'd like to have information on when the message is successfully sent, you can use the OnFreeTxBuffer event (Events tab in the inspector) that is invoked after some buffer is empty so you don't have to wait till some send ends.

I recommend to enable also the generation of OnError event. This event is invoked in case of errors on the bus and you can use GetError function call inside to get details of the error.

There might be also some conflict or problem on the bus that prevents the message to be sent.

best regards

Petr Hradsky

Processor Expert Support Team

0 项奖励
490 次查看
carloshass
Contributor II

Petr Hradsky,

I'm working in a project with CAN, and it's working, but, for some reason, the OnFreeTxBuffer is not invoked.

I tryed with auto-init, and with manual initialization, and did not work.

I'm using KDS 3.0.0, and PE 3.0.1.b150806

FRDM-KE06Z

Regards,

CH

0 项奖励