nRF5 SDK is not maintained anymore
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

Audio via I2S

This relates to playing audio files over i2s.

So far I have managed to replay audio files using the method suggested in the SDK i2s example files - basically sending one block of audio data after another. What bothers me is the "end of file" conditions, at the moment I need to send one extra empty block. The i2s example also doesn't properly consider "end of file"...

Does anyone have an idea how to stop a i2s transaction once all data is output?

Example:

  • assume block (buffer size) is 128 bytes
  • assume audio file is 10000 bytes
  • -> one needs to send 79 blocks

How can I terminate i2s after 78 blocks and 16 bytes?

How can I terminate i2s from within data_handler ()?

Any help / ideas are greatly appreciated

M.

Parents
  • Hi,

     

    Unfortunately, the driver or the hardware does not have any option to change the size of the last DMA transferred chunk.

    If you know the amount of data to transfer, you could setup the block size to accommodate this size.

    In the case of a stream with unknown size, I do not have any other suggestions than to let the frame finish.

     

    Best regards,

    Håkon

     

Reply
  • Hi,

     

    Unfortunately, the driver or the hardware does not have any option to change the size of the last DMA transferred chunk.

    If you know the amount of data to transfer, you could setup the block size to accommodate this size.

    In the case of a stream with unknown size, I do not have any other suggestions than to let the frame finish.

     

    Best regards,

    Håkon

     

Children
No Data
Related