cancel
Showing results for 
Search instead for 
Did you mean: 

Question about SAI data format when using i2s 24bit 16ksps

Younjun
Associate II

Hi,

I'm implementing SAI(I2S format) audio project using STM32H7B3-discovery.

I checked data input and output of CS42L51.

  • Input wave : 100Hz 10mVpp square wave(to CN6 Left pin)0693W00000LzPa0QAF.jpg
  • output wave (from CN5 Left pin)0693W00000LzPaAQAV.jpg

The SAI frame size is 64bit and slot size is 32bit.

SAI and CS42L51 work properly.

But, when i convert input data to integer value, the result was not square wave.

I sent data to desktop using uart. Below picture is result.

0693W00000LzPaoQAF.png

First question.

I think the dma and SAI buffer work as below.

Is it right?

0693W00000LzPfFQAV.png

Second question.

I sent 32bit 16k sample to desktop using uart.

  • 64bit(left 4byte, right 4byte) x 16,000 = 1,024,000bps = 1.024Mbps

I set uart baud rate to 1.5Mbps.

desktop os is windows 10 and i implemeted serial program using pyserial.

Is this baud rate enough?

Last question.​

I convert 24bit data using below code.

0693W00000LzPeRQAV.png 

def byte3_to_integer(value1, value2, value3):
    d1 = value1 & 0x7F
    d2 = value2 & 0xFF
    d3 = value3 & 0xFF
 
    result = (d1 << 16) + (d2 << 8) + d3
    if (value1 & 0x80) == 0x80:
        result -= 0x800000
 
    return result

Is there anything wrong in the process of converting sample?

This is my previous question(link)

Regards,

Youngjun

0 REPLIES 0