How fast can an output pin be toggled?

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
User avatar
Markus Gritsch
Posts: 41
Joined: Fri May 16, 2014 9:04 pm

Re: How fast can an output pin be toggled?

Post by Markus Gritsch » Fri Jun 06, 2014 10:35 am

fma wrote:Nobody with STM32 C programming skills to write a dedicated driver for these leds? ;)
I don't see the need to have a dedicated driver written in C. Here is working MicroPython code to drive these LEDs: http://forum.micropython.org/viewtopic.php?f=2&t=149

fma
Posts: 164
Joined: Wed Jan 01, 2014 5:38 pm
Location: France

Re: How fast can an output pin be toggled?

Post by fma » Fri Jun 06, 2014 10:49 am

Markus Gritsch wrote:
fma wrote:Nobody with STM32 C programming skills to write a dedicated driver for these leds? ;)
I don't see the need to have a dedicated driver written in C. Here is working MicroPython code to drive these LEDs: http://forum.micropython.org/viewtopic.php?f=2&t=149
Very nice work! But you only drive 1 led, what if using a 600 leds strip? You will use all ressources sending datas to the leds...
Frédéric

User avatar
Markus Gritsch
Posts: 41
Joined: Fri May 16, 2014 9:04 pm

Re: How fast can an output pin be toggled?

Post by Markus Gritsch » Fri Jun 06, 2014 10:54 am

fma wrote:Very nice work! But you only drive 1 led, what if using a 600 leds strip? You will use all ressources sending datas to the leds...
And how would driver code in C help you? You still would have to prepare the LED color data in some buffer using Python, which will become the time critical part. Sending the buffer with some dedicated C driver or handing it to the SPI send function is not that different.

fma
Posts: 164
Joined: Wed Jan 01, 2014 5:38 pm
Location: France

Re: How fast can an output pin be toggled?

Post by fma » Fri Jun 06, 2014 11:07 am

There was a discussion about using DMA... Ok, maybe a DMA() object could be enough, working with the SPI() object. But I guess using pure C could optimize things.

Anyway, I'll give a try to your solution, as I was looking for a nice demo to present micropython to local AFPY members. This is a cool one ;)
Frédéric

User avatar
Markus Gritsch
Posts: 41
Joined: Fri May 16, 2014 9:04 pm

Re: How fast can an output pin be toggled?

Post by Markus Gritsch » Fri Jun 06, 2014 11:15 am

If your intention is to drive lots and lots of WS2812 LEDs and not just display some rainbow pattern, there are other, more suitable means, e.g. http://spritesmods.com/?art=imx233-ws2811 or https://www.pjrc.com/teensy/td_libs_OctoWS2811.html

Driving just some tens of them is easily possible using pure Python.

Post Reply