I have observed an anomaly with respect to submitted buffer size for BF707 SPORTs when receiving data via DMA. In short, it appears that I must submit buffers that are one word longer than the data being received. I'm using the CCES driver to control the SPORTs.
We have three AD7768-4 ADCs connected to the BF707 via two SPORTs. Two of the ADCs are daisy chained together and connected to one SPORT. The third is connected to a second SPORT. Each ADC produces four words (16 bytes) of data. So the first SPORT receives 8 words per DMA transfer and the second SPORT receives 4 words per DMA transfer.
When I submit eight word buffers for the first SPORT's DMA transfers and four word buffers for the other SPORT's DMA transfers, the data are garbled. If I submit nine word buffers for the first SPORT's DMA transfers and five word buffers for the other SPORT's DMA transfers, everything works.
Is this normal? If it's not, can you suggest why I might need to give the DMA driver a buffer larger than it needs? The data are received where expected in the larger buffer and the extra word does not appear to be touched (it comes back as zeros).
I have confirmed that the 8 (or 9) word buffers are aligned on a 32 byte boundary and the 4 (or 5) word buffers are aligned on a 16 byte boundary.
Any suggestions you can offer for what might be going on here will be appreciated.
Moving to CrossCore Embedded Studio and Add-ins
Could you please confirm whether this is the issue with the Audio code or with all the code (Eg: Simple Loop back). We have tried with simple loop back application which is available in the ADSP-BF707 BSP. But we are not facing the issue you have mentioned.
Could you please refer the SPORT Loop back application from BSP.
The problem turned out to be the nWindowSize parameter to adi_sport_ConfigMC(). The API documentation doesn't mention that this parameter should be one less than the actual window size. I was setting it to 8 for eight word transfers and 4 for four word transfers. When I changed the values to 7 and 3, respectively, the problem was resolved.