ws2811 clock

Posted on
  • Hello,

    After some trial and error, which even lead to studying the exact timings the controllers wanted and trying send8bit with various bit patterns, I found out that just doubling your suggested clock rate works fine! That is on the kickstarted boards with the supplied led strip. So I use

    SPI1.setup({baud:6400000 , mosi:A7});
    ...
    SPI1.send4bit([0, 0, 255], 0b0001, 0b0011);
    

    The original 3200000 baud rate suggested never works for me!

    Cheers,
    Luca

  • Thanks for this. The tutorial in http://www.espruino.com/Individually+Add­ressable+LEDs does mention that this might be needed, but it is rather hidden away and should be made more clear.

    Have you tried to address other lights from your LED strip? Oddly, it seems like I can set the colour of the first 2 or 3 but once I try and set the while string they all turn white, regardless of the colour I set.

  • Actually, if you experience the same problem of all LEDs being white, I think it might have to do with this (pressing) issue! :
    http://forum.espruino.com/conversations/­490/

  • I was having white leds too, even more so by doing as the tutorial suggests (halving the baud rate); by doubling it I'm able to address all 25 of them, with just an occasional flickering.
    By reading http://bleaklow.com/2012/12/02/driving_t­he_ws2811_at_800khz_with_a_16mhz_avr.htm­l , I suspect the problem may be related to low/high speed mode, which I don't understand if it's related to the chip variant or if it's supposed to auto-sense that, and anyway it's mostly by luck that this setting actually works; If I had a logical analyzer I would be curious to actually see what is coming out of MOSI, I suspect it may work because the STM32 is putting some delay between each byte sent.
    And no, personally I don't have those other array problems you mention.
    Bye,
    Luca

  • Hmm, good to know :). Seems like we will need some more trial and error to get these lights going.

    If you don't have those arrays, could it be that your board is on a version earlier than 1v46? If so, it might be good to tell Gordon that you don't have those issues as it will make it a lot easier for him to track down the bug.

  • This is really odd - you're using the latest version (1v46)?

    But it actually all works fine at 6400000, rather than lighting some LEDs randomly? It's not an issue with the electrical connection is it? (like whether ground is connected to the Espruino board).

    I've tried several different sets of LEDs from the batch I sent out and they all worked at 3200000 - but I'll go and try some more just in case.

  • Hello,
    First thing, I guess email notifications from the forum don't work.. I didn't receive any at least.
    I just upgraded the firmware to 1.48 and now it works at 3200000 baud, and does not at twice that.
    Just being curious: you say the STM32 gets it right to within 50%.. do you mean "randomly" or that it has some fixed baud rates at which it latches?
    Also, could other interfaces be used to the same purpose?
    Cheers!

  • It's not random - it's just that unlike something like the USART, it has a fixed clock divisor that's /2, /4, /8, /16, etc.

    Every Espruino board would be the same, however between different STM32 devices that have different clock speeds (eg, 48Mhz instead of 72Mhz), it could be quite different.

    At the moment it's just SPI MOSI that you can use (there are a few pins that do this) because the SPI hardware is used to get the fast pulses while the software works out what bytes to send. With some extra work on Espruino it'd be possible to send the data in software only (on any pin), but the idea is that eventually the SPI hardware can be sending the data out more or less automatically while Espruino can get on with doing more calculations.

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

ws2811 clock

Posted by Avatar for Loop @Loop

Actions