Question
SPI Communication with TIM1
Posted on September 23, 2012 at 11:10
Hello everyone,
In my current project, I am working with Digital ledstrips. The strips I want to use have a WS2811 chip which is basically running a 1 Wire SPI interface (no clock Line). I will try to explain roughly how this works. RGB values are send on the bus line with the following encoding. bits are encoded on the line with PWM dutycycles over a 800Khz base frequency. basically : 0 = 20% Duty cycle 1 = 48% Duty cycle From what I have looked in the documentation, SPI works on a divider over main frequency and 800Khz will not be a standard frequency .. closest being around 525Khz. Therefore I thought that using TIM1 might be an option. configuring it to run 800Khz. then I need to update the PWM dutycycle. From the samples in the libraries, I looked at the DMA sample which allows to update the DutyCycle. though as I must update it to each cycle and that one update = 1 data bit, I am a bit worried about the data volume I'll need to keep for a full frame. Actually the barled will have around 300 Leds. each leds requires 24 Bits for RGB. that makes : 300 Leds * 24 Bits * (2 bytes per bit to define the duty cycle) = 14Kbytes of data for a frame. That is way too much for the internal memory, and I guess that we cannot run dma from flash. The other option would be to handle the TIM1 interrup and update the duty cycle with the next bit to send. Though I supposed that having an interrupt at 800 Khz is not a good idea. if you have any suggestions for this application, That would be appreciated :)