Page 3 of 3

Re: Can't get my NeoPixels to turn on

Posted: Tue Apr 28, 2020 6:28 am
by jimmo
OutoftheBOTS_ wrote:
Tue Apr 28, 2020 6:12 am
From the googling that I have done this seems to be the most common method for creating neopixle timings. basically work out how many NOPs are needed to get correct timings. Although it gets the job done it isn't very flexible to be able change the timings or running on different CPU freq MCUs. You can see mine uses a timer to create PWM on a pin but an interrupt changes the duty and freq at the end of each cycle to update the next cycle to be what ever the timing are needed for next cycle. The advantage is that it is very easy to adapt from different MCU's and different timing LEDs. See this in my video from 9:50 to 10:50 https://www.youtube.com/watch?v=4NSNO7NJv5c&t=2s
For sure. I agree that it's definitely a better and more robust approach! Was mainly just providing the other links as an FYI for other work in this area.

One difficulty with timers though is that now the API becomes a bit more complicated because it doesn't just work on any pin. So coming up with a Python API might have some challenges, but definitely not impossible. This is the same reason why defining a machine.PWM API for stm32 is tricky.

FWIW, I tested both the cycle counter version and instruction counter versions across a wide range of frequencies (although the F0 version needs some work).

Re: Can't get my NeoPixels to turn on

Posted: Tue Apr 28, 2020 6:42 am
by OutoftheBOTS_
jimmo wrote:
Tue Apr 28, 2020 6:28 am
One difficulty with timers though is that now the API becomes a bit more complicated because it doesn't just work on any pin. So coming up with a Python API might have some challenges, but definitely not impossible. This is the same reason why defining a machine.PWM API for stm32 is tricky.
I think something like Neopixel will have to have a slightly different API for each port of MP (I know this is exactly what MP is trying very hard to avoid) because it is so hardware related.

Code: Select all

WS2812B = const((0.4, 0.8, 0.85, 0.45))

timer = 4
channel = 1
timings = WS2812B

my_neopixel = NeoPixel(timer, channel, timings)
My method for STM32 would be better sorted to this type of API where the user selects the timer and channel rather than the pin.

Re: Can't get my NeoPixels to turn on

Posted: Tue Apr 28, 2020 10:45 pm
by OutoftheBOTS_
jimmo wrote:
Tue Apr 28, 2020 6:28 am
One difficulty with timers though is that now the API becomes a bit more complicated because it doesn't just work on any pin. So coming up with a Python API might have some challenges, but definitely not impossible. This is the same reason why defining a machine.PWM API for stm32 is tricky.
Maybe the API for these addressable needs to be moved to the correct hardware class for the port becuase they are so hardware related e.g

Code: Select all

WS2812B = const((0.4, 0.8, 0.85, 0.45))

#declaration for STM32 port
timer = 4
channel = 1
timings = WS2812B
my_neopixel = pyb.NeoPixel(timer, channel, timings)

#declaration for ESP32 port
pin = 4
RMT_channel = 1
timings = WS2812B
my_neopixel = RMT.NeoPixel(pin, RMT_channel, timings)

Re: Can't get my NeoPixels to turn on

Posted: Tue Apr 28, 2020 11:30 pm
by jimmo
OutoftheBOTS_ wrote:
Tue Apr 28, 2020 10:45 pm
Maybe the API for these addressable needs to be moved to the correct hardware class for the port becuase they are so hardware related e.g
Good question... I can see good reasons for both approaches. Would you be interested in writing up your findings on that PR I linked to before (it's still not merged yet, so open for discussion).

Re: Can't get my NeoPixels to turn on

Posted: Wed Apr 29, 2020 12:25 am
by OutoftheBOTS_
jimmo wrote:
Tue Apr 28, 2020 11:30 pm
OutoftheBOTS_ wrote:
Tue Apr 28, 2020 10:45 pm
Maybe the API for these addressable needs to be moved to the correct hardware class for the port becuase they are so hardware related e.g
Good question... I can see good reasons for both approaches. Would you be interested in writing up your findings on that PR I linked to before (it's still not merged yet, so open for discussion).
Ha Ha I am a little scared to go commenting on github.

This forum is where the learner programmers hang out and github is for the real programmers.

Re: Can't get my NeoPixels to turn on

Posted: Wed Apr 29, 2020 1:27 am
by jimmo
OutoftheBOTS_ wrote:
Wed Apr 29, 2020 12:25 am
Ha Ha I am a little scared to go commenting on github.

This forum is where the learner programmers hang out and github is for the real programmers.
I've seen your code and your video, you've spent a lot of time thinking about this and your comments are valuable. Just do it! :)

Re: Can't get my NeoPixels to turn on

Posted: Tue May 05, 2020 11:03 pm
by OutoftheBOTS_
jimmo wrote:
Wed Apr 29, 2020 1:27 am
OutoftheBOTS_ wrote:
Wed Apr 29, 2020 12:25 am
Ha Ha I am a little scared to go commenting on github.

This forum is where the learner programmers hang out and github is for the real programmers.
I've seen your code and your video, you've spent a lot of time thinking about this and your comments are valuable. Just do it! :)
I have updated my driver a little to fix a slight glitch discovered by the ardunio guys it now runs better https://github.com/OutOfTheBots/STM32_N ... ter/main.c