FreescaleCAN "CAN_SendFrame()"

cancel
Showing results for 
Search instead for 
Did you mean: 

FreescaleCAN "CAN_SendFrame()"

Jump to solution
631 Views
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 Solution
237 Views
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

View solution in original post

0 Kudos
2 Replies
238 Views
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 Kudos
237 Views
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 Kudos