0

Red lines/noise? on DotStar FeatherWing connected to ESP32
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Red lines/noise? on DotStar FeatherWing connected to ESP32

by hex86 on Thu Mar 08, 2018 2:36 pm

Hello,

I was previously using an ESP32 dev board with the NeoPixel featherwing and was experiencing the well known timing issues creating random noise in the LEDs frequently. I have been following the ongoing R.M.T. bug fixes on github to deal with this but in the mean time I decided to move to the DotStars due to the stability and compatibility improvements with the inclusion of the clock line....or so I thought.

When I received my dotstars featherwing I hooked it up to my ESP32 dev board (heltec) loaded in the sample code and other examples and immediately noticed a failure where some stretches of the LEDs show up red. I then tried it on a 32u4 board and observed that it worked perfectly without any such streaks. I've tried it on various pins on the ESP32 for clock and data and powering the featherwing off of 5v and 3v3 but the issue persists. Is anyone familiar with this problem? While trying to research the issue I found people using raspberry pi's had to slow down the lines to below 8MHz or less but I didn't see a way to do this in the ESP32 easily.

Is there something I'm overlooking or is there a better way to do this? At the end of the day I just want a small dotstar (6x12)/neopixel (4x8) matrix that is as stable on an ESP32 as an Arduino.

For reference I have posted a small video clip of problem here: https://youtu.be/LqW0s65SWGQ

Keep your eye on the top row of dotstars. (note this does "bleed into" the second row at times)
Last edited by hex86 on Fri Mar 09, 2018 1:09 pm, edited 4 times in total.

hex86
 
Posts: 4
Joined: Thu Jul 20, 2017 5:33 am

Re: Red noise on DotStar FeatherWing connected to ESP32

by hex86 on Thu Mar 08, 2018 6:17 pm

For anyone else out there who may be experiencing this issue I was able to remedy it today by adding some delayMicroseconds calls to the sw_spi_out in Adafruit_DotStar.cpp as follows:

Code: Select all | TOGGLE FULL SIZE

void Adafruit_DotStar::sw_spi_out(uint8_t n) { // Bitbang SPI write
  for(uint8_t i=8; i--; n <<= 1) {
#ifdef __AVR__
    if(n & 0x80) *dataPort |=  dataPinMask;
    else         *dataPort &= ~dataPinMask;
    *clockPort |=  clockPinMask;
    *clockPort &= ~clockPinMask;
#else
    if(n & 0x80) digitalWrite(dataPin, HIGH);
    else         digitalWrite(dataPin, LOW);
    delayMicroseconds(3);
    digitalWrite(clockPin, HIGH);
    delayMicroseconds(3);
    digitalWrite(clockPin, LOW);
    delayMicroseconds(3);
#endif
  }
}



With the delay value set to 1 microsecond I would still get red line noise at times. I let it run on 3 as above for around an hour and didn't notice it flicker at all on my desk. I've tried setting it to 2 now while writing this post and thus far I've not witnessed a failure. Perhaps adding an #elif for the esp32 in sw_spi would help. Also if there is a better way to handle precise delays on the ESP I'd love any feedback. I tried experimenting with commenting out some of the delays but wasn't able to find a pattern that was as stable as above but truth be told I only tried a few ways and then reverted to the set above that worked to move on to the next parts of my project.

hex86
 
Posts: 4
Joined: Thu Jul 20, 2017 5:33 am

Please be positive and constructive with your questions and comments.