The CAN controller in the device needs a fair bit of work to fully understand it and also a good understanding of CAN to be able to use it fully. There is quite a bit to setup the device to make it work and it took me about 1 week with the code from the Atmel website, porting it to the Codevision compiler before it would work. It is ready to go with the WinAVR I believe so if you have that compiler, you should be able to figure it out? I was already familiar with the Microchip MCP2515 before but moving to the AVR CAN took me a whilst to figure out and I am still working on it. CAN does not work as a request and get data, except for certain situation where you do a request. Normally, CAN devices just send data on event or at preset times. For the likes of digital inputs, I would only send a message on the bus if there was a change. For analog I would send at a preset rate. The beauty of CAN is that you don't have to worry about having a master with multiple slaves as you would with the likes of RS485. You simple ensure that each device on the bus sends a unique ID for each message. CAN messages are based on priority so a higher priority message goes first if 2 devices try to send data at the same time. This reduces your workload in the processor to very little and you simple set the buffer to transmit and let the CAN controller do the work of sending the message and detecting errors. Remember that CAN is source message based. That means there is no destination address. The remote devices know which messages they are interested in and are usually setup with the message filters to only receive those messages. This bit takes a fair bit of work to understand but once you do, it will be easy to create remote devices listening only for required messages. Which compiler are you using? Dave. From: AVR-Chat@yahoogroups.com [mailto:AVR-Chat@yahoogroups.com] On Behalf Of blue_eagle74 Sent: 31 December 2009 10:37 To: AVR-Chat@yahoogroups.com Subject: [AVR-Chat] Re: 90can128 can controller I have searched and searched but cant find what I need. Can anyone provide a simple C code in CV using the CANbus. A simple one for transmit and/or request info from the other AVR. I just want to talk to another AVR and have it respond and turn on an LED so I can see that it works. I have found code but dont understand it. Does anyone have a tutorial? Brian [Non-text portions of this message have been removed]
Message
RE: [AVR-Chat] Re: 90can128 can controller
2009-12-31 by Dave McLaughlin
Attachments
- No local attachments were found for this message.