0

Neotrellis issue
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Neotrellis issue

by mpc823 on Wed Dec 05, 2018 10:37 am

I've just gotten a 4x4 neotrellis with the button pad. I've found that both with my own Arduino code and with the "basic" example code, the buttons will work for a little bit and then the entire neotrellis appears to lock up. It doesn't respond to any button presses. If the code is Re-downloaded (arduino-based), the neotrellis fails at the trellis.begin() call. Only powering down and powering back up seems to fix it. The problem doesn't happen as often with the Basic.ino code as with my own, but it does happen.

I'm thinking maybe the seesaw chip is getting into a bad state?? Has anyone else seen an issue like this? It's disappointing, as I really like the neotrellis and it's perfect for my application.

Setup: I'm using an Adafruit ESP8266 Feather HUZZAH and a MusicMaker feather wing (from Adabox004). I'm also using a 128x64 OLED hooked to the same I2C bus. Perhaps the other device is causing an issue??

Daniel

mpc823
 
Posts: 38
Joined: Thu May 05, 2016 9:10 am

Re: Neotrellis issue

by adafruit_support_carter on Wed Dec 05, 2018 3:12 pm

You do have a fair amount of other things going on. Can you try recreating the issue with nothing but the NeoTrellis and the Feather?

adafruit_support_carter
 
Posts: 11467
Joined: Tue Nov 29, 2016 2:45 pm

Re: Neotrellis issue

by mpc823 on Sun Dec 09, 2018 2:01 pm

After further investigation by removing most of the other devices attached, I found I could still reproduce the issue. It's not consistent, and when there is only the keypad attached, it was difficult to reproduce. But what I found was that when the lockup happens, the seesaw::getKeypadCount() function is returning 255 all the time. I'm not sure why that is happening, but the solution I found that seems to work is to disable the keys with the trellis::activateKeys() function and then re-enable them if I see a count of 255 .

As an aside, I think there is a bug in the trellis::read() code, although that doesn't appear to be a cause of my issue. In that code there is this:
Code: Select all | TOGGLE FULL SIZE
uint8_t count = getKeypadCount();
    delayMicroseconds(500);
    if(count > 0){
        if(polling) count = count + 2;
        keyEventRaw e[count];
        readKeypad(e, count);


If the count = 255 & polling = true, then the count is changed to count + 2, which will wrap back to 1 because you are only using 8 bits to store the count. So you only read 1 event, even though it says there are 255 in the FIFO queue.

But even fixing this doesn't actually get at the root of the issue. But my hack, I think, works for me right now.

mpc823
 
Posts: 38
Joined: Thu May 05, 2016 9:10 am

Re: Neotrellis issue

by adafruit_support_carter on Mon Dec 10, 2018 12:52 pm

But what I found was that when the lockup happens, the seesaw::getKeypadCount() function is returning 255 all the time.

Does seem like something happening in the seesaw library. Can you explain how you get the issue to appear? Certain way you press the button? Just let it run for a certain period of time? Something else?

adafruit_support_carter
 
Posts: 11467
Joined: Tue Nov 29, 2016 2:45 pm

Re: Neotrellis issue

by mpc823 on Sun Dec 16, 2018 6:51 pm

The best way I found to reproduce it was to simply press a lot of buttons at the same time over and over. When I get the 255, it appears that it is either flooding the I2C bus or something wonky is happening, causing the i2C bus to simply be pulled high all the time. Occasionally when I got this, if I simply kept reading the bus as fast as I could (no delay()), it would finally go back to normal. But that wasn't always the case. And if I was getting the 255, it seemed my other I2C devices couldn't be communicated to as well, which is what was making me think the seesaw was flooding the bus.

mpc823
 
Posts: 38
Joined: Thu May 05, 2016 9:10 am

Re: Neotrellis issue

by adafruit_support_carter on Mon Dec 17, 2018 12:52 pm

Please open issues for these here:
https://github.com/adafruit/Adafruit_Seesaw/issues

Seems like you may have found two separate issues. This apparent lock up behavior and the possible bug in the trellis::read()

adafruit_support_carter
 
Posts: 11467
Joined: Tue Nov 29, 2016 2:45 pm

Re: Neotrellis issue

by DIYglenn on Thu Jan 10, 2019 12:11 pm

Was this issue resolved? We seem to be running into a similar issue with a 3x8 NeoTrellis setup (24 pcs, 384 LEDs).

DIYglenn
 
Posts: 12
Joined: Thu Dec 05, 2013 7:58 am

Re: Neotrellis issue

by adafruit_support_carter on Thu Jan 10, 2019 12:15 pm

It doesn't look like an issue was opened. I went ahead and created one:
https://github.com/adafruit/Adafruit_Seesaw/issues/18

If you have any additional information that could help, please add it to the discussion thread there.

adafruit_support_carter
 
Posts: 11467
Joined: Tue Nov 29, 2016 2:45 pm

Re: Neotrellis issue

by adafruit2 on Thu Jan 10, 2019 1:54 pm

hiya - can you try putting in a longer delay between i2c queries, maybe 20ms between calling the seesaw/trellis code? that seems like the most likely issue, if it gets an i2c call before its ready it can get into a bad state :)

