shifty VU and satellite module: duemilanove yes, mega 2560 no??

Helle,
I’m using macetechs shifty VU, Octobar and satellite module for room lightning. Did the first runs with the duemilanove and now (to expand inputs) I’d like to use the mega 2560 with the same setup.
I have a little sketch, which just turns on one stellite module after the other. It works with the duemilanove. When I now just exchange the duemilanove with the mega 2560 and use the same sketch, nothing lights up.
Anyone haning the same problem and perhaps solution?

I have a little sketch

..which you couldn't be bothered to share?

Could be I2C pins being different between the boards, or something else like that. Unless you post your code or provide way more details it will not be easy trying to help you with your problem.

Lefty

Of course I can (just wasn’t at the computer with the IDE).
But I don’t really know how the sketch has something to do with that.
EDIT:
correction to myself. Just thought that those who answer are in knowledge, that the shifty “just” works with 3PWM outputs.
EDIT2: dammit wrong again… the sketch I used was a partial copy of the example from macetech, which uses SPI (as I understand it now)
Which is where I was wrong (again), sorry about that (just soldered the light mixing hardware for 10hrs)
/EDIT
All pins from the duemilanove are in existance at the mega 2560. Some of the digital PINs with more functions (aka PWM) but non with less or other, at least the pins relevant for the standard shields… (ok wrong, see EDIT above)

#define clockpin 13 // CI
#define enablepin 10 // EI
#define latchpin 9 // LI
#define datapin 11 // DI

#define NumLEDs 8

int LEDChannels[NumLEDs][3] = {0};
int SB_CommandMode;
int SB_RedCommand;
int SB_GreenCommand;
int SB_BlueCommand;

void setup() {

   pinMode(datapin, OUTPUT);
   pinMode(latchpin, OUTPUT);
   pinMode(enablepin, OUTPUT);
   pinMode(clockpin, OUTPUT);
   SPCR = (1<<SPE)|(1<<MSTR)|(0<<SPR1)|(0<<SPR0);
   digitalWrite(latchpin, LOW);
   digitalWrite(enablepin, LOW);


}

void SB_SendPacket() {

    if (SB_CommandMode == B01) {
     SB_RedCommand = 120;
     SB_GreenCommand = 100;
     SB_BlueCommand = 100;
    }

    SPDR = SB_CommandMode << 6 | SB_BlueCommand>>4;
    while(!(SPSR & (1<<SPIF)));
    SPDR = SB_BlueCommand<<4 | SB_RedCommand>>6;
    while(!(SPSR & (1<<SPIF)));
    SPDR = SB_RedCommand << 2 | SB_GreenCommand>>8;
    while(!(SPSR & (1<<SPIF)));
    SPDR = SB_GreenCommand;
    while(!(SPSR & (1<<SPIF)));

}

void WriteLEDArray() {

    SB_CommandMode = B00; // Write to PWM control registers
    for (int h = 0;h<NumLEDs;h++) {
          SB_RedCommand = LEDChannels[h][0];
          SB_GreenCommand = LEDChannels[h][1];
          SB_BlueCommand = LEDChannels[h][2];
          SB_SendPacket();
    }

    delayMicroseconds(15);
    digitalWrite(latchpin,HIGH); // latch data into registers
    delayMicroseconds(15);
    digitalWrite(latchpin,LOW);

    SB_CommandMode = B01; // Write to current control registers
    for (int z = 0; z < NumLEDs; z++) SB_SendPacket();
    delayMicroseconds(15);
    digitalWrite(latchpin,HIGH); // latch data into registers
    delayMicroseconds(15);
    digitalWrite(latchpin,LOW);

}

