Reading WS2812b leftover data through I2S

Hello there,

I am currently trying to read the leftover WS2812b LED strip data which was sent using a single channel I2S. The data sent from the board (through I2S) looks like this:

with around 34 mV for high and around 2~6 mV on low. I decided not to send FFF, but 888 instead.

I am aiming to calculate the length of the LED strip. Each LED chip will read the first 24 bits of the data, cascade (discard) it, then pass it to the next one. Therefore, the strategy is to get the data after being cascaded by the last chip and calculate the length of it (which later will be divided by 24 to see how many are left).

The question is: How will I be able to read those data? I tried reading as usual (set a buffer for the i2s, start it, listen for it (delay), stop it, then check its buffer), but I got my buffer filled with all FFF instead. and a thing is that... when I tried to read anything from the pin, although I am not sending any data (the LED strip is not powered on, but connected to other's ground), there will be data, which should not happen. I assigned pin 22, 23, 24, 25 to be the i2s input pin (which will be assigned and unassigned when used or unused), and they are configured as follows:


Thank you in advance.

Parents Reply
  • Okay, here is the full source code:

    Note on the code:

    1. I use UART for some communication and controls. I use PuTTY, but I believe other apps will work. The configuration is set like other examples:
    - Speed: 115200
    - Data bits: 8
    - Stop bits: 1
    - Parity: None
    - Flow control: XON / XOFF
    Commands available through serials:
    - Press the number "1", "2", "3" (normal keys and keypad) and followed by [ENTER] or [SPACE] to send data to turn on the LED to some color. 1 = sapphire? 2 = lime? 3 = magenta?
    - "4" will call the count_get() function. This function is connected to a TIMER. I'd like to use this TIMER to capture the duration. (Spoiler: I'll have some questions about this later).

    2. The definition "MAX_LED" defines the number of LEDs connected. I connected 1 and would like to have 1 extra data for the analysis, so I wrote 2. If you got a strip of N LEDs, please change it to N+L to receive L data on the output of last LED bit.

    And here's the latest plot I captured, when I was typing this:

    No extra external hardware needed. Only a logic converter and the WS2812B. I am currently using only 1 DK

    (I hope I did not miss any other description)