Unable to interface ES8388 with nrf5340DK.

HI, Developers.

  i am trying to interface ES8388 codec with nrf5340DK. but unfortunately i can't understand how to interface with this board. The ES8388 is successfully interface with i2c protocol and i able to read and write register. but in case of i2s i can't understand why it is not working, here IRQ- EVENT is worked !.  

Here i Already tried 1] SAMPLE/DRIVER/I2S/ECHO example, 2] NCS_I2S_nrfx_driver example,  3] the test example I2S-speed and I2S-api test. 4] LOOPBACK .

  1. now in ECHO example i got this error : 

[00:00:01.960,235] <err> i2s_nrfx: Failed to allocate next RX buffer: -12
Failed to read data: -11

 here is project file :  echo_ESP.zip

       2. Now in NCS_I2S_nrfx_driver by siguhe example :  i got print sound is " 0,0,0,0,0,0,0,0,0"  and also i find the in 

data_handler() function p_rx_buffer is null.  

 


>>> one more thing in this project is suggested its configure as Non-Secure peripherals. so they edited nrf/subsys/spm/Kconfig, inside the menu  "Configure Non-Secure peripherals": 

and  nrf/subsys/spm/spm.c: 

  but this file is no longer available in current NCS version.

    3.  Now in i2s test api  example : i got this errors: 

 4] . now in loopback example : i got 

 

 here the received sample right /left  data is always got ffff/ffff  and mismatch with send data !. 

 here is the project file : loopback.zip 

 

Finally I am a current beginner in this embedded system. So I apologize if I have made many mistakes in this project. 

if i make mistake in interfacing peripheral or i misunderstand processes of interfacing peripheral. so please right processes of interfacing unknown peripheral.
and also give me a tutorial or reference of it So that I can correct my mistakes well.

Thank you.

Parents Reply Children
  • i already did it. i am able to start-up es8388 in project.  but i can't  able to interface or read mic data and  transmit  data over i2s. 

    As mentioned above I am in trouble.




  • one more thing in this project is suggested its configure as Non-Secure peripherals. so they edited nrf/subsys/spm/Kconfig, inside the menu  "Configure Non-Secure peripherals": 

    Where did you find these old projects? Can you link to the DevZone case or similar where they are from? Regardless though, the SPM has been deprecated for quite some time now so these projects must be old, so you will have quite a few API changes you need to take into account. I would also recommend that you do not make a non-secure build for now. While that may be sensible in many applications, I would not add another layer of complexity at this moment.

  • okay understand.  but whats about sample I2S-ECHO ?. and  loopback example ? 

  • The I2S echo sample should work out of the box on the nRF5340 DK with NCS 2.4.2 with WM8731, but I do not have an I2S device so I have not been able to do it myself. If it does not for you, can you explain which NCS version  you are using, how you are testing (including physical setup) and which changes to the sample did you do for your test setup (includign using ES8388)?

    Regarding loopback, it seems you have something based on zephyr/samples/drivers/audio/dmic/? That should also work on the DK out of the box and does so on my desk. Have you tested that?

  • Currently i am using ncs 2.4.0.  And i connected ES8388  to nrf5340:

    I2C connection :  nrf pin no. 25,26 respectively as DATA pin and CLK pin with codec. 

    I2S connection :  nrf pin no. 15,12,13,14,16 respectively as SCK , LRCK , DOUT, DIN and MCK with codec.

    > The power pin AVDD and DVDD with NRF pin VDD( 2.9 v). but i also tried with external power supply.

    > GND common with GND.

    > The mic is SPW 2438 and its DC(data pin of mic ) pin attached with MIC pin in codec. The Vin and         GND respectively with nrf VDD and GND pin.


    As per ECHO sample i replace library of WM8731  with ES8388.  i already attached in project file. 

    > the I2C address of codec is 0x10 so i replace in overlay file. 

    > The yaml file is remain same and node label remain same.

    > Now I2C is working perfectly and i am able to read and write register of codec.


    Here Codec has 4 mode;

    1] only ADC, 2] only DAC, 3] ADC and DAC both , 4] LIN-IN (bypass mode) .

    > The bypass mode is working perfectly. when i set ES8388 as LININ mode. 

       

    >> But in case of I2S  need to set  "DAC and  ADC  both " . now the register of codec is write perfectly as data sheet of code. 

    >>  The format  codec is I2S normal.

    >>  data length or sample width is 16 bit . 

    >> sample frequency is 8000.

    Now whole code is already i attached above as echo_esp.zip 

    > The code is compile with no any error. 

    >> terminal is : 

    ERROR : Streams started , Failed to read data: -5


    NOW IN LOOP-BACK  EXAMPLE : 

    It is based on nrfx driver , here i am trying  transmitting some data and  receive that data after comparing both and check its same or not: the whole code is below:

    And the physical connection remain same:  also whole project file attached as loopback.zip.

    The  terminal screenshot: 

      

    the board is continuously booting :: 

    ERROR: 

    ASSERTION FAIL [p_initial_buffers->p_rx_buffer != ((void *)0) || p_initial_buffers->p_tx_buffer != ((void *)0)] @ WEST_TOPDIR/modules/hal/nor1
    [00:00:00.260,253] <err> os: r0/a1: 0x00000004 r1/a2: 0x00000119 r2/a3: 0x00000020
    [00:00:00.260,284] <err> os: r3/a4: 0x20000218 r12/ip: 0x200036d0 r14/lr: 0x000074e7
    [00:00:00.260,284] <err> os: xpsr: 0x69000000
    [00:00:00.260,314] <err> os: Faulting instruction address (r15/pc): 0x0000ae58
    [00:00:00.260,345] <err> os: >>> ZEPHYR FATAL ERROR 4: Kernel panic on CPU 0
    [00:00:00.260,406] <err> os: Current thread: 0x20000788 (unknown)

    >> And if you have any code of working or test code or example ES8388 with nrf board, then share with me. 

    Regarding loopback, it seems you have something based on zephyr/samples/drivers/audio/dmic/? That should also work on the DK out of the box and does so on my desk. Have you tested that?

    yeah i will tested dimic its working but in case of codec its work on analog mic. and i am trying fully functional codec. DMIC  is not need in my case. 

    the line  out of the box and on your desk what does that mean ?