Zephyr I2S support in NCS 1.8.0, 1.9.1

Hi,

I see that there is Zephyr I2S support in in NCS 1.8.0 (and onward), but I can't locate any reliable documentation for the API.

I have an I2S example (based on https://github.com/andenore/NordicSnippets/blob/master/examples/i2s_master/main.c) that compiles and works in 1.8.0 - but it's clearly not using the zephyr driver.

Even though I've got 'CONFIG_I2S=y' in prj.conf the zephyr.dts entry is

i2s0: i2s@40025000 {
compatible = "nordic,nrf-i2s";
#address-cells = < 0x1 >;
#size-cells = < 0x0 >;
reg = < 0x40025000 0x1000 >;
interrupts = < 0x25 0x1 >;
status = "disabled";
label = "I2S_0";
};

Note that status is 'disabled'

What I want to do is play short (one to two second) messages pre-recorded as 8 bit monaural raw .wav file. I'm comfortable with the file formats and the transitions I need to make to get the .wav data into arrays to present to I2S. 

Initialize I2S, then present relatively small chunks (on the order of 128 samples) to I2S until I've exhausted the .Wav file.

Logically I want to use two 128 byte RAM buffers, loading one with sample data, starting the I2S playback of that buffer while I load the other buffer, then switching to the other buffer when the I2S playback of the first is finished, continuing until I've exhausted the .wav data is exhausted.

Any help you can give me would be appreciated.

Thanks in advance.

Kent Overton

Parents
  • Hi

    KentOverton said:
    I took out logging and made the buffers 256 uint16_t (512 bytes) and saw a huge improvement.

    That is good to hear. Are there still glitches or other audio issues, or do you consider this issue resolved?

    KentOverton said:

    TRIGGER_DRAIN and TRIGGER_STOP only seem to work when the I2S_STATE is RUNNING. If it isn't RUNNING STOP or DRAIN put the device in an error mode from which there seems to be no way to recover.

    I2S_TRIGGER_DROP works.

    This seems to be in line with the documentation

    If you just want to stop transmission immediately then I2S_TRIGGER_DROP is the one to use. 

    I will have to check with the developers if there is some way of recovering from an error other than doing a full chip reset. 

    Best regards
    Torbjørn

Reply
  • Hi

    KentOverton said:
    I took out logging and made the buffers 256 uint16_t (512 bytes) and saw a huge improvement.

    That is good to hear. Are there still glitches or other audio issues, or do you consider this issue resolved?

    KentOverton said:

    TRIGGER_DRAIN and TRIGGER_STOP only seem to work when the I2S_STATE is RUNNING. If it isn't RUNNING STOP or DRAIN put the device in an error mode from which there seems to be no way to recover.

    I2S_TRIGGER_DROP works.

    This seems to be in line with the documentation

    If you just want to stop transmission immediately then I2S_TRIGGER_DROP is the one to use. 

    I will have to check with the developers if there is some way of recovering from an error other than doing a full chip reset. 

    Best regards
    Torbjørn

Children
No Data
Related