I2S bidirectional communication in SLN-LOCAL2-IOT

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

I2S bidirectional communication in SLN-LOCAL2-IOT

2,079 Views
jnj
Contributor III

Hi all,

I need to configure SAI2 as the bidirectional audio communication interface in SLN-LOCAL2-IOT EVK.SAI3 is already connected to audio amplifier.So I need to connect a host processor to NXP for bidirectional audio communication via SAI2.What all changes should be done in the SLN-LOCAL2-IOT SDK?

0 Kudos
Reply
11 Replies

2,063 Views
igorpadykov
NXP Employee
NXP Employee

Hi SHEENA

 

one can look at   ..sln_local2_iot/ble_cypress_examples/wiced_ble_4343W/board.c example

included in SDK_2_8_0_SLN-LOCAL2-IOT available on  https://mcuxpresso.nxp.com/en/welcome

 

Best regards
igor

0 Kudos
Reply

2,053 Views
jnj
Contributor III

Hi @igorpadykov ,

Thanks for the response.I have one more doubt.How can we record an audio file in the evk and dump the same to a USB connected PC?In our use case we are connecting a host processor to SAI3 of EVK.Need to validate bidirectional communication between host processor and evk.We could verify the audio communication to host processor from evk by making host as master and evk as slave. Need to verify the opposite path and duplex communication.For this host will send an audio file and that should be either playback to host processor or should be stored as a file and should be able to dump to a connected pc. Is there any possibility to check the same in our current SDK?what all changes should I make in the sdk to implement the same? Please help on this.

Thanks in advance

0 Kudos
Reply

2,043 Views
jnj
Contributor III

Hi @igorpadykov ,

Could you please update on this?

0 Kudos
Reply

2,034 Views
igorpadykov
NXP Employee
NXP Employee

>..Need to verify the opposite path and duplex communication..

 

one can look at sai examples for other boards, for example SDK_EVKB-MIMXRT1050

../sai/sai_interrupt_record_playback.c

 

Best regards
igor

 

 

0 Kudos
Reply

2,010 Views
jnj
Contributor III

Hi @igorpadykov ,

Thanks for the response.I tried to get the data reaching on the SLN-LOCAL2-IOT SAI3 by checking the contents of sSaiRxBuffer.data in the function SLN_AMP_RxCallback() .If Host processor(master) sends "0xAAAA" pattern at 16bit and 48KHz to NXP(slave) ,it is receiving  as 0X55555.If host processor sends 0x5555 NXP receives it as 0xAAA.And it seems like one bit is shifted to right .What would be the reason for this?Could you please help on this?

0 Kudos
Reply

2,003 Views
igorpadykov
NXP Employee
NXP Employee

one can run sai examples on SDK_EVKB-MIMXRT1050

../sai/sai_interrupt_record_playback.c

SLN-LOCAL2-IOT has the same sai, then port it to SLN-LOCAL2-IOT.

 

Best regards
igor

0 Kudos
Reply

1,997 Views
jnj
Contributor III

Hi @igorpadykov ,

Thank you for the information.I will check with SDK which is mentioned above.But I would like to know the reason behind the issue.I tried to get the data from the buffer which is given in  the receiver callback function defined in the SLN-LOCAL2-IOT SDK.But not getting the correct data.Could you please help on this?

Tags (1)
0 Kudos
Reply

1,993 Views
igorpadykov
NXP Employee
NXP Employee

may be suggested to debug it using J-Link as the debugger, it is described in SDK documentation.

 

Best regards
igor

0 Kudos
Reply

1,944 Views
jnj
Contributor III

Hi @igorpadykov ,

I referred SDK of IMXRT1060 and replaced SAI_RxSetFrameSyncConfig() with the following function 

 

void SAI_RxSetFrameSyncConfig(I2S_Type *base, sai_master_slave_t masterSlave, sai_frame_sync_t *config)
{
assert(config != NULL);
assert((config->frameSyncWidth - 1UL) <= (I2S_RCR4_SYWD_MASK >> I2S_RCR4_SYWD_SHIFT));

uint32_t rcr4 = base->RCR4;

rcr4 &= ~(I2S_RCR4_FSE_MASK | I2S_RCR4_FSP_MASK | I2S_RCR4_FSD_MASK | I2S_RCR4_SYWD_MASK);

#if defined(FSL_FEATURE_SAI_HAS_FRAME_SYNC_ON_DEMAND) && FSL_FEATURE_SAI_HAS_FRAME_SYNC_ON_DEMAND
rcr4 &= ~I2S_RCR4_ONDEM_MASK;
rcr4 |= I2S_RCR4_ONDEM(config->frameSyncGenerateOnDemand);
#endif

rcr4 |=
I2S_RCR4_FSE(config->frameSyncEarly) | I2S_RCR4_FSP(config->frameSyncPolarity) |
I2S_RCR4_FSD(((masterSlave == kSAI_Master) || (masterSlave == kSAI_Bclk_Slave_FrameSync_Master)) ? 1UL : 0U) |
I2S_RCR4_SYWD(config->frameSyncWidth - 1UL);

base->RCR4 = rcr4;
}

 

After this I am getting correct data at NXP and validated it by USB Console prints.Then I tried playback the same data back to host processor .But while recording data at host processor I am getting only one channel data(left channel).right channel data is missing .Do we need to change anything in the sln-local2-iot to get stereo data over SAI3?Please help me.I am stuck with this.

Thanks in advance

0 Kudos
Reply

1,938 Views
igorpadykov
NXP Employee
NXP Employee

there is dedicated iMXRT processors forum, suggest to post there :

https://community.nxp.com/t5/i-MX-RT/bd-p/imxrt

 

Best regards
igor

0 Kudos
Reply

1,937 Views
jnj
Contributor III

Hi @igorpadykov ,

Thanks for the response .I will post in the imxRT forum.

0 Kudos
Reply