
Thread: Driving SK9822 or APA102 RGB LED's – 224 days old
-
6th July 2018, 12:50 #1
- Join Date
- Mar 2002
- Posts
- 1,791
- Total Downloaded
- 1.61 GB
Thumbs Up Received: 33
Given: 51
0Driving SK9822 or APA102 RGB LED's
I've been trying to figure out how to drive SK9822 or APA102 RGB LED's using the MSSP module in a PIC16F1503 but I'm getting nowhere. Part of the problem is that I haven't used MSSP SPI mode with a PIC16 series chip, and I hate to admit that I can't even find the SFR flag that tells me that the transmission is complete.
The data protocol for these LEDS is like this:
Start frame consisting of 32 0's
Multiple LED frames, each one consisting of: 3 1's, followed by a 5-bit global brightness value, followed by 8-bit Blue, 8-bit Green, and 8-bit Red values
End frame consisting of 32 1's
I would post my code, but it's such a mess that I'm embarrassed to show what a noob I am.
Can anyone help me get started on this?
Thanks!
-Rick
-
6th July 2018, 19:01 #2
0Re: Driving SK9822 or APA102 RGB LED's
Hello Rick
The Neopixel using the WS2812 has to be ran at high speed to match the internal clock, (See Adafruit Web site for great information) I had to use Assembly on a eight bit chip with 40 NS. timings,
The Dot star APA102 is a strange SPI with the 32 zeros and one's, I had to look far and wide on the net and found some information that cleared up some of the issues, I do not think the Dot star APA102 makes things any more easier than the Neopixel.
The thing you should have is a Saleae logic analyzer
I hope that at some time they will make a true SIPO it will have to have one color four wire or RGB with six wires.
Good luck it will drive you a little nuts.
Best to you
Gary
-
6th July 2018, 21:03 #3
- Join Date
- May 2011
- Posts
- 407
- Total Downloaded
- 186.00 MB
Thumbs Up Received: 79
Given: 0
0Re: Driving SK9822 or APA102 RGB LED's
The SK9822 and APA102 are infinitely easier to deal with than the WS2812.
All you need to do is send out a few bytes of SPI data at just about any reasonable frequency... none of the timing woes of those others.
The PIC16 SPI is pretty much the same as the PIC18 MSSP. You can tell when a transmission is complete by using the SSP1IF bit in PIR1, or the BF bit in SSP1STAT register.
-
6th July 2018, 23:25 #4
- Join Date
- Feb 2002
- Posts
- 3,118
- Total Downloaded
- 1.53 GB
Thumbs Up Received: 356
Given: 129
0Re: Driving SK9822 or APA102 RGB LED's
As Tumbleweed has said, the SK9822 and APA102 devices are quite easy to interface with, as it is, essentially, an SPI interface.
They are also, a lot, faster than the WS2812 devices, which are dreadfully slow. Lovely devices, but slow. :-) I'm a bit busy at the moment, but as soon as I get some time, I'll create an interface library for the SK9822 and APA102 devices. Well....... It will be for the APA102 devices, because I don't have any SK9822 devices, but, apparently, they are the same interface, but the APA devices are a lot faster. From what I've read, the SK9822 have a 4KHz speed, while the APA102 devices have a 19KHz speed. And with RGB LEDs in a strip or a panel, speed is a must for interesting projects. LOLFor more example programs for Proton and Proton24 or updates, please visit: Proton WIKI or Proton Files
-
8th July 2018, 13:34 #5
- Join Date
- Mar 2002
- Posts
- 1,791
- Total Downloaded
- 1.61 GB
Thumbs Up Received: 33
Given: 51
0Re: Driving SK9822 or APA102 RGB LED's
Thanks for the info!
I can't seem to get anything out of the SPI Master.
I've got the MSSP set up like this:
Code:All_Digital = true Declare Xtal = 16 '* Set I/O pin direction * APFCON = %00010000 TRISA = 0 'all pins digital output TRISC = 0 ANSELA = 0 ANSELC = 0 '* Set up MSSP module for SPI * SSP1STAT = %00000000 SSP1CON1 = %00100000 SSP1CON2 = %00000000 SSP1CON3 = %00000000 SSP1MSK = %00000000 SSP1ADD = %00000000
Code:SPItest: SSP1BUF = %10101010 DelayMS 1 GoTo SPItest
-
9th July 2018, 15:19 #6
0Re: Driving SK9822 or APA102 RGB LED's
Rick, Here is a small test program I wrote to do some testing of APA102C's around XMAS last year. It's in PBP.
-
9th July 2018, 18:43 #7
-
11th July 2018, 02:12 #8
- Join Date
- Mar 2002
- Posts
- 1,791
- Total Downloaded
- 1.61 GB
Thumbs Up Received: 33
Given: 51
0Re: Driving SK9822 or APA102 RGB LED's
Well- it seems to be working ....at least occasionally. I'm using this code:
Code:SPIloop: SHOut PORTC.2, PORTC.0, MsbFirst, [$00,$00,$00,$00] 'start frame ' global-BL-GR- RED SHOut PORTC.2, PORTC.0, MsbFirst, [$FF,$FF,$00,$00] 'LED1 Blue SHOut PORTC.2, PORTC.0, MsbFirst, [$FF,$00,$FF,$00] 'LED2 Green SHOut PORTC.2, PORTC.0, MsbFirst, [$FF,$FF,$FF,$FF] 'end frame DelayMS 1 GoTo SPIloop
The data and clock look fine on the scope and on the data analyzer, but the SK9822 LED's sometimes come on immediately, and sometimes take a minute or two to come on. I've got an LED blinking on another port, so I know the PIC is awake and the clock rate is properly declared.
At least it's a start. Could be a hardware issue. I'll post any new findings here.
-Rick
-
13th July 2018, 13:25 #9
0Re: Driving SK9822 or APA102 RGB LED's
Rick, The code as presented shifts the data out MSB first with the clock idling low. I am unfamiliar with the "SHOut " command. I also am unfamiliar with using the SK9822 led's. I will look for a data sheet and see what the differences are.
-
13th July 2018, 13:34 #10
0Re: Driving SK9822 or APA102 RGB LED's
Rick, I just looked at the data sheet for the SK9822's and it appears they are the same. I would possibly see if there is a way to delay the clocking of the SHOut command as there is for the PBP version of the command "Shiftout".
This valuable resource relies upon the very
small amount of revenue generated by displaying online advertisements
to our visitors.
The advertisements we display are relevant to this web site and your
browsing history
Please consider supporting us by disabling your ad blocker.
Note: Some users have reported issues related to ad-blockers rendering
parts of this wesite unusable,
where possible we will rectify the issues to enable you to use this
resource with adblocking enabled.
If you can, please report issues in the forum area WebSite / Forum Issues
Thank you for your attention.
This valuable resource relies upon the very
small amount of revenue generated by displaying online advertisements
to our visitors.
The advertisements we display are relevant to this web site and your
browsing history
Please consider supporting us by disabling your ad blocker.
Note: Some users have reported issues related to ad-blockers rendering
parts of this wesite unusable,
where possible we will rectify the issues to enable you to use this
resource with adblocking enabled.
If you can, please report issues in the forum area WebSite / Forum Issues
Thank you for your attention.
This valuable resource relies upon the very
small amount of revenue generated by displaying online advertisements
to our visitors.
The advertisements we display are relevant to this web site and your
browsing history
Please consider supporting us by disabling your ad blocker.
Note: Some users have reported issues related to ad-blockers rendering
parts of this wesite unusable,
where possible we will rectify the issues to enable you to use this
resource with adblocking enabled.
If you can, please report issues in the forum area WebSite / Forum Issues
Thank you for your attention.
This valuable resource relies upon the very
small amount of revenue generated by displaying online advertisements
to our visitors.
The advertisements we display are relevant to this web site and your
browsing history
Please consider supporting us by disabling your ad blocker.
Note: Some users have reported issues related to ad-blockers rendering
parts of this wesite unusable,
where possible we will rectify the issues to enable you to use this
resource with adblocking enabled.
If you can, please report issues in the forum area WebSite / Forum Issues
Thank you for your attention.
This valuable resource relies upon the very
small amount of revenue generated by displaying online advertisements
to our visitors.
The advertisements we display are relevant to this web site and your
browsing history
Please consider supporting us by disabling your ad blocker.
Note: Some users have reported issues related to ad-blockers rendering
parts of this wesite unusable,
where possible we will rectify the issues to enable you to use this
resource with adblocking enabled.
If you can, please report issues in the forum area WebSite / Forum Issues
Thank you for your attention.
This valuable resource relies upon the very
small amount of revenue generated by displaying online advertisements
to our visitors.
The advertisements we display are relevant to this web site and your
browsing history
Please consider supporting us by disabling your ad blocker.
Note: Some users have reported issues related to ad-blockers rendering
parts of this wesite unusable,
where possible we will rectify the issues to enable you to use this
resource with adblocking enabled.
If you can, please report issues in the forum area WebSite / Forum Issues
Thank you for your attention.
This valuable resource relies upon the very
small amount of revenue generated by displaying online advertisements
to our visitors.
The advertisements we display are relevant to this web site and your
browsing history
Please consider supporting us by disabling your ad blocker.
Note: Some users have reported issues related to ad-blockers rendering
parts of this wesite unusable,
where possible we will rectify the issues to enable you to use this
resource with adblocking enabled.
If you can, please report issues in the forum area WebSite / Forum Issues
Thank you for your attention.
This valuable resource relies upon the very
small amount of revenue generated by displaying online advertisements
to our visitors.
The advertisements we display are relevant to this web site and your
browsing history
Please consider supporting us by disabling your ad blocker.
Note: Some users have reported issues related to ad-blockers rendering
parts of this wesite unusable,
where possible we will rectify the issues to enable you to use this
resource with adblocking enabled.
If you can, please report issues in the forum area WebSite / Forum Issues
Thank you for your attention.
This valuable resource relies upon the very
small amount of revenue generated by displaying online advertisements
to our visitors.
The advertisements we display are relevant to this web site and your
browsing history
Please consider supporting us by disabling your ad blocker.
Note: Some users have reported issues related to ad-blockers rendering
parts of this wesite unusable,
where possible we will rectify the issues to enable you to use this
resource with adblocking enabled.
If you can, please report issues in the forum area WebSite / Forum Issues
Thank you for your attention.
This valuable resource relies upon the very
small amount of revenue generated by displaying online advertisements
to our visitors.
The advertisements we display are relevant to this web site and your
browsing history
Please consider supporting us by disabling your ad blocker.
Note: Some users have reported issues related to ad-blockers rendering
parts of this wesite unusable,
where possible we will rectify the issues to enable you to use this
resource with adblocking enabled.
If you can, please report issues in the forum area WebSite / Forum Issues
Thank you for your attention.
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Similar Threads
-
DMX512 RGB led controller
By Roshan in forum Proton Plus Compiler v3Replies: 5Last Post: 17th November 2015, 10:49 -
Apa102 led
By StipoGill in forum Projects discussionReplies: 0Last Post: 10th June 2014, 04:07 -
Octobrite RGB Led Display and TLC5947
By ohararp in forum Projects discussionReplies: 0Last Post: 20th December 2010, 15:27 -
RGB led's parallel
By pe1pme in forum The LoungeReplies: 1Last Post: 2nd December 2010, 04:31 -
2 Pin RGB LED
By Darlington in forum The LoungeReplies: 7Last Post: 22nd December 2008, 22:01
Members who have read this thread since 22nd January 2019, 12:26 : 5
Actions : (Set Date) (Clear Date)
You do not have permission to view the list of names.
Proton Compiler Updates
Full install of 8-bit Proton and Proton24 Download the full compiler...
1st January 1970, 01:00