This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

How can i port this i2s code to the new nrfx i2s api?

https://github.com/takafuminaka/nRF52832/blob/master/i2s_ws2812b_demostration_planB/i2s_ws2812b_drive/i2s_ws2812b_drive.c

I read the documentation, but didn't really grasp how to use nrf_drv_i2s_next_buffers_set() or the approrpriate usage of NRFX_I2S_STATUS_NEXT_BUFFERS_NEEDED

Parents Reply Children
  • I am not too familiar with the i2s bus interface, and I tried to read up on it. However it was quite complex and I did not grasp it fully enough to give you a satisfying answer. However I would recommend you to use some time and really understand stuff from the bottom up. I would approach it in the following manner:

    • Start by reading about the i2s peripheral and understand how it works in and out
    • Take a look at the irq handler (nrfx_i2s_irq_handler(..)) in nrfx_i2s.c
      • This handler will call the data_handler(..) function in main.c (through m_cb.handler) and the data_handler(..) function calls nrf_drv_i2s_next_buffers_set(..)
      • In this function there is a lot of comments, that explains how it works
    • Look at the explanatory text above nrfx_i2s_next_buffers_set() inside nrfx_i2s.h and the explanatory text below the macro NRFX_I2S_STATUS_NEXT_BUFFERS_NEEDED inside nrfx_i2s.h
    • Use a logic analyzer and look at the different signals and compare them to the ones in the i2s peripheral documentation, also you could create a spike using a GPIO whenever nrf_drv_i2s_next_buffers_set() is called and check when this happens

    If you've done all this and are still confused, please inform me about what you understand so far and what you're confused about, and I will put off some time to read up, and see if I can help you progress.

    Best regards,

    Simon

Related