Categories

RoseOnRails – WIP LEDs strips

Hi everyone,

Yesterday afternoon and yesterday night, Valeh and I worked on the LEDs strip controller.
We wrote a programme on our STM32 development board, in order to control the LEDs. For some time, I thought that we would control the LEDs thank to SPI and DMA, but after having discussed with Samuel, It appears that it will be much more convenient for us to control our LEDs thank to a timer.

Yesterday afternoon, Valeh and I firstly tried to control our LEDs thank to a simple bit banging programme. This did kind of work, but some LEDs blinked in a strange manner, which made us believe we had a timing problem. We then decided to light the LEDs thank to a timer – as Samuel had told us to do – in order to have a quite precise timing. We have thus written  a programme using ChibiOS GPT (General Purpose Timer) Driver, which enables us to call a  callback every N cycle.
We are now using a 168MHz timer (corresponding to  our microcontroller’s frequency) which calls a callback every 67 cycle (i.e. every 0.4us). So that every 0.4us we can choose to set or clear the Ledstrip GPIO. This method will enable us to code 0 or 1 bits for the WS2812b.

Debugging in progress ….

RoseOnRails – Oh My Doc!

Hi everyone,

In the past few days I have tried coding something to control a LEDs strip….. by coding, I mean reading one million pages of doc for one line of code written.

For instance, in order to configure the SPI baud rate, I had to read a ludicrous amount of pages in the doc … only to find out that the default baud rate was the one I needed and had nothing to change in my code.

According to my calculation, I indeed needed a 20MHz frequence and the SPI on my development board was already configured at 21MHz … By the way, according to the precision required for the LEDs timing in the ws2812b doc, this 1MHz difference between the frequency we needed and the frequency we obtained shouldn’t have any negative impact on the functionning of our LEDs strips.

My SPI and DMA are now well configured and I hope to be able to light the LEDs really soon now even if that means reading one million more doc pages 🙂