K22F - I2S - SDK v2 - receiving problem

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

K22F - I2S - SDK v2 - receiving problem

668 Views
jasperverschuer
Contributor I


Hi,

 

Since last week I'm trying to setup a I2S connection between the FRDM-K22F devel board and the SGTL5000 eval kit.

I'm new to this community and to KDS.

 

I have succeeded in sending data from the K22 to the codec but receiving is not working.

I'm using the functions of the SDK v2 but the documentation is very poor and I can't find topics in the community about it.

I'm using the interrupt mode and would like to update to the DMA mode when I get it working. The K22F is in slave mode while the SGTL5000 is the master.

 

Does anyone have DEMO code for this?

 

 

When I run my code (attached) I get FIFO errors but I don't now what to do with them.

Is the buffer that I declared used as FIFO?

Is it declared some where else?

Do I have to declare some FIFO sizes?

...

 

 

Thanks in advance!

 

Jasper

Original Attachment has been moved to: main.c.zip

Original Attachment has been moved to: my_SAI.c.zip

Original Attachment has been moved to: my_SAI.h.zip

Labels (1)
0 Kudos
3 Replies

372 Views
Jmart
NXP Employee
NXP Employee

Jasper,

When you say read from the SGTL5000, are you referring to reading the SGTL5000 registers? You shouldn't have to place the K22 into I2C slave (I don't believe the SGTL can be an I2C master?), you should just issue an I2C read to the registers you want data from.

Jason

0 Kudos

372 Views
jasperverschuer
Contributor I

Jason,

I was asking about the I2S (inter IC sound) bus not the I2C bus.

I think it would be logic to set the audio codec as master.

I have come a little bit closer to a solution but the interrupts are not coming as they should.

I have set the watermark level to 6 (max fifo size is 8) but I never get a FIFO request interrupt, so I can't read the registers because I don't no when to read them.

Jasper

0 Kudos

372 Views
isaacavila
NXP Employee
NXP Employee

Hello Jasper,

There is an example for TWR-K64F120M board (SDK_2.0_MK64FN1M0xxx12 package) that uses TWR-SGTL5000. In this example, fsl_sai_edma driver is used.

In this example, SAI is configured as Master (SGTL5000 as slave) and audio data is sent to codec by using DMA channel 0.

SAI module is configured in Master mode, Asynchronous mode and Left justified format (default configuration) meanwhile audio is configure to use 16-bit format and sampling frequency is 16kHz.

I am attaching sai.c source file and sai_edma drivers for your reference! (For full reference, please consult SAI demo for TWR-K64F120M board that is located at: <SDK_2.0_MK64FN1M0xxx12_PATH>\boards\twrk64f120m\demo_apps\sai)

Hope this helps!

regards,

Isaac

0 Kudos