Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

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:

nrf_gpio_cfg_sense_input(DIN1_PIN, NRF_GPIO_PIN_PULLDOWN, NRF_GPIO_PIN_SENSE_HIGH);

Thank you in advance.

Parents Reply Children
  • Is the pin floating? If so, then you cannot really measure it. Can you try to connect it to ground / VSS/ 0 V and see if you still get the unexpected interrupts?

  • Hello,

    No, the pin is not floating. It is connected to the last WS2812B (after being converted to a lower voltage).

    Here are the screenshot of how my logic analyzer and oscilloscope say about the signal:

    Logic Analyzer:

    Oscilloscope:

    The green lines are the signal coming from the last LED; and the yellow lines are the output from the COMP handler.

    On the oscilloscope, the amount of voltage on the green line (which may lead to the false trigger) are 214.84mV, 58.59mV, 136.72mV, and 58.59mV. whereas the rest, low voltages such as 19mV does not trigger the handler (which is expected)

  • Hi, I see. Have you attempted to find the source of the noise? Do you still see it if you disconnect the WS2812b data out from the nRF GPIO (COMP) input and measure on the WS2812b data pin? If yes, then the COMP behaves as it should, but there is noise form WS2812b for some reason. Depending on the noise, perhaps you can low pass filter it (for instance using a simple RC-filter).

  • Hi,

    There are 3 cases I have observed:

    1. If I disconnect (or connect it but did not power the WS2812b), then the COMP handler will be triggered all the time. Seems like 566.41 mV triggers the handler. (It's not accepted, right?) Shorting it to Ground makes it zero, handler not called.

    2. If I power the WS2812b on, without sending any data, then the handler will not be called. The voltage is around 0.0 mV, which is accepted.

    3. As soon as I send a data (I asked it to turn 11 lights on (extra 1)), the activity from above happens.

    I connected my oscilloscope's probe to the end of WS2812B Data out and figured out that there are some sudden (unwanted?) spikes coming out from it. I think this what somehow triggers the handler (the voltage there is 214.84 mV max though).

    I will try to low pass filter it.

    Aside, why does the noises triggers the COMP's handler? They are set to trigger at 1.1 V and 1.3 V, not 566.41 mV. Is there any special calculation for setting the trigger?

  • Hi,

    1. In this case the GPIO input on the nRF is floating (doesn't have any properly defined voltage), so anything could happen. That is expected. You should never have floating input pins. The 566.41 mV you measure cannot be trusted, since the pin is floating. You will probably get very different measurements depending on what instrument you use to measure.

    2. OK, that is also expected.

    3. This is caused by noise from the WS2812b, which you have to handle in some way. The most obvious fix is to low pass filter the data signal.

Related