SparkFun Forums 

Where electronics enthusiasts find answers.

Have questions about a SparkFun product or board? This is the place to be.
By joh
#120359
It seems the RGB Matrix can be pushed into a non-working state where a re-flash is necessary to restore functionality.

Using an Arduino as SPI master, this is my test code:
Code: Select all
void setup() {
    SPI.begin();
    SPI.setClockDivider(SPI_CLOCK_DIV64);
}

void loop() {
    digitalWrite(SS, LOW);
    for (int i = 0; i < 64; i++) {
        SPI.transfer(random(255));
    }
    digitalWrite(SS, HIGH);
    delay(500);
}
This will at first result in random colors on the LED Matrix as expected. However, after a few seconds the display will freeze up completely. Resetting it sometimes results in the "Ready State" pattern appearing (RRGGBB), but no response to any SPI data. Other times it responds to SPI data, but the rows/cols are mixed up resulting in seemingly random positions of the pixels.

At this point, a re-flash of the firmware is necessary to restore functionality.

Has any other RGB Matrix owners experienced this? If not, are you able to re-produce the problem?

I'm trying to figure out if my matrix is defective and needs to be replaced, or if I'm doing something wrong...

- Johannes
By coyote20000
#120361
Perhaps try the new firmware. If i had v4 i'd try your code and let you know the results.
By joh
#120368
coyote20000 wrote:Perhaps try the new firmware. If i had v4 i'd try your code and let you know the results.
I forgot to mention that I'm already using the v4 firmware...
By joh
#120402
Ah I think I see what's happening. In some cases, random(255) will return 0x25 ('%') which causes the board to enter command mode. The next random byte received will set the number of boards...
By joh
#120406
Ok, now I got it working. v5 includes a special start-of-frame command (0x26) which should be sent before each frame. Also, it seems necessary to set the number of boards at the beginning. This code works:
Code: Select all
void setup() {
    SPI.begin();
    SPI.setClockDivider(SPI_CLOCK_DIV128);
    
    //Send the command mode character
    digitalWrite(SS, LOW);
    SPI.transfer('%');
    digitalWrite(SS, HIGH);
    delay(100);
    //Configure the correct number of boards
    digitalWrite(SS, LOW);
    SPI.transfer(1);
    digitalWrite(SS, HIGH);
    delay(100);	
}

int color = RED;

void loop() {
    int i;
    
    if (color == RED)
        color = BLUE;
    else if (color == BLUE)
        color = GREEN;
    else
        color = RED;
    
    digitalWrite(SS, LOW);
    SPI.transfer(0x26); // start of frame
    for (i = 0; i < 64; i++) {
        SPI.transfer(color);
    }
    digitalWrite(SS, HIGH);
    
    delay(500);
}
By jhmckeever
#130638
I get the following issue when trying to compile the V5 firmware in my Arduino environment (v22).
Does anyone have any suggestions?
Code: Select all
RGB_Backpack_v6.cpp: In function 'int main()':
RGB_Backpack_v6:117: error: invalid conversion from 'volatile char*' to 'char*'
RGB_Backpack_v6:117: error: initializing argument 1 of 'void parse_frame(char*)'
RGB_Backpack_v6.cpp: In function 'void fillBoardCount(char)':
RGB_Backpack_v6:340: error: invalid conversion from 'volatile char*' to 'char*'
RGB_Backpack_v6:340: error: initializing argument 1 of 'void parse_frame(char*)'
TIA - J.