• AVR Freaks

Hot!CLC Module Question

Author
Designer
Super Member
  • Total Posts : 432
  • Reward points : 0
  • Joined: 2007/11/20 20:28:41
  • Location: 0
  • Status: offline
2019/07/21 21:28:08 (permalink)
0

CLC Module Question

I'm going to use a CLC module to interface a WS2811 LED driver as in the application note AN1606.
It says "Loading SSP1BUF register sends that data byte out the RC4/CLC4 pin"
 
My question is while the CLC module transmit the data out can I have some time to load next byte colour?
Because to select next LED colour I need to index to a long Table read & store next 24bits in the RAM.
 
I mean like this
 
;Normal procedure looks likes this
Send_8it
     movwf SSP1BUF
     btfss PIR1,SSPIF
     goto $-1
     bcf PIR1,SSPIF
     return
     
;I'm going to do this...!!!
Send_8it
     movwf SSP1BUF
     ;
     ;in this time
     ;I'll index next
     ;Colour from a
     ;Table read &
     ;store them in
     ;3 bytes
     ;will it be
     ;possible?
     ;This process I need 3-4 uS
     ;
     btfss PIR1,SSPIF
     goto $-1
     bcf PIR1,SSPIF
     return

#1

6 Replies Related Threads

    mpgmike
    Super Member
    • Total Posts : 284
    • Reward points : 0
    • Joined: 2014/01/23 17:27:06
    • Location: NJ
    • Status: online
    Re: CLC Module Question 2019/07/22 04:02:23 (permalink)
    0
    What uC?  There should be an interrupt when a transfer is complete.  Load it, send it enable the IE, get the next packet ready, when you get the SSPIF, load it again.

    I don't need the world to know my name, but I want to live a life so all my great-grandchildren proudly remember me.
    #2
    Designer
    Super Member
    • Total Posts : 432
    • Reward points : 0
    • Joined: 2007/11/20 20:28:41
    • Location: 0
    • Status: offline
    Re: CLC Module Question 2019/07/22 04:11:04 (permalink)
    0
    Going to use PIC16F1509.
    #3
    mpgmike
    Super Member
    • Total Posts : 284
    • Reward points : 0
    • Joined: 2014/01/23 17:27:06
    • Location: NJ
    • Status: online
    Re: CLC Module Question 2019/07/22 04:48:06 (permalink)
    0
    It appears you're missing a few steps.
     
    Firstly, what is in W when you MOVWF SSP1BUF in your first line?  Are you just sending junk to initiate a Receive?
     
    Secondly, try monitoring SSP1STAT, 0 ;(BF bit) with "BTFSC" then your GOTO $-1.
     
    Thirdly, you aren't actually reading the Buffer.  What are you trying to accomplish?!?
     
    Fourth, how is CLC supposed to send out data when you're using MSSP/SPI?
     
    Fifth, ...can you tell us more of what else you're doing, what you expect, what you're getting, checks you've made -- more to work with?

    I don't need the world to know my name, but I want to live a life so all my great-grandchildren proudly remember me.
    #4
    cvm
    Super Member
    • Total Posts : 293
    • Reward points : 0
    • Joined: 2011/09/16 05:16:15
    • Location: 0
    • Status: offline
    Re: CLC Module Question 2019/07/22 05:45:57 (permalink)
    0
    >My question is while the CLC module transmit the data out can I have some time to load next byte colour?
     
    The spi is doing the work of sending bits, the clc and pwm are helpers to 'shape' the spi output into the required protocol.
     
    It takes 2.5us per bit, so you have 20us before the spi will be ready for the next byte. You can do what you want in that 20us, and if what you want only takes 4us you still have plenty of time before the spi is ready for the next byte.
     
    As mpgmike says, another good way would be to use the spi irq, along with a buffer you create, where the spi isr simply loads the next byte from your buffer, and you just keep the buffer filled. But in the end, unless you have other things to do that can take longer than 20us it probably makes little difference as you will be waiting around in either case. 
    #5
    NorthGuy
    Super Member
    • Total Posts : 5672
    • Reward points : 0
    • Joined: 2014/02/23 14:23:23
    • Location: Northern Canada
    • Status: offline
    Re: CLC Module Question 2019/07/22 05:52:03 (permalink)
    0
    It depends on the speed of your SPI clock, which in turn depends on what speed WS2811 needs. I don't remember the exact numbers. If one bit to WS2811 takes 2 us, then you need to send one SPI byte every 2us*8 = 16us.
     
    Thus, you definitely have 3-4us. Moreover, if you're late (within reason) it'll still work.
    #6
    Designer
    Super Member
    • Total Posts : 432
    • Reward points : 0
    • Joined: 2007/11/20 20:28:41
    • Location: 0
    • Status: offline
    Re: CLC Module Question 2019/07/22 20:32:54 (permalink)
    0
    Hi, Thank you everybody for the info.
     
    I'm going to use High speed mode to LEDs that is 1.25uS per bit.So that means after loading to the SSP1BUF, I have 1.25uS X 8 = 10uS time to setup colour to next Led. That's very nice & that is what I want.
     
    But in real life those LEDs can accept blank time only 4-5uS between LED data else it will accept as garbage.
     
    Yes my SSP1BUF routine is wrong,I'll make it correct.
    post edited by Designer - 2019/07/22 20:39:55
    #7
    Jump to:
    © 2019 APG vNext Commercial Version 4.5