This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Getting started? ws2812?

Other Parts Discussed in Thread: CC3200

Em struggling to get started on programming the Launchpadxl. I've been testing and editing various example projects but now i'm trying to control ws2812 leds, but i cant figure out how to properly do this. I've read that it can be done with a timer and DMA, but that i can't figure out from the examples.

So my question are, are there some guides or lessons to follow on learning to program with this board? And maybe does anyone have a project that i can have which controls these leds?

p.s. i already have programming experience, but not yet on ARM processors and none with the ccs ide.

p.p.s. i found a program for the Tiva, but i cant figure out if i can port it to the cc3200. http://e2e.ti.com/support/microcontrollers/tiva_arm/f/908/t/360959.aspx?pi307171=2

  • Hi Martijn,

    Welcome to the E2E forum.

    The usual way to drive these chips is through SPI, but there are issues with the CC3200 SPI which make this impossible, see this post - http://e2e.ti.com/support/wireless_connectivity/f/968/t/356460.aspx

    So an alternate method is the PWM method which you would have seen in the forum post you linked to. The only issue with this method is that it will take up a lot of memory, which may not be an issue for your situation, read the entire post to find out more information.

    As for guides, there are plenty, a great place to start is the Wiki - http://processors.wiki.ti.com/index.php/CC31xx_%26_CC32xx

    Glenn.

  • Well i've found something that kind of works, but it isn't optimal i guess. I cant get the timing to work properly with this, so some pixels in my string still misbehave. At least i can experiment further now, although if someone has a better option and can help me a little bit with how to implement this that would be super great. I've read somewhere about PWM + DMA to drive these leds, but i'm to inexperienced on this platform to get that to work.

    ps. the code im running now per color bit i just send this out: 

    void LedBit(int Bit){
    	if (Bit == 1)
    	{
    		GPIOPinWrite(g_uiLED3Port,g_ucLED3Pin,0x8);
    		UtilsDelay(3);
    		GPIOPinWrite(g_uiLED3Port,g_ucLED3Pin,0);
    	}
    	else
    	{
    		GPIOPinWrite(g_uiLED3Port,g_ucLED3Pin,0x8);
    		//UtilsDelay(1);
    		GPIOPinWrite(g_uiLED3Port,g_ucLED3Pin,0);
    	}
    }

  • Do you have a Logic Analyser or an Oscilloscope so you can have a look at what exactly you are sending out the pin? 

    I'm not sure the bit banging method you are using will be accurate enough to provide a steady 800Khz output with the correct high and low timings. 

    Other than the untested PWM method, I cannot think of any other way to get this to work with the CC3200. Unfortunately SPI is out of the question due to a gap between words. PWM also has the issue of a 1024byte limit, and requiring 1 byte per bit, this limits the light count significantly...42 lights (1024bytes/8bits/3(rgb) = 42.6)

    Glenn.

  • ive used my other launchpad as a logic analyser, and found these outputs, the low time between 1 bits seems too high. and when i try to send a string of bits, i get some strange high times also.

    First is all 0's, then is all 1's and then is a string to control a few leds.

  • Hi Martijn,
    did you manage to get your WS2812 strips to work ??
    I just applied the Adafruit neopixel library for the CC3200 launchpad. But i used the WS2812b. I control them by bit banging. If you need any help with this i can send you my code.
    Ps.: i am able to display clios with 30 frames/s, so i think this method should be fine for any purposes.
    best ,
    vinc.
  • Martijn Linden said:
    ve used my other launchpad as a logic analyser, and found these outputs, the low time between 1 bits seems too high. and when i try to send a string of bits, i get some strange high times also.

     Hi Martijin, are you still here? I see you used launchpad as logic analyser and client seem SUMP,  please can you tell us where you found client software and if also has some trigger feature? My experiments with finished in a less better performance.

     The problem about WS 2812 was better solved on TIVA so you can simply port solution on CC3200 too.

  • I've had a go at this as a small experiment. I played around with the SPI bus to output the needed waveform for WS2812's. I succeeded doing so with the CC3200. I haven't looked into detail on the SPI waveform though, but all seemed to work fine.

    Here's some code. Based on the SPI demo:

    https://gist.github.com/eflukx/41f576d876734835a8e4

    cheers!

  • info on that analyzer:
    www.fischl.de/.../sllogiclogger_logic_analyser_for_stellaris_launchpad
    hackaday.com/.../turning-the-stellaris-launchpad-into-a-logic-analyzer
    forum.stellarisiti.com/.../418-sllogiclogger-a-simple-logic-analyser-for-the-stellaris-launchpad

    I wish I understood what that software asked for from the launchpad, I was looking into that at some point but other things got in the way. I saw the SUMP commands but I don't know how to feed the data into it (if I have to check the data lines every x seconds, like at the frequency of 1Mhz and then send the data through serial and set the software to know he's receiving data sampled at 1Mhz)
    If you know or find out I would appreciate it, for now I really have to concentrate on other tasks unfortunately.



    Now for the WS2812.
    I made with the TM4C1294XL launchpad a 32 output control by using the DMA and using a GPIO triggering the DMA. With the PWM module generating a wave for triggering the GPIO.
    Now that could be possible with the CC3200 but it consumes a bit too much RAM in how I implemented it (it wasted some RAM for the method to work fast without bothering the CPU too much).
    Here it is for the TM4C1294:
    sites.google.com/.../ws2812-dma-ping-pong-mode

    Now I used another method in both the TM4C1294 and TM4C123 by using the SSI which you can most likely use with the CC3200.
    sites.google.com/.../ws2812b-with-spi

    Another method I did a bit as a challenge was control the WS2812 with a timer in the TM4C123 (similar ARM-M4 to the one in the CC3200 and similar timers too).. This was done by generating a 800Khz PWM signal. The duty would be varied inside a interrupt that was generated on timer timeout. Direct register access was needed for that because I used a method that allowed to use 1 WS2812B bit = 1 bit in the RAM, meaning it would need to check the data in memory and change the duty. Maybe there was a better way, maybe using bools would help but I used uint8_t. While sending data to the WS2812B the MCU could not do anything else.
    Something similar could be made for the CC3200
  • Luis Afonso said:
    I wish I understood what that software asked for from the launchpad, I was looking into that at some point but other things got in the way. I saw the SUMP commands but I don't know how to feed the data into it (if I have to check the data lines every x seconds, like at the frequency of 1Mhz and then send the data through serial and set the software to know he's receiving data sampled at 1Mhz)
    If you know or find out I would appreciate it, for now I really have to concentrate on other tasks unfortunately.

     Hi Luis, Thank a lot for your kind answer, this was on a thread about TIVA 129 series goal to use as LA too. I was not sure if use an FPGA or just uDMA, if you search about Amit got some hint too but no more than porting old software to Tiva 123 progressed.

     Future task:

     USE of uDMA to sample at regular rate.

     Prepare some sort of trigger over sampling buffer, not possible if data stream is sampled by CPU. (129 can use EPI too, this is the case when FPGA can get in huge help)

     If FPGA hosted use parallel SPI to transfer data.

     Use native USB CDC than serial communication

     Enable network client to TIVA129

       ---  Port to CC3200

     CC3200 doesn't have EPI but instead has CAMERA interface can supply that port missing.

     Hardware with some very fast comparator and variable trigger level. (comparator are expensive)

      --- I don't need a very fast sampling but something small and light to sample signal over moving part and CC3200 WIFI is the best target. ---

     Saleae LOGIC and Agilent are better but first require PC connection and second one is heavy.