RAINBOWDUINO - POSSIBLE TO PROGRAM CHAINED BOARDS VIA I2C?

Hi,
from the heightness of my ignorance I would like to ask to more expert users
if it’s possible to program multiple rainbowduino boards once they’re, for example, configured as a 4-unit chain.
Let’s say I wish to keep em plugged like in the video example and reprogram their slave code via I2C;
and if it’s possible, I would like to program different code into different boards with unique I2C addresses.
Is there a way to use addresses to route the code to different boards?
It would save much time in the prototyping and test of code.
But I’m no expert in I2C so maybe it’s an impossible thing to do, sorry if I’m asking stupid things!
Thanks for your help,
kk

if i understand you correctly, that functionality is already there. To address the different rainbowduinos, you need to send a different address in your i2c commands.

like in

ShowChar(4,words[i],r[i],g[i],b[i],j);

the 4 is the address of the rainbowduino.

in the manual you will see that most commands have the address as the first thing to send.

hope that helps.
if not, then i dont think i clearly understand what it is you are looking for.

Hi,
thanks for the answer, and sorry if I didn’t explain clearly,
I re-edited my post and hope now it’s clearer.

THE SITUATION:
I have 4 rainbowduino boards chained together, and 1 Arduino connected via I2C as master controller,
it’s working and I can send commands to different addresses using the “ADD” parameter
for functions like ShowChar, ShowCol, etc…
I also have a USBUart that I normally use to program the boards, I know that’s the way to do it.

THE QUESTION:
I would like to know if it’s possible to
reprogram the code that’s inside the ATMEGA on the rainbowduino via I2C bus or the USBUart,
addressing each sketch to its target board.

I want to upload the code from the Arduino IDE to each of the boards,
without un-chaining them everytime,
using the I2C bus or the USBUart to program the boards via Arduino.
I don’t want to use the I2C bus to control the boards in a master-slave configuration,
but as a “multichannel” programming bus for multiple rainboduini.

The reason is that I would like to use the rainbowduini as stand-alone, without any master controller.
But maybe the only way is to implement and test the functions using the usual slave-master configuration,
using just 2 boards, and when they’re ok just adapt the code to a stand-alone version.

EXAMPLE OF SOMETHING SIMILAR:
Something like this:
http://www.equinox-tech.com/Products/details.asp?ID=1283

Am I wishing something impossible or currently not impement-ed/able?
If that’s the case please excuse my ignorance.
Maybe it’s something so strange that no one can understand :slight_smile:
But could be a nice feature to add…
Thanks a lot again,
ciao!
kk

Of cause yuo can reprogram the code that’s inside the ATMEGA on the rainbowduino. you can use the UartSB or any other AVR programmer to do this .

you can fine more information about rainbowduino programing in our blog .

kkkk: I suspect that the answer to your question is no. The first problem is that the ATmega microcontrollers found in Arduinos (including the Rainbowduino) cannot be programmed at all via the I2C port, so that approach simply isn’t viable. While you’re correct that I2C devices such as the EEPROM chip you mentioned via the link can generally share a bus and be written to independently, ATmega microcontrollers just can’t be programmed via I2C.

So, that leaves programming via the serial interface the only approach. The second problem is that the serial programming interface isn’t set up to handle multiple devices. There’s no way to send a command over the USBUart that says something like “now I want just the third of the four Rainbowduinos to listen to me when I send you a new program.” So as far as I can tell, you can’t do it.

You’re quite right that this is an inconvenient shortcoming when using more than one Rainbowduino. I think that you’re right that using a separate microcontroller to develop your code is probably the simplest solution. You could also consider using a separate microcontroller as your final design, i.e. to drive all of the chained Rainbowduinos. Then at least your development environment matches your final product. I understand, though, that hanging another micro off the chain isn’t a completely attractive prospect.

–Adam

Thanks for the precise answer man, it clears al the doubts I had.
At this point, if you have a multiple matrix setup, and you need to frequently update the code inside the boards,
I think the best procedure is to chain the boards with 5cm cables between the power and I2C pins,
instead of short and fixed shits, so you have some space to plug the USBuart
while keeping all the other connections plugged.
Now I just have to understand how to convince the pixels to do exaclty what I want,
but that’s another story…

Muchas gracias indeed,
have a bright day,
bless,
kk

Couldn’t you do it with a custom bootloader? Have some sort of preamble that identifies which board you are targetting, and the bootloaders on the non-targetted boards won’t go into programming mode?

I suppose it’s possible to do in theory, I would love to be able to code it,
but it’s far too difficult for me. Maybe some micro-guru will get his hands dirty and give it a try…

You can reprogram the boards without disconnecting them by using a 6-pin ICSP cable. One programmer that works well for me if the adafruit USBTinyISP (adafruit.com/index.php?main_ … ucts_id=46). You do have to pull off the LED matrix to get access to the header, but that’s often easier than disconnecting a long series of boards. The avrdude software can burn the .bin file that the Arduino environment produces, just make sure to not overwrite the bootloader.

perhaps this stuff will make its way to the rainbowduino :wink: