Not able to transmit and receive data multiple times via CAN bus with same CAN ID

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

Not able to transmit and receive data multiple times via CAN bus with same CAN ID

3,655 Views
chintan
Contributor III

Hello,

I am using FRDM KW36 module for CAN communication for my project. But I am facing issue to transmit and receive data multiple times using CAN bus. Below is more explanation:

I have imported the Example code from my SDK for flex_can. I have connected FRDM KW36 module with PCAN-USB adapter to receive CAN data from PC. If I set the different CAN ID for TxIdentifier(e.g. 0x321) and RxIdentifier (e.g. 0x123), I am able to transmit or receive the CAN data for multiple times from both side KW36 to PCAN-USB adapter.

But if I set the same ID for both TxIdentifier(e.g 0x123) and RxIdentifier(e.g 0x123), then only for One time I am able to transmit and receive data. For second time, I am only able to transmit the CAN data from KW36 to PCAN-USB adapter. Not able to receive the data from PCAN-USB adapter to KW36. Interrupt does not generate for second time even I send the data from PCAN-USB adapter software.

Please help how can I resolve this issue.

Below are the details of software/code:

FRDM-KW36 SDK version: 2.2.1

Example Project: frdmkw36_driver_examples_flexcan_interrupt_transfer

Baudrate for CAN: 500k

PCAN-USB adpater: CAN USB - PCAN-USB Adapter – Grid Connect

PCAN-USB software: PCAN-View

Thank you.

0 Kudos
6 Replies

3,500 Views
gwen_stouthuyse
Contributor I

Hello nxf46116 

I tried to specify the option as suggested by you:

pastedImage_3.png

But as you can see, the option is simply not available, putting it in manually results in a compiling error.

Could this be part of an older SDK?

I'm using 2.2.2

My device has no own address, as I don't want it to send out messages, just acknowledge the incoming telegrams.

Should I give it an address not used so the reception is not hindered by the own address mask?

First time I use NXP processors, due the processor has interesting features for my potential application

Gwen

0 Kudos

3,500 Views
Alexis_A
NXP TechSupport
NXP TechSupport

Hello gwen.stouthuysen@donaldson.com‌,

Your totally right, this is not implemented in the SDK for the KW36, please set the MCR.SRXDIS bit after configuring the module, remember that this bit can be written only in Freeze mode because it is blocked by hardware in
other modes.

Best Regards,

Alexis Andalon

0 Kudos

3,500 Views
gwen_stouthuyse
Contributor I

I'm facing the same problem: the reception of a message functions.

once

Then the callback is not triggered anymore.

No messages come in through the interface, but the driver keeps on functioning as I notice that messages get acknowledged.

My typical telegrams are J1939 formatted, and come in quite fast: 4 telegrams in 3 msec. then 30 sec rest.

I have adapted all to extended ID, which functions as the messages that come in are correct, but only the first message is each time received, the callback fires to mention the second message comes in but this is not handled anymore due it comes to fast I think.

The disableSelfReception is a feature not known in the KW36 SDK, and has no relation to the original problem.

0 Kudos

3,500 Views
Alexis_A
NXP TechSupport
NXP TechSupport

Hello gwen.stouthuysen@donaldson.com‌,

As I previously mentioned the disableSelfReception field is in the FLEXCAN_GetDefaultConfig(&flexcanConfig) if you call this line after the GetDefaultConfig API you will disable this feature:

flexcanConfig.disableSelfReception = true;

This filed correspond to CAN0->SRXDIS, the messages send by the module will not be listened by itself and if you have the same ID in the TX and RX the communication will be done correctly.

Let me know if this helps you.

Best Regards,

Alexis Andalon

0 Kudos

3,500 Views
Alexis_A
NXP TechSupport
NXP TechSupport

Hello chintan@aimtron.com‌,

FlexCAN is allowed to receive frames transmitted by itself. If you want to ignore the frames with the same TX/RX ID you need to disable the self reception, this can be done easily if after the FLEXCAN_GetDefaultConfig(&flexcanConfig) you modify the self reception field:

flexcanConfig.disableSelfReception = true;

Let me know if this helps you.

Best Regards,
Alexis Andalon

0 Kudos

3,500 Views
chintan
Contributor III

Hello Alexis,

Thanks for your reply.

I have called Receive CAN frame function into Transmit function again, and now I am able to send and receive data from Same CAN IDs.

Thank you.

0 Kudos