STM32F429 and pcm1808 some I2s question
Hello. Please help me.
I want to use pcm1808 ADC in 24bit mode. pcm1808 have a two channels, left and right. I'm generate some code in CubeMX and send recv data to pcm5102 DAC. The sound is transmitted to both channels. But I need to take only the left channel from the ADC .
Now i take 16bit RX_buffer[4] buffer from recieve and bring it to 16bit TX_buffer[4] transmit buffer, when HAL_I2S_RxCpltCallback occurce.
DMA is in circular mode. after init periph i'm start dma
HAL_I2S_Receive_DMA(&hi2s3, RX_buffer, 4);
HAL_I2S_Transmit_DMA(&hi2s2, TX_buffer, 4);
But i dont understand how can i take from ADC 24bit data from left channel and 24bit from right channel. Im tried to do
uint_32 Left_channel_Data = (RX_buffer[0]<<16) | RX_buffer[1]; in HAL_I2S_RxHalfCpltCallback and
uint_32 Right_channel_Data = (RX_buffer[2]<<16) | RX_buffer[3]; in HAL_I2S_RxCpltCallback
But data is wrong.
My task is to transmit data over the network by UDP from one device to another. in First device i would like to use two different audio signals from ADC and then play it in a second one. UDP data transfer, work fine. Thank you and sorry for my English!