pinMode changes mode on subsequent Neopixel write() in 2v00 causing Green first Neo in WS2812b strip #4732
Replies: 1 comment
-
Posted at 2019-01-23 by @MaBecker Here you find the source code of jswrap_neopixel.c, there is a section for each board. Button History show the changes that where applied. Posted at 2019-01-23 by @gfwilliams It depends a little on the board what mode gets used, but the mode has to be So yes, the pin mode will get changed, or neopixel won't work. There haven't been any major changes to the neopixel code in a while, so I'm not convinced you're seeing a code change since 1v99. It might just be something electrical that's different like the voltage you're powering the board from. It might be worth checking out http://www.espruino.com/Reference#l_neopixel_write :
Posted at 2019-01-23 by Robin Wed 2019.01.23 Thank you @gfwilliams for the clarification. I must concede that prior to 1V99 that I most likely never verified what the pin mode actually was after a > ' something electrical that's different like the voltage you're powering the board from' Same setup, powering the Pico from the laptop USB and the Neopixel string from a 2amp 5V wall charger. Since both are 5V devices, attempting the 'af_opendrain' with pull-up won't work as there is no level shift involved. Since I never had an issue previously, never needed to consider that. Time to acquire a scope? After another hour of testing, the Green first Neo has an interesting anomaly. When sending a short array size of length 24 (8 Neo*3) the anomaly is non-existent and the color is as expected. When sending a large array of 60 Neo's, the Green anomaly is always present. The cutoff is around an array of 16 Neo's, which is curiously a multiple of 2,4,8 etc nice binary multiples. Could there be a blip in the SPI data stream when sending larger arrays? May never get this solved and is most likely time to acquire a scope to now 'see' what is going on, as I noted from links in #50 of post show that other competitor boards and different software have the same issue. So the Neopixel strip Ws2812 or 5050 daisy chained that are more likely the culprit. I also now notice there is a bit of annoying flicker occurring when running full brightness. 2V00 Could there be a clearing of data before output or too long a reset pulse? Maybe time to give up the purest solution and use @allObjects #51 leading and @MaBecker #35 waste Neo the solution. Haven't attempted this with nRF52 yet. Posted at 2019-01-23 by Robin Older Espruino version first Green Neopixel anomaly update Wed 2019.01.23 four hours later Curiosity got the better of me and I reflashed to an older version. And as I expected, the first Neo Green anomaly goes away! The first Neo never illuminates Green. This is as expected. So, confirmed, there is something different for hardware SPI on a Pico (in this case 1V94 which works) in older versions, compared to 2V00 which causes the false first Green Neopixel in a WS2812b string.
When first powering the board, this is the default mode
And confirmed as suggested in #3 does switch after a code 'send' is performed
No pull-up used in data line as both devices at 5V Posted at 2019-01-24 by @gfwilliams
Pico isn't a 5v device. The outputs are 3.3v - hence the need for the level shift mentioned in that link for STM32 devices like the Pico. Posted at 2019-01-24 by @gfwilliams Try running the Neopixels off a LiPo battery - that's the easiest way to test. The ~4v voltage still works fine with the pixels but the voltage allows the 3.3v signal from the Pico to get through correctly. Also worth checking - are the grounds of the two power sources connected? That's another potential culprit of the first green LED. While 1v94 may work for you, in the ~18 months since that version other people have used Neopixels with Espruino Pico (me included - I just did exactly that with a Pico running 2v01 to make sure yet again) and it works absolutely fine. Posted at 2019-01-24 by @MaBecker Or use the trick with the diode like mentioned here http://forum.espruino.com/comments/14506218/ |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Posted at 2019-01-23 by Robin
Tue 2019.01.22
The following did not occur in 1V99 but is now repeatable in 2v00
From @allObjects and @MaBecker exchange in #65
setting the pinMode to 'output' should resolve the first Green Neo issue. I found that point interesting as I had written tons of Neopixel code in 1V99 and never witnessed the first Green Neo anomaly ever.
Note that Not calling pinMode() first responds with the following default:
and, consequently turns on the first Neo Green even when triplet 0,0,0 is sent for black
From the Note:
So setting to false should dis-able automatic then?:
Verified:
but, subsequent calls to
require("neopixel").write(B15, ar);
toggle the state back toand, the first Neo in the string returns as Green. Not what we want.
Were there changes to the Neopixel module since 1V99 ?
Beta Was this translation helpful? Give feedback.
All reactions