Auto DMA is used, any idea? Thanks.
As a first step,
Can you make the macro CY_FX_DMA_TX_SIZE as 0 and send 12 bytes?
I have did the same and observed that the watermark flag is driven low. Please confirm this.
Regarding when the watermark flag is asserted:
If you set watermark value to 3, then you are aware that after the watermark flag is asserted, 2 '16 bit words' (which is 4 bytes) can be read out from the current buffer. That means that if you send 12 bytes, the watermark flag should be asserted after sending out 8 bytes.
The initial value of watermark in GPIF II is configured to high with active low trigger. After I set the macro
Could you figure out my problem? Thanks.
I have conducted 3 tests by modifying the value of CY_FX_DMA_TX_SIZE in slave side. It's quite weird to get 3 different results.
1. #define CY_FX_DMA_TX_SIZE (0) /* DMA transfer size is set to infinite */
According to the comment, it's infinite buffer size. Master sends 2048 bytes to slave.
It seems DMA_ready and DMA_watermark control signal correctly. After zooming in, I can observe that DMA_watermark is pulled high before DMA_ready, SLWR and SLCS. That's what I want.
2. #define CY_FX_DMA_TX_SIZE (1024)
Master also sends 2048 bytes to slave but buffer size of slave is reduced to 1024. I can observe that DMA_ready and DMA_watermark are no longer to pull up after receiving first batch of data.
3. #define CY_FX_DMA_TX_SIZE (8)
Master sends 12 bytes to slave but the buffer size of slave is reduced to 8. DMA_ready and DMA_watermark are changed nothing.
Is it a bug of FX3?
By changing CY_FX_DMA_TX_SIZE, you are not changing the buffer size of the Slave device. Instead what happens when you set CY_FX_DMA_TX_SIZE to 8 is that DMA channel goes to idle state after 8 bytes are transmitted.
If you want to change the buffer size, you need to change the dmaCfg.size parameter.
And please note that the buffer size of the DMA channel should be a multiple of 16 bytes.