SAI 串行音频接口学习

SAI 简介


串行音频接口(SAI),SAI具有灵活性高、配置多样的特点。


SAI 通过两个完全独立的音频子模块来实现这种灵活性与可配置型,
每个音频子模块与多达4个引脚(SD、SCK、FS和MCLK)相连。


如果将两个字模块声明为同步模块,则其中一些引脚可以共用,从而可释放
一些引脚用作通用I/O。


音频子模块既可以作为接收器,又可作为发送器;既可与另一个模块同步,又可以不同步。






FS_A   :通道识别信号,连接I2S的左/右对齐时钟信号(LRC)
SCK_A  :位时钟信号,连接I2S的位时钟信号(BLCK), SCK = FS*slot个数*单个slot大小
SD_A   :数据输入/输出脚,
MCLK_A :主时钟信号,连接I2S的MCLK脚,固定输出频率为256*fs,fs即音频信号采样频率(fs)。


FS_B
SCK_B
SD_B
MCLK_B




SAI slot简介
slot是SAI音频帧中的基本元素,音频帧中slot的数目通过SAI_xSLOTR寄存器配置,每个音频帧
的slot数,最大是16。在I2S模式下,SAI中slot的传输方式


每个slot可以传输一个声道的 音频数据,这样,6个slot就可以传输6个声道的音频数据。一般
音频文件都是立体声,所以只需要2个slot即可,每个半帧一个slot。


STM32的SAI最多可以实现16声道数据传输(16个slot)。


每个slot的大小是可以配置的。

Each audio block in the SAI has its own FIFO


FIFO depth is 8 words


CPU or DMA access to the FIFOs


Data is right-aligned into the FIFO.


FIFO FLUSH bit to reinitialized the FIFO pointers
FIFO FLUSH位用于重新初始化FIFO指针


Each access in read from the FIFO will return a word (32-
bit) equivalent to one data
从FIFO读取的每个访问都会返回一个字(32位字)
位)相当于一个数据


Each write into the DR will correspond to the FIFO to one
data.
每次写入DR都会将FIFO对应一个
数据。


Programmable FIFO threshold to manage data transfert:
– FIFO FULL, ¾ FIFO, ½ FIFO, ¼ FIFO, FIFO EMPTY
可编程FIFO阈值管理数据传输:
- FIFO满,¾FIFO,½FIFO,¼FIFO,FIFO空


The clock generators are used only in MASTER mode.


Slave mode:
FS transitions are automatically monitored in order to detect a wrong
placement of the start of frame by generating either an anticipated or late
frame synchronization detection.
自动监视FS转换以检测错误
通过生成预期或迟到来放置帧的开始
帧同步检测。




The maximum number of slots per audio frame is fixed to 16
Configured through bits “NBSLOT[3:0] in the SAI_xSLOTR register +1”.


Each slot can be defined as an active slot, or not
– By setting bit SLOTEN[15:0] in the SAI_xSLOTR register.


The size of the slots is selected by setting bit SLOTSZ in the
SAI_xSLOTR register
插槽的大小通过设置位SLOTSZ来选择
SAI_xSLOTR寄存器


It is possible to define the data position into the slot (FBOFF)
可以将数据位置定义到插槽(FBOFF)























  • 1
    点赞
  • 28
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值