UC3C CANIF Intitialization Fails

Go To Last Post
3 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello,

 

I have been struggling for some while now with initialization of the CANIF module on an AT32UC3C1512C.

 

I'm using the Atmel ASF code.

 

Some of the time the CANIF module comes up nicely, and everything works as expected.

 

But sometimes can_init() fails, returning CAN_CMD_REFUSED.  This can only mean that the CANIF_channel_enable_status() call failed after the delay period after the CANIF_enable() call.  In other words, the CES bit did not go high as expected.

 

I have a loop around the call to can_init(), and if I call it often enough it generally seems to succeed eventually.  But sometimes it takes more than a million calls before that happens.

 

I tried making the delay period in can_init() much longer (1000 times), but that didn't make any difference.

 

When the initialization works, the CAN module goes on to work beautifully.  That suggests the configuration can't be all that far wrong.

 

Another oddity is that when the initialization fails, it tends to be persistent.  For example, right now I cannot get the CAN module to start at all.  But a couple of days ago I could not get it to fail.

 

Any idea why the CES bit might fail to come up sometimes?

 

Regards,

 

Bert Menkveld

bert@greentronics.com

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello Bert,

 

 

Best regards,

M

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello Menahem,

 

Thanks for the reply.

 

I have spent plenty of time looking at the datasheet already, but your post made me go back to basics.  After following up on simple things, I finally discovered a bad solder joint on my proto board.  Apparently some of the time the RX signal from the CAN transceiver was making it to the CPU pin, and some of the time it wasn't.

 

Fixed that solder joint, and now all is well.   ARGH!  Intermittent connections are the bane of my existence!!!

 

Thanks very much for your help in getting to the bottom of this.  Guess I sometimes need a little help to force me to check the simple stuff.

 

Regards,

 

Bert