|
|
View previous topic :: View next topic |
Author |
Message |
acidice333
Joined: 14 Oct 2006 Posts: 33
|
ws2811/2812b |
Posted: Sat Feb 01, 2014 1:33 am |
|
|
So im trying to play around with getting my WS2812B's working using this code here http://www.insomnialighting.com/code/ws2811.c
and they work on my 18F4550 with the fuses changed to something like this:
Code: | #FUSES HSPLL,NOWDT,NODEBUG,USBDIV,PLL5,CPUDIV1,VREGEN
#USE DELAY(CLOCK=48MHZ) // using 20mhz crystal |
and so now Im trying to use it on the 24FJ32GB002 but nothing happens. I do have a test led blinking so I know the code is running.
Code: | #FUSES HS,PR_PLL,PLLDIV8, PLL96MHZ, NOCKSNOFSM,NOIESO,SOSC_IO,NOWDT,NOJTAG,NODEBUG
#USE DELAY (CLOCK=32MHZ) // using 32mhz cystal
|
Am I using the #delay statements right for my crystals?
I assume the ws2811_one and ws2811_zero bits has to be modified?
Code: | #define ws2811_zero 0b10000000
#define ws2811_one 0b11110000 |
Just an assumption from doing a search on the forum. I know timing is critical but I'm not that great at programming. I have been using ws2801's but I'd rather try and upgrade to this. |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9221 Location: Greensville,Ontario
|
|
Posted: Sat Feb 01, 2014 9:42 am |
|
|
I downloaded that program and it seems ok. The fact it works on the 4550 is great news.
As for running on the 24F PIC....
1) I'd setup the PIC to run speed as the 4550 (IE 48MHz), so that timings should be the same as seen on a scope. Confirm with the 1Hz LED test ! Getting the fuses right can be, well, fun...
2) do not change the ws2811 bit values...go with what works ! changing them changes the timing....(well bit widths and positions)
3) does the 24series default int to 8 bit or 16 ? Again, I don't use them, but that might be an issue.
4)I have to ask, WHY 'upgrade' from ws2801 to ws2811? PICs are cheap, so saving a pin can't be a reason. Can't really save on wiring, can you? 2801s are 24bit as well. Just curious.
hth
jay |
|
|
jeremiah
Joined: 20 Jul 2010 Posts: 1345
|
|
Posted: Sat Feb 01, 2014 10:20 am |
|
|
I haven't dug through the entire data sheet, but your comments reference a 32MHz crystal, which usually won't work with PIC24 chips. You can use a 32MHz oscillator chip, but most PIC24 can't use crystals much higher than 24MHz. If you look at page 114, it shows the proper FUSES for 32MHz, but notice it only uses the EC (External Chip) fuse rather than giving an option for HS (High Speed Crystal) fuse like it does for 24MHz and below.
Also, it sometimes helps to be more specific with the #use delay() on some PIC24 chips. Things like #use delay(crystal=20000000,clock=32000000) sometimes help the PCD compiler better lay out the parameters for the PLL.
temtronic wrote: |
3) does the 24series default int to 8 bit or 16 ? Again, I don't use them, but that might be an issue.
|
PCD chips (PIC24, dsPIC) default to 16bit for integers. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19496
|
|
Posted: Sat Feb 01, 2014 12:44 pm |
|
|
Add one more thing.
The PCD compiler now usually defaults to signed. This causes quite a few problems with drivers.
Best Wishes |
|
|
bkamen
Joined: 07 Jan 2004 Posts: 1615 Location: Central Illinois, USA
|
|
Posted: Sun Feb 02, 2014 12:00 pm |
|
|
jeremiah wrote: | I haven't dug through the entire data sheet, but your comments reference a 32MHz crystal, which usually won't work with PIC24 chips. You can use a 32MHz oscillator chip, but most PIC24 can't use crystals much higher than 24MHz. If you look at page 114, it shows the proper FUSES for 32MHz, but notice it only uses the EC (External Chip) fuse rather than giving an option for HS (High Speed Crystal) fuse like it does for 24MHz and below.
|
Right -- if you want to get full speed out of a PIC24F series, you typically stick with an 8MHz Xtal which is x4 via the PLL to 32MHz.
(which then is /2 for the Fcy) _________________ Dazed and confused? I don't think so. Just "plain lost" will do. :D |
|
|
acidice333
Joined: 14 Oct 2006 Posts: 33
|
|
Posted: Sun Feb 02, 2014 8:03 pm |
|
|
Thanks for the help.
I'm upgrading from ws2801 to ws2812b because its cheaper in the long run because I need to do 288 of these for a LED table project so I figured I'd try to get this working and go that route than to make 268 more pixel modules ;)
So far so good. I found out there wasn't any SPI activity going on and thats why the ws2812b's weren't working. Ended up being an `int8` cast as signed but I needed unsigned. Works now. |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|