CanFestival on Arduino

Hi all,

I currently work on an open-source sailboat project for disabled people which use a CAN bus architecture to transmit sensors/actuators information. For this we use an ATmega32u4 with a MCP2515 compatible with arduino. Because our sensors provide different type of data (I2C, NMEA183...) we need to manually program the behaviour of each nodes in order to put them into a CAN message. This approach makes users dependent of our architecture and doesn't offer a plug and play system. In order to automate the behaviour we decided to implement a higher layer protocol to do that, such as CANopen and we found CanFestival which works on AVR processors. So I wanted to know if some of you have already worked with this framework and have some tips/tricks to help us during its implementation.

Thank you

There are AVR's with CAN built in, like some 644's.

In fact we use this board http://wiki.splashelec.com/index.php/CANinterfacer and it currently does the job. You think that using a mega644 could be better for CanFestival ?

There are ATMEL controllers including some ATMegas with 1 or 2 CAN interfaces built-in, but apparently not the 644.

http://www.atmel.com/products/microcontrollers/avr/megaAVR.aspx These are the ATMega's with CAN. AT90CAN128 AT90CAN32 AT90CAN64 ATmega16M1 ATmega32M1 ATmega64M1

There's 51 ATMEL chips with 1 or 2 CAN BUS interfaces.

CanFestival --- looks like anything with CAN BUS can play.

Futurlec as AT90CAN64 for $7.20 and AT90CAN128 for $9.90. Datasheets are on-site. http://www.futurlec.com/ICAtmel.shtml

• CAN Controller 2.0A & 2.0B - ISO 16845 Certified (1) – 15 Full Message Objects with Separate Identifier Tags and Masks – Transmit, Receive, Automatic Reply and Frame Buffer Receive Modes – 1Mbits/s Maximum Transfer Rate at 8 MHz – Time stamping, TTC & Listening Mode (Spying or Autobaud)

Why an MCU and separate CAN chip when you can get an MCU with CAN? That is what I wonder.

GoForSmoke: Why an MCU and separate CAN chip when you can get an MCU with CAN? That is what I wonder.

I think that the choice of an ATmega32U4 came from the need of an Arduino compatible architecture (i.e easy to use with Arduino IDE, because AVR studio or makefile could be restrictive) but I've not built the board, I'm just trying to implement CanFestival on it :) In addition, it should not be forgotten that this kind of system is created for the general public not only AVR self-confident people and software should be easily modifiable

Hi Yellowsky,

we at energyBus.org are working currently to get a EducationKit for EnergyBus together. Core and center is Open Source/Open Hardware availability of stuff. I also found CANfestival, though unfortunately I'm not a programmer, so can't help on your questions, though I am are very interested in what you learn.

EnergyBus itself may bring added value for what you are after, beeing built on top of CANOpen. It is built exactly for what you described in your earlier post -- make sure that the system has a common denominator "Bus" where all specific communication languages (I2C, Nema, ...) are adapted to to be able to extend the system. It is built itself for "Island Systems" like E-Bikes and Home Energy Systems, but surely will also bring value for Boats an Motor Home Energy Systems etc. Check http://www.energybus.org/Further-Info/Downloads/EnergyBus-Brochure-2013 for more information.

You may or may not have seen the following ressource collection: http://reprap.org/wiki/CANopen

You may reach me on maxwest at gmx dot net.

... by the way, is it possible to buy the CANinterfacer?

Thx

Hi Yellowsky,

I did some further reading. CANFestival is said to run on AVR. The Arduinos run on AVR Chips too. Therefor CANFestival should already run on Arduinos. Check those ressources: * http://en.wikipedia.org/wiki/Atmel_AVR * http://www.canfestival.org/doc * https://www.sparkfun.com/arduino_guide e.g. the Arduino Uno has a megaAVR ATmega328 on it.

Also I found the sourceforge ressource about CANfestival including mailing list. It is a bit hidden from the canfestival.org webpage: http://sourceforge.net/p/canfestival

Hope that helps.

yellowsky:
In addition, it should not be forgotten that this kind of system is created for the general public not only AVR self-confident people and software should be easily modifiable

What is more simple and still can work the sensors, motors, communications, leds?

Doing Make type stuff takes learning and know-how. C code takes logical thinking. A grounding in mathematics helps and so does music as well as science. All of which points out that not all newcomers will have the same experience as some will be more ready than others. What maybe matters most is that the ones with more to learn have that much more patience and not want to start on a grand scale.

Hello again,

Sorry for the delay, I was a little bit busy over the last few days.

maxwest: Hi Yellowsky,

