AnsweredAssumed Answered

ad1836 Sport 0 DMA buffer use 24 bit I2S protocol, how to convert to signed int 32 bit

Question asked by willrobot on Mar 22, 2012
Latest reply on Mar 27, 2012 by willrobot

Hi, using as example talk-through example, I've implemented in bare metal ad1836 audio codec control on core b from bf561. I've difficulty to reformat the 24 bit data received in the DMA buffer. it is find if I retransmit it directly to the DMA output codec to the speaker as it use the same format out (I2S)  but if I try to process the data ie: Radix 4 FFT I need to put it back in a known format.



for the moment I've got the closest to the original signal doing this:

             iChannel1RightIn = iRxBuffer1[INTERNAL_ADC_R1];

             left_word = iChannel1RightIn & 80000000;


            in_test[count_DMA] = ((iChannel1RightIn >> 8) & 0x0000FFFF) ;//   | left_word ;                          



Here I try to shift the signed (or what I think is the signed bit) to the 32nd bit but seem to be better without. I couldn't find a proper description of the I2S format on the net, any link welcome.


I try to shift of 8 bit the DMA result as it seem  to be aligned to the left. if I leave 0x00FFFFFF  mask I have less readable result than with 0x0000FFFF as in the code above. don't knowing the I2S format I'm a bit blind there.


As well I tried to change the format in the ad1836 control  register but it seem that using 4 Input / output via only 1 serial port does not leave options for other protocol that I2S.


Any help welcome.