adafruit2
Site Admin
 
Posts: 18395
Joined: Fri Mar 11, 2005 7:36 pm

Re: Neotrellis issue

by fjeoey on Fri Jan 11, 2019 11:03 am

Hi!

I'm on the same team as DIYglen above. We're building a 3x8 trellis step sequencer, which freezes up when running from a Max MSP (Max for Live)-device. This is on an Arduino Mega, and Max MSP only sends out simple information about which step the trellis is supposed to light up / shut off. Have tried putting in a delay before and after button read, which, if I understand correctly, should give the seesaw functions some time before the Arduino's doing a new reading of the trellis buttons. The code is based on the multitrellis example code.

Thanks!

Code: Select all | TOGGLE FULL SIZE
 
/* This example shows basic usage of the
MultiTrellis object controlling an array of
NeoTrellis boards
As is this example shows use of two NeoTrellis boards
connected together with the leftmost board having the
default I2C address of 0x2E, and the rightmost board
having the address of 0x2F (the A0 jumper is soldered)
*/

#include "Adafruit_NeoTrellis.h"
#include "Adafruit_seesaw.h"

#define Y_DIM 12 //number of rows of key
#define X_DIM 32 //number of columns of keys

uint32_t color = 10;
uint32_t farge = 0;

uint8_t pressed[384];

uint8_t seq = 0;
uint8_t lastseq = 0;



//create a matrix of trellis panels

Adafruit_NeoTrellis t_array[Y_DIM/4][X_DIM/4] = {
 
  { Adafruit_NeoTrellis(0x2F), Adafruit_NeoTrellis(0x30), Adafruit_NeoTrellis(0x31), Adafruit_NeoTrellis(0x32), Adafruit_NeoTrellis(0x33), Adafruit_NeoTrellis(0x34), Adafruit_NeoTrellis(0x35), Adafruit_NeoTrellis(0x36) },
  { Adafruit_NeoTrellis(0x37), Adafruit_NeoTrellis(0x38), Adafruit_NeoTrellis(0x39), Adafruit_NeoTrellis(0x3A), Adafruit_NeoTrellis(0x3B), Adafruit_NeoTrellis(0x3C), Adafruit_NeoTrellis(0x3D), Adafruit_NeoTrellis(0x3E) },
  { Adafruit_NeoTrellis(0x3F), Adafruit_NeoTrellis(0x40), Adafruit_NeoTrellis(0x41), Adafruit_NeoTrellis(0x42), Adafruit_NeoTrellis(0x43), Adafruit_NeoTrellis(0x44), Adafruit_NeoTrellis(0x45), Adafruit_NeoTrellis(0x46) }
 
};


//pass this matrix to the multitrellis object
Adafruit_MultiTrellis trellis((Adafruit_NeoTrellis *)t_array, Y_DIM/4, X_DIM/4);