we at energyBus.org are working currently to get a EducationKit for EnergyBus together. Core and center is Open Source/Open Hardware availability of stuff. I also found CANfestival, though unfortunately I'm not a programmer, so can't help on your questions, though I am are very interested in what you learn.

EnergyBus itself may bring added value for what you are after, beeing built on top of CANOpen. It is built exactly for what you described in your earlier post -- make sure that the system has a common denominator "Bus" where all specific communication languages (I2C, Nema, ...) are adapted to to be able to extend the system. It is built itself for "Island Systems" like E-Bikes and Home Energy Systems, but surely will also bring value for Boats an Motor Home Energy Systems etc. Check http://www.energybus.org/Further-Info/Downloads/EnergyBus-Brochure-2013 for more information.

You may or may not have seen the following ressource collection: http://reprap.org/wiki/CANopen

You may reach me on maxwest at gmx dot net.

I'll look at it thank you :)

maxwest: ... by the way, is it possible to buy the CANinterfacer? Thx

I will ask the manufacturer as soon as I see him and I will tell you.

maxwest: Hi Yellowsky,

I did some further reading. CANFestival is said to run on AVR. The Arduinos run on AVR Chips too. Therefor CANFestival should already run on Arduinos. Check those ressources: * http://en.wikipedia.org/wiki/Atmel_AVR * http://www.canfestival.org/doc * https://www.sparkfun.com/arduino_guide e.g. the Arduino Uno has a megaAVR ATmega328 on it.

Also I found the sourceforge ressource about CANfestival including mailing list. It is a bit hidden from the canfestival.org webpage: http://sourceforge.net/p/canfestival

Hope that helps.

Yes, CANFestival should run on Arduino as RepRap trying to do. We actually facing the problem that the framework needs an OS to manage the bus whereas we trying to implement it on a microcontroller architecture. The fact is that CANfestival is not widespread yet, so it's quite hard to find some clear information.

GoForSmoke:

yellowsky: In addition, it should not be forgotten that this kind of system is created for the general public not only AVR self-confident people and software should be easily modifiable

What is more simple and still can work the sensors, motors, communications, leds?

Doing Make type stuff takes learning and know-how. C code takes logical thinking. A grounding in mathematics helps and so does music as well as science. All of which points out that not all newcomers will have the same experience as some will be more ready than others. What maybe matters most is that the ones with more to learn have that much more patience and not want to start on a grand scale.

I agree with you, a grounding in C programming is necessary but it's far easier to rely on the Arduino community and the IDE to reach the largest audience. The system aims to provide to sailors, disabled or not, a navigational assistance system in a boat able to perform automated tasks (heeling limitation, autopilot, ...). In general, these users would not have any programming skills and will use the native system. The objective is, if they had the desire to change some behaviours, they can do it easily by using our documentation and the help of Arduino community. But for AVR self confident users which choose to work with an AT90CAN it is also possible as we provide the library, they are free to adapt it to their board.

Hi maxwest,

maxwest:
… by the way, is it possible to buy the CANinterfacer?

Thx

For the moment, there are only a few manually assembled prototypes, and some bare PCBs. Later this year, I hope to have assembled a small series of something like 100 boards. It will then be easier to sell boards at an acceptable price.

What would you do with the CANinterfacer ? What board features could be left of, what should be added ?

Bernt (the designer of the CANinterfacer)

Hi bernt,

may you get in contact on maxwest at gmx dot net.

we would love to buy 2 for an initial testing.

our project got pages on ieskit.wikidot.com

that should end up in a Island Energy System Education Kit.

the exact needs we have for a canduino should get a page in the future

Maxwest

... sent a mail to maxwest.

This statement from the mail could be interest for this thread:

...CANopen. Our team here in Brest thinks for the moment that this is too complex for 8-bit Arduino, and that it is difficult to make it work without a (possibly embedded) computer connected to the network. We are trying now to create a new open-source protocol on-top of CAN, that shall work with sensors and actuators (synchronisation and producer/consumer global network variables).

So if I'm wrong, please tell us.

Bernt

EDIT: added the word "CANopen". The statement was cut a little bit too short.

You could probably ask ATMEL seeing as how they make embedded CAN controllers for some reason.

Dear GoForSmoke,

GoForSmoke: You could probably ask ATMEL seeing as how they make embedded CAN controllers for some reason.

I'm not sure if I understand correctly, what you try to tell me. I understand: "If you are right, it does not make any sense to integrate into 8-bit AVRs any CAN controller (e.g. AT90CAN etc). So you must be wrong."

