Tool/software:
Hi champs,
In TRM section 37.3.8.1, the example of Transmitting Data Using SPI with DMA, to transfer 128 words to SPI using the DMA as below,
- NUM_WORDS: 128
- TXFFIL: 8
- DMA_TRANSFER_SIZE: (NUM_WORDS /TXFFIL) – 1 = (128/8) – 1 = 15 (16 transfers)
- DMA_BURST_SIZE: (16 – TXFFIL) – 1 = (16 – 8) – 1 = 7 (8 words per burst)
The result above is correct. However, this calculation seems cannot be used when TXFFIL is less than 8. For example, when we want to transfer 20 words and decide the TXFFIL is 5, then we get below results by using this calculation,
- DMA_TRANSFER_SIZE: (NUM_WORDS /TXFFIL) – 1 = (20/5) – 1 = 3 (4 transfers)
- DMA_BURST_SIZE: (16 – TXFFIL) – 1 = (16 – 5) – 1 = 10 (11 words per burst)
The result is incorrect and it can be corrected by using DMA_BURST_SIZE = TXFFIL - 1 = 4 (5 words per burst). Is this correct or I misunderstand somethings?
Another question is that the SPITXINT is generated when TXFFST is less than or equal to TXFFIL, but the SPITXDMA activates when TXFFST is less than TXFFIL. Is this correct and means that the SPI TX interrupt and SPITXDMA are issued at different conditions? And, the SPI RX interrupt and SPIRXDMA occurs at same condition, when RXFFST is greater than or equal to RXFFIL?
Please advise, thanks for your help.
Regards,
Luke