//define a callback for key presses
TrellisCallback blink(keyEvent evt){
  if(evt.bit.EDGE == SEESAW_KEYPAD_EDGE_RISING){
    uint16_t key = evt.bit.NUM;
      if (key < 32){
        farge = 0xFF0000;
      }
      else if (key >= 32 && key < 64){
        farge = 0x00FF00;
      }     
      else if (key >= 64){
        farge = 0x00FFFF;
      }   
     
      if (pressed[key] == 0){
        trellis.setPixelColor(evt.bit.NUM, farge);
        pressed[key] = 1; 
        Serial.print(key+200); Serial.print(" "); Serial.println("1");    //ADDA 200 for routing i M4L!!!!!!!!!!!
       
        for (int i = key+32; i <= 384; i += 32){
          if (pressed[i] == 1){
            pressed[i] = 0;
            trellis.setPixelColor(i, 0); //off falling
          }
        }
        for (int i = key-32; i >= 0; i -= 32){
          if (pressed[i] == 1){
            pressed[i] = 0;
            trellis.setPixelColor(i, 0); //off falling
          }
        }
       
      }
      else if(pressed[key] == 1){
        trellis.setPixelColor(evt.bit.NUM, 0); //off falling
        pressed[key] = 0;
        Serial.print(key+200); Serial.print(" "); Serial.println("0");   //ADDA 200 for routing i M4L!!!!!!!!!!!
      }
  }
  //delay(20);
  trellis.show();
  return 0;
}




void setup() {
  Serial.begin(115200);

  if(!trellis.begin()){
    while(1);
  }
  Serial.println(1000);
  delay(500);
  int timer = 0;
  while (Serial.available() == 0 && timer < 1000){
    timer++;
  }
  timer = 0;
  //for (int i = 0; i < 32; i++){
  while (Serial.available()){
    int a = Serial.read();
    pressed[a] = 1;
    } 
  Serial.println(2000);
  delay(500);
  while (Serial.available() == 0 && timer < 1000){
    timer++;
  }
  while (Serial.available()){
  //for (int i = 0; i < 32; i++){
    int z = Serial.read();
    //if (z < 129){
      z += 255;
      pressed[z] = 1;
  }         


  for (int x=0; x<32;x++){
    for (int y=0; y<384;y+=32){
      //trellis.activateKey(y+x, SEESAW_KEYPAD_EDGE_RISING, true);
      //trellis.activateKey(y+x, SEESAW_KEYPAD_EDGE_FALLING, true);
      //trellis.registerCallback(y+x, blink);
      trellis.setPixelColor(y+x, 0x111111); //addressed with x,y
     
    }
    trellis.show(); //show all LEDs   
  }
 
  for (int x=31; x>=0;x--){
    for (int y=0; y<384;y+=32){
      trellis.activateKey(y+x, SEESAW_KEYPAD_EDGE_RISING, true);
      trellis.activateKey(y+x, SEESAW_KEYPAD_EDGE_FALLING, true);
      trellis.registerCallback(y+x, blink);
     
      if (pressed[y+x] == 1){
        if (y+x < 32){
          farge = 0xFF0000;
        }
        else if (y+x >= 32 && y+x < 64){
          farge = 0x00FF00;
        }     
        else if (y+x >= 64){
          farge = 0x00FFFF;
        }           
        trellis.registerCallback(y+x, blink);
        trellis.setPixelColor(y+x, farge);   
        trellis.show(); 
      }
      else{
        trellis.setPixelColor(y+x, 0x000000); //addressed with x,y
      }
      //delay(5);
    }
    trellis.show(); //show all LEDs   
  }
 
}



void avslutt(){
  for (int x=0; x<32;x++){
    for (int y=0; y<384;y+=32){
      trellis.setPixelColor(y+x, 0x110000); //addressed with x,y
     
    }
    trellis.show(); //show all LEDs   
  }
  int x = 1;
  while(x == 1){;
    int ranpix = random(383);
    int rancol = random(999999);
    trellis.setPixelColor(ranpix, rancol); //addressed with x,y
    delay(50);
    trellis.show(); //show all LEDs
  }
}