Sure we could use an AVR with integrated CAN controller. For the moment, we did not for the following reasons: - close Arduino compatibility : There is no 8-bit Arduino with integrated CAN controller. The CANinterfacer is closely compatible to an Arduino Leonardo with a CAN shield. (We use that fact in the present prototyping phase by mixing shield nodes with CANinterfacers sharing the source code.) - In marine applications we see lots of serial communication (NMEA183). It is interesting to have USB, CAN and a free hardware UART on the micro-controller. Does any 8-bit AVR exist that has both CAN and USB? Without that requirement, we could use something like the ATMEGA32M1, which should be easy to use as the nearly identical Arduino Leonardo with ATMEGA32U4. (We might still go this way soon, if we don't use USB anyway. One of the currently used bootloaders does not yet have USB support, but has CAN boot support (see Fabian Greif's work at http://www.kreatives-chaos.com/artikel/can-bootloader). But normal Arduino Leonardo bootloader serves (with USB and external CAN) in the use-case as CAN-host interface.) - It will be easy to port everything working with CAN shields to any upcoming 8-bit Arduino with integrated CAN. Arduino Due based cards could quickly become a nice alternative too.

And why do I think that CANopen might not be the way to go on 8-bit AVRs? - If you are a bigger company, being able to participate to CiA, and get a vendor-id for the protocol, and create your own CAN profiles, CANopen is more interesting. This is much harder for the common Arduino user that I am. - Is it possible to make a really simple, Arduino-like CANopen library for this relatively complex protocol? - Is it possible to use CANopen on a bus made of 8-bit Arduinos, or is a more powerful bus-host necessary?

(For the moment we decided not to use CANopen for these reasons. If somebody with better knowledge on the subject shows us answers to these questions, we might quickly return to CANopen.)

Bernt

I am telling that ATMEL does provide documents including applications notes on such things. They don't just make chips that "should" be capable but actually make chips that are tested capable and provide customers with how-to knowledge. Yeah it's silly but they have these ideas to sell products on continual basis.

I don't provide such. I am not expert in these things to debate your maybes. ATMEL has such experts but you have to ask.

GoForSmoke: I am telling that ATMEL does provide documents including applications notes on such things. They don't just make chips that "should" be capable but actually make chips that are tested capable and provide customers with how-to knowledge. Yeah it's silly but they have these ideas to sell products on continual basis.

I don't provide such. I am not expert in these things to debate your maybes. ATMEL has such experts but you have to ask.

Time is our problem. We spend time on looking how to get CANopen working for our 8-bit only Arduino case. At some point, without having got a complete answer to the question if that was possible, we came to the decision that the job had to be done and that the only way to achieve this in time was to do it without CANopen. Communicating with an ATMEL expert on the question would cost more time, to me and the ATMEL engineer (spending his time with tiny customer). In my last post I documented the blocking points, the answer is not so important to me in the short term, but perhaps it helps someone else to go further. I'm surely interested in the results.

And I spend time investigating the option of integrated CAN controllers. My decision to use integrated USB and external CAN was based on current advances of Arduino and available AVR processors. It is likely that time will push things in your direction.

Neither of these decisions is definitive, I will feel free to change mind, when the occasion arises.

Bernt

The direction is not mine. I only tried to give advice that may be useful.

Hello everybody

I am a student from Klaip?da University (Lithuania), I study my masters in electrical engineering, at the same time I work for company UAB "V?jo projektai" (Wind projects). At the moment we are rebuilding an old trolleybus into a test lab vehicle. We will test inovative technology on that vehicle. You may ask what technology?

I hook up the drive, inverters, batteries, control HMIs. All that stuff communicates through CAN bus with CANopen protocol. So I got an introduction of what is a CAN bus when I started to work.

I am not a pro on that, I certainly have to get some real books about CAN and CANopen. But still, playing with it, I've become atleast a technitian of CAN communication.

Even sought the system was meant to work with CANopen protocol, some nodes are working in manufacture specific or hardware layer.

I've been asked to mimic the TouchPanel control systems as cheap as possible. For example Tesla's iPad like or Solaris DASA5 system (12k EUR full support).

So I've just started a blog on how to do the Touch Screen Control of EV using Arduino and Android.

I've analized the situation of the forums and found that nobody has made the CANopen device out of Arduino. Only hardware layer.

I look forward for your support, any libraries, any help on the coding. Because I know about C coding, Arduino APK's and CANopen as a tip of an Iceberg. But still, I've managed to control the vehicle systems by an Android Tablet.

Hi Dark_Alximik and guys

What's the situation now about the CANOpen protocol on an arduino board?

Is it possible to implement the CanFestival protocol on an ATmega 8 bit microcontroller used by an arduino board?

What's the low power and simple microcontroller that you have used to implement the CANOpen protocol?

Thanks in advance....

alessio31183