AnsweredAssumed Answered

Setting up CAN between two FRDM-KE06Z boards

Question asked by Andrew Meyer on Mar 7, 2016

07 Mar 2016


I've been setting up a can link to transfer data between two FRDM boards using KDS version 3.0.0 with KDSK 1.3.0, using processor Expert in bare-board mode.  The first error I had was a series of undefined references such as


"undefined reference to `CAN1_ReadFrame(void*, unsigned char, LDD_CAN_TFrame*)'  "


I eventually made these go away by adding the line

  "include "CAN1.c" "

into my main.cpp file.  This seems more like a work-around than a solution.  I think there is some problem with the makefiles, but so far have not been able to find it.  Makefiles are attached, if someone else knows where to look.  I would love to fix this properly.


I connected the two units together with twisted wire pair going from CAN+ to CAN+ and CAN- to CAN- on the board, and using the on-board resistors for the bus terminations.  I assume future node additions will need to have the 120 ohm on-board resistors removed in order for the bus to work most efficiently.


Second problem:  I could not get the transmitting unit to work in the interrupt mode.  Tried forcing all three enable bits in CANTFLG to 1, but still it does not work.  Not sure the other interrupts are working either as breakpoints set on them never get triggered, so maybe something needs to be set in the debugger?


Fell back to the polled transmitter mode.  In order have activity on the bus, kept sending the message over and over in a loop.  Eventually ended up sending two different messages over in a loop, to test the receiving unit's ability to discern only the messages meant for it.



At first the receiving unit would not receive in interrupt mode.  Eventually I figured out that the receiver FIFO bits are offset three bits to the right relative to the LDD_CAN_TFRAM.MessageID bits.  For example, if the MessageID is set to 0x123U, the ID filter table must be set to 0x0246 in order for a match to occur.  With this offset, reading with an interrupt appears to function properly.



So now, my questions

     1) how do I modify the makefiles or the project so that I do not need CAN1.c included in the main.cpp file

     2) do I need to remove the 120 ohm resistor from the FRDM-KE06Z boards for intermediate nodes on the bus?

     3) is there a standard "keep-alive" signal for low activity busses to keep everything synchronized?

     4) any hints why the interrupt driven transmitter is not working?  Is there something I need to turn on in the debugger to be able to run the interrupts?

Thank you for your kind assistance.


Original Attachment has been moved to: