No interrupts on the AVR-CAN device

Started by curry-te, January 16, 2018, 05:07:52 PM

Previous topic - Next topic


We are using a JTAG-ICE debugger on our AVR-CAN devices. I compiled some code to listen to CAN messages but there are never any ISR interrupts called. I have a debugger stop in the ISR function to see if I ever get the CAN messages. I have a feeling our fuses might be set wrong. I want to use the 16MHz crystal but I am not sure how to tell the fuses that other than the Ext 8- selection. I think this might be affecting our baud rate. I can see the incoming CAN messages with our o'scope.

Any ideas?


I'm not familiar with this board, but just looked into the manual and the schematic. The controller has an internal CANcontroller, but to communicate with the bus you also need a CAN transceiver. This chip (e.g. MCP2551) is not on the board. Look at the schematic of the Duinomite MEGA and you will see how it should be connected.
Just a guess that this is the problem.


@Kees AVR-CAN has MCP2551 placed. It is named U3. The "NA" abbreviation above it refers to the position of jumper CAN_D.
Technical support and documentation manager at Olimex


Sorry my mistake, I looked at the schematic of the AVR-H128-CAN. Olimex has too many products :-)


By default we set the fuses as follows:


Use the same.

How do you test the CAN communication? Did you try connecting two AVR-CAN units together?

The CAN output connector of AVR-CAN is connected to the transceiver MCP2551. Pin 2 of the CAN port is connected to pin 6 (CANL) of the MCP2551. Pin 7 of the CAN port is connected to pin 7 (CANH) of the MCP2551.

For proper communication between two AVR-CAN boards you must connect DB9-male connector pin2(CANL) on the first board with DB9-male connector pin2(CANL) on the second board, DB9-male connector pin7 (CANH) with DB9-male connector pin7(CANH) and pin 3,6(GND) with pin 3,6(GND).

Also check your jumper configuration for proper CAN configuration. For example, CAN_T jumper has be closed on the two boards if you use just two boards.
Technical support and documentation manager at Olimex


Besides of setting the fuses it is important to set the bittiming registers (CANBT1/2/3) correctly to have a correct timing. If these registers are set to 0 the bitrate will be set to very high (8Mb/sec probably) and this will never communicate. The highest bitrate in CAN is 1 Mb/sec. The controller datasheet describes the CAN interface quite well. When the bitrate is set the controller should be enabled in the Control register. After these two steps it is possible to receive and send CAN frames.