void loop() {

   LEDChannels[0][0] = 1023; //LED 1 SW
   LEDChannels[0][1] = 1023;
   LEDChannels[0][2] = 1023;

   WriteLEDArray();
   delay(1000);

   LEDChannels[2][0] = 1023; //LED3 NNO links
   LEDChannels[2][1] = 1023;
   LEDChannels[2][2] = 1023;

   WriteLEDArray();
   delay(1000);

   LEDChannels[3][0] = 1023; //LED4 SO links
   LEDChannels[3][1] = 1023;
   LEDChannels[3][2] = 1023;

   WriteLEDArray();
   delay(1000);

   LEDChannels[4][0] = 1023; //LED5 SO rechts
   LEDChannels[4][1] = 1023;
   LEDChannels[4][2] = 1023;

   WriteLEDArray();
   delay(1000);

   LEDChannels[5][0] = 1023; //LED6 NW unten
   LEDChannels[5][1] = 1023;
   LEDChannels[5][2] = 1023;

   WriteLEDArray();
   delay(1000);

   LEDChannels[6][0] = 1023; //LED7 NW mitte
   LEDChannels[6][1] = 1023;
   LEDChannels[6][2] = 1023;

   WriteLEDArray();
   delay(1000);

   LEDChannels[7][0] = 1023; //LED8 NW oben
   LEDChannels[7][1] = 1023;
   LEDChannels[7][2] = 1023;

   WriteLEDArray();
   delay(100000000);
}

retrolefty: Could be I2C pins being different between the boards, or something else like that. Unless you post your code or provide way more details it will not be easy trying to help you with your problem.

Lefty

They are, but to my knowledge not in use anyway....

What about the SPI pins?

From the official arduino docu:

The Mega2560 is designed to be compatible with most shields designed for the Uno, Diecimila or Duemilanove. Digital pins 0 to 13 (and the adjacent AREF and GND pins), analog inputs 0 to 5, the power header, and ICSP header are all in equivalent locations. Further the main UART (serial port) is located on the same pins (0 and 1), as are external interrupts 0 and 1 (pins 2 and 3 respectively). SPI is available through the ICSP header on both the Mega2560 and Duemilanove / Diecimila. Please note that I2C is not located on the same pins on the Mega (20 and 21) as the Duemilanove / Diecimila (analog inputs 4 and 5).

But, duemilanove:

SPI: 10 (SS), 11 (MOSI), 12 (MISO), 13 (SCK). These pins support SPI communication using the SPI library.

mega 2560:

SPI: 50 (MISO), 51 (MOSI), 52 (SCK), 53 (SS). These pins support SPI communication using the SPI library. The SPI pins are also broken out on the ICSP header, which is physically compatible with the Uno, Duemilanove and Diecimila.

OK, I was distracted by the above statement, but I’m not shure how to know, if the shifty really uses SPI…

What is the “shifty” ?

What do you imagine

 SPDR = SB_CommandMode << 6 | SB_BlueCommand>>4;
    while(!(SPSR & (1<<SPIF)));

does?

SPDR used in your sketch says your using SPI hardware and the pins are different from Uno Vs mega.

Lefty

Edit: AWOL beat me to it.

Lessons to myself: 1. don't copy to much from examples 2. if you do, spend some time to understand them 3. read a lot more docu BEFORE asking 4. give free beer to those how anser anyway... (which is to happen, when we meet sometime :-) )

Thanks for pointing me to my mistakes.

retrolefty: Edit: AWOL beat me to it.

Yeah and myself (edited the above post). Ah lesson 5: Don't post after 10hrs soldering and trying, it's nonsence most time anyway...

AWOL: What is the "shifty" ?

A shield: http://macetech.com/store/index.php?main_page=index&cPath=4 do drive some of these: http://macetech.com/store/index.php?main_page=index&cPath=1

And here we go with the answer from macetech, which I was too stupid to find on the site: http://docs.macetech.com/doku.php/non-hardware_spi_example

This is some examplecode to use the shield with the mega and software SPI (also code for the due kind of arduino boards, which is helpfull for shields,which are to use with hardware SPI (ethershield and alike)

Hope this will help some other folks out there, so my post wasn't useless altogether....