Welcome, Guest

Author Topic: No interrupts on the AVR-CAN device  (Read 815 times)

curry-te

  • Newbie
  • *
  • Posts: 1
  • Karma: +0/-0
No interrupts on the AVR-CAN device
« on: January 16, 2018, 05:07:52 PM »
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?

KeesZagers

  • Full Member
  • ***
  • Posts: 176
  • Karma: +2/-0
Re: No interrupts on the AVR-CAN device
« Reply #1 on: January 16, 2018, 09:44:43 PM »
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

LubOlimex

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1819
  • Karma: +46/-2
Re: No interrupts on the AVR-CAN device
« Reply #2 on: January 17, 2018, 08:15:29 AM »
@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

KeesZagers

  • Full Member
  • ***
  • Posts: 176
  • Karma: +2/-0
Re: No interrupts on the AVR-CAN device
« Reply #3 on: January 17, 2018, 06:43:50 PM »
Sorry my mistake, I looked at the schematic of the AVR-H128-CAN. Olimex has too many products :-)

LubOlimex

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1819
  • Karma: +46/-2
Re: No interrupts on the AVR-CAN device
« Reply #4 on: January 18, 2018, 04:13:35 PM »
By default we set the fuses as follows:

LFUSE="0xCF"
HFUSE="0x19"
EFUSE="0xFE"

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

KeesZagers

  • Full Member
  • ***
  • Posts: 176
  • Karma: +2/-0
Re: No interrupts on the AVR-CAN device
« Reply #5 on: January 18, 2018, 08:53:03 PM »
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.