void loop() {
  delay(20);
  trellis.read();
  delay(20);

  //M4L-SEQUENCER TO TRELLIS-LEDS
  while(Serial.available()) {
    seq = Serial.read();
   
    //avslutt
    if (seq == 34){
      avslutt();
      delay(10000);
    }

    //sequencer stop
    if (seq == 33){
//AV
        for (int i = 0; i < 384; i += 32){
          if (pressed[lastseq+i] == 0){
            trellis.setPixelColor(lastseq+i, 0);
          }         
        }
       
        trellis.show();
    }

    //sequencer play
    if (seq != 33 && seq != lastseq) {
      if (seq % 4 == 0){
        color = 0x440000;
      }
      else{
        color = 0x222222;
      }



//SEQUENCER CLOCK - light up / shut off if not lit from earlier press
        for (int i = 0; i < 384; i += 32){
          if (pressed[seq+i] == 0){
            trellis.setPixelColor(seq+i, color);
            //delay(20);
          }
          if (pressed[lastseq+i] == 0){
            trellis.setPixelColor(lastseq+i, 0);
            //delay(20);
          }         
        }
     
       
    trellis.show();
    lastseq = seq;       
    }

  }
}

fjeoey
 
Posts: 2
Joined: Fri Jan 11, 2019 10:33 am

Re: Neotrellis issue

by adafruit2 on Fri Jan 11, 2019 1:55 pm

we can take a look but its not possible to reprogram the seesaw chip easily so we'd have to figure out a software solution. can someone post a minimal sketch that shows the problem, ideally one that doesnt require other software, so we can reproduce and debug? :)

adafruit2
Site Admin
 
Posts: 18395
Joined: Fri Mar 11, 2005 7:36 pm

Re: Neotrellis issue

by fjeoey on Fri Jan 11, 2019 4:59 pm

The code has been tested with different software (Pd) sending serial data to the Arduino, and the same freeze happens. So it seems no specific external serial emitting software is required to produce the freeze. It should be mentioned that the trellis will freeze up while receiving no serial data at all, though after a longer time period, which makes me believe that there's a bug in both the trellis read function and the seesaw led-communicat ion. I'll modify my code to be fully autonomous and see what happens. Will report back.

Again, this is a quite large setup with 3x8 neotrellis boards, which I guess not many people have done since it's such a new product. A maxed out setup has been tested by you, Adafruit?

fjeoey
 
Posts: 2
Joined: Fri Jan 11, 2019 10:33 am

Re: Neotrellis issue

by adafruit2 on Fri Jan 11, 2019 5:06 pm

we only tested 2x4 max i think :/

adafruit2
Site Admin
 
Posts: 18395
Joined: Fri Mar 11, 2005 7:36 pm

Re: Neotrellis issue

by DIYglenn on Sat Jan 12, 2019 2:49 am

The number 32 was repeatedly mentioned in the product description, as we were going for only 24 we thought this would be a safe number to avoid any incompatibilities with the chips.

We’ve invested a lot of time and money in this project, with a laser cut steel mounting frame, 3D printed spacer on top (to lock the silicone buttons) and a 2mm cnc cut aluminium plate with printed graphics.

Are there any suggestions for what we could do to fix this issue? Our deadline is February, and we’re about to start building the next set as well.

All data connections are soldered together, but we’ve separated ground and power so there’s a max of 4 modules on each set of wires from the power distribution. (6 connections in total). This was because a calculation of 384 RGB LEDs with 3x20mA in worst case scenario draws 23 amps, which I guess would put a strain on the PCB if connected from one NeoTrellis.

C4B3D55C-BDB6-458A-907E-F97FFD50F73C.jpeg
C4B3D55C-BDB6-458A-907E-F97FFD50F73C.jpeg (1011.87 KiB) Viewed 133 times

DIYglenn
 
Posts: 12
Joined: Thu Dec 05, 2013 7:58 am

Re: Neotrellis issue

by adafruit2 on Sun Jan 13, 2019 2:45 pm

are you using the busy/irq pin? i know that will help - you *do* need to tie all the ground wires together. the person who designed/tested the neotrellis isn't working at adafruit at this time so we'll do our best to debug - but we cannot guarantee that we'll get it working exactly the way you like!
i wonder if you separate into multiple I2C ports if that would help

adafruit2
Site Admin
 
Posts: 18395
Joined: Fri Mar 11, 2005 7:36 pm

Please be positive and constructive with your questions and comments.