使用sdma接收sai多通道数据到多个buff中
Receive sai multichannel data into multiple buffs using sdma
在使用sai及sdma接收数据的时候,如果使用multififo等机制,接收到的数据会在一个buff中,能不能使用sdma的多通道功能,使接收到的数据按照通道分散到各执的buff中?
When using sai and sdma to receive data, if you use such as multififo, the received data will be in a buff, can you use the multi-channel function of sdma so that the received data is dispersed according to the channel in the buff of each execution?
以上图为例子,第一组4字节为第一个通道,连续的第二组4字节为第二个通道,总共4个通道,实际使用的时候需要对某一个通道的数据进行拷贝,拷贝出一个完整通道的数据
The above figure as an example, the first group of 4 bytes for the first channel, the second consecutive group of 4 bytes for the second channel, a total of 4 channels, the actual use of the time you need to copy the data of a channel, copy out a complete channel data
我尝试使用如下代码,但是回调函数总是不能被调用
I tried to use the following code, but the callback function always fails to be called
这种方案有没有问题,能不能实现,如果要实现需要关注哪些呢?
Are there any problems with this option, can it be achieved, and what needs to be focused on if it is to be achieved?
已解决! 转到解答。
Hi @tongt
你的这个想法已经在SDK里集成了,但是用法不对。smda script里有针对SAI multi-fifo的脚本,详细参数请看手册的 A.3.2.8 mcu_2_sai
SDK里的SAI_TransferSendSDMA API也支持script里的这个功能,如果配置的通道数大于1,SAI_TransferSendSDMA 里会使用milti-fifo这个功能读取数据,然后返回第一个buffer,对于其余的buffer,是在这个buffer基础上+offset(默认是4U)。callback应该是一个就行,然后指定通道的时候用或逻辑试试。然后设置saiConfig里的channelNums和channelMask