Hi I am trying to get the loopback_transfer example to work from the MCUXpresso SDK v2.7.0, which is the latest version now. It works with 8 byte messages so the CAN FD controller should not be faulty. I also tested it on a second dev kit which gives the same behavior.
I am failing to get 64 byte messages to work using the loopback_transfer example, I changed the CAN interface to 3 (which is the only CAN controller with CAN FD support):
#define EXAMPLE_CAN CAN3
I enable CAN FD using:
#define USE_CANFD (1)
I also changed the setting to 64 bytes per MB using:
#define BYTES_IN_MB (kFLEXCAN_64BperMB)
And specified the amount of DWords per MB which is 64/4=16
#define DWORD_IN_MB (16)
I also tried both:
mbConfig.format = kFLEXCAN_FrameFormatStandard;
...
txFrame.format = (uint8_t)kFLEXCAN_FrameFormatStandard;
txFrame.type = (uint8_t)kFLEXCAN_FrameTypeData;
txFrame.id = FLEXCAN_ID_STD(0x123);
and
mbConfig.format = kFLEXCAN_FrameFormatExtend;
...
txFrame.format = (uint8_t)kFLEXCAN_FrameFormatExtend;
txFrame.type = (uint8_t)kFLEXCAN_FrameTypeData;
txFrame.id = FLEXCAN_ID_EXT(0x123);
to switch between extended and standard format frames.
I also tried to switch on the edl bit in the tx frame manually:
txFrame.edl = 1U;
All configurations led to the same output:
==FlexCAN loopback example -- Start.==
Send message from MB9 to MB10
tx word0 = 0x0
tx word1 = 0x1
tx word2 = 0x2
tx word3 = 0x3
tx word4 = 0x4
tx word5 = 0x5
tx word6 = 0x6
tx word7 = 0x7
tx word8 = 0x8
tx word9 = 0x9
tx word10 = 0xa
tx word11 = 0xb
tx word12 = 0xc
tx word13 = 0xd
tx word14 = 0xe
tx word15 = 0xf
Received message from MB10
rx word0 = 0x0
rx word1 = 0x1
rx word2 = 0x828e2dfa
rx word3 = 0xd503a104
rx word4 = 0xa80ff519
rx word5 = 0xbf6428ac
rx word6 = 0x6dff1985
rx word7 = 0x9d4b4f0a
rx word8 = 0x9121c09
rx word9 = 0x204e0821
rx word10 = 0x187c98d1
rx word11 = 0x944211
rx word12 = 0xb67e9daf
rx word13 = 0xb716befd
rx word14 = 0xce5dbba6
rx word15 = 0xd1c6cb0c
==FlexCAN loopback example -- Finish.==
As you can see the first two DWORDS (8 bytes) are correct, so it seems that either 8 byte message buffers are used somehow even though I set it to 64 bytes, or normal CAN frames are used which have a maximum 8 byte payload but that shouldn't be the case as I explicitly set the edl flag of the txFrame to 1.
Either way I don't understand what I need to change in order to make it work or what I need to do to debug further. Is it possible to provide a working example that works straight out of the box? That would be much appreciated.
I attached the whole file in case you want to compare it to the original one. This is the only source file I changed in the loopback_transfer project.
Solved! Go to Solution.
Hi Jim,
Within the SDK for the RT1060-EVK you will find three CANFD examples. Within these three example projects, there's one loopback_transfer which works with a 64-byte payload. Please refer to this example instead of migrating a normal CAN example project.
Best Regards,
Victor
Hi Jim,
Within the SDK for the RT1060-EVK you will find three CANFD examples. Within these three example projects, there's one loopback_transfer which works with a 64-byte payload. Please refer to this example instead of migrating a normal CAN example project.
Best Regards,
Victor
Thanks Victor! I didn't realize there was a separate folder for CANFD, I thought everything was in flexcan as that is the name of the driver.