sumikchakka / jallib

Automatically exported from code.google.com/p/jallib
0 stars 0 forks source link

Missing SPI baudrate selection #199

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
The SPI libraries do not have a procedure to select the baudrate. Such a 
facility is needed for devices requiring a specific baudrate, for example 
WS2811, WS2812(B).

Original issue reported on code.google.com by robhamerling on 31 Aug 2014 at 7:47

GoogleCodeExporter commented 9 years ago
Hi Rob,

Please provide the location of the datasheet, and the page that shows the 
required baudrate so I may read about this.

I would suggest you see what the result is at a lower speed.

Original comment by mattschi...@hotmail.com on 1 Sep 2014 at 2:31

GoogleCodeExporter commented 9 years ago
See for example:
 12f1840 DS40001441E section 25.7 p.241
 18f26k22 DS41412F section 15.7 p.258
Probably all PICs with 4 bits SSPxCON1_SSPM field have mode 1010 to select the 
baudrate for SPI via SSPxADD.

Original comment by robhamerling on 1 Sep 2014 at 8:05

GoogleCodeExporter commented 9 years ago
Hi Rob,

I am aware of the PICs SPI speed setting, I would like to read about the 
required speed for WS2811.

Original comment by mattschi...@hotmail.com on 1 Sep 2014 at 10:44

GoogleCodeExporter commented 9 years ago
WS2811 does not use an SPI compatible protocol. It is some kind of combined 
sync/data protocol at 400 or 800 kHz (selectable at the chip). To transmit "0" 
the line is 1/5 bit time high and 4/5 bit times low. To transmit "1" the line 
is 1/2 bit time hing and 1/2 bit time low.

You can generate these signals using SPI plus external circuitry, SPI alone 
will not do. It might be better though to use an USART in syncronuos mode for 
the required back-to-back-transmission is easier done that way.

You could, however, generate the "0"-shaped clock by PWM, and transmit the "1"s 
from SPI configured as slave.

Original comment by karlki...@yahoo.com on 1 Sep 2014 at 11:23

GoogleCodeExporter commented 9 years ago
WS2811 is not an SPI device. It uses a single pin for data and timing in a 
manchester-code style. 

Original comment by jsu...@gmail.com on 1 Sep 2014 at 11:32

GoogleCodeExporter commented 9 years ago
From what I've read (mainly in PicList and some URLs mentioned there) that the 
WS2811/WS2812 is not so critical about the signal shape. The capture point is 
in the middle of the period. Some people have succeeded by transferring 3 bits 
at 2400 Kbps (100 and 110), I have in mind to use 4 bits at 3200 Kbps (1000 and 
1110) and send 2 of these as byte to the SPI interface. For this reason I would 
need an SPI baudrate of 3.2 Mbps.  
Maybe there are other solutions without external devices. 
BTW I know you can buy cheap ready-made controllers for this purpose! 

Original comment by robhamerling on 1 Sep 2014 at 3:11

GoogleCodeExporter commented 9 years ago
Hi Rob,

Can this issue be resolved? It seems that WS2811 does not use SPI as you 
mentioned, and therefore this is not an SPI issue.

Maybe a separate lib is needed. From what I know, SPI devices are not speed 
dependent since SPI clocks data in/out.

Matt.

Original comment by mattschi...@hotmail.com on 3 Sep 2014 at 12:07

GoogleCodeExporter commented 9 years ago
OK, my request was with WS2811/12 in mind. But I assumed being able to specify 
a baudrate (more than only with Fosc/4,16/64) would be a nice to have for real 
SPI devices too.
For the WS2811/12 a specific library might be a good alternative.
So I'll close this issue with 'invalid'.

Original comment by robhamerling on 3 Sep 2014 at 2:01