CAN init - how to use

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

Hi,

i'm working on my first CAN project with ASF(2.x, the one that comes with sudio 5.1) and i have some problems understanding how can_init (from can.c) works.

I would expect that i need to call can_init once during the initialization phase of my program, then do whatever i need to do with CAN. E.g. allocate + configure MOB, send MOB etc.
Most surprisingly all CAN examples i've looked at call can_init before _each_ action they perform, let it be send or receive?! Why is that :?

Even more bad, if i modify the example to only call can_init once, it will not work anymore :cry:

Any ideas?

Of course i could write my own init(wich i'm trying to do actually) but i need to understand the basics of ASF CAN first if it should be of any use for me...

Thanks
Holger

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

Ok, found it out myself:

It's just the can_enable_interrupt() that was needed.
No idea why they do the full can_init for each message they want to send or receive :?

Holger

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

good job!