mSGDMA: Streaming to MM problem
Hi everyone,
Recently, I want to play with mSGDMA and learn about it so just make up my own project to test and see the behaviour and know how to control the mSGDMA. However, I got stuck and have tried everything I know but still cannot fix it.
HARDWARE:
-HPS with h2f_lw_bridge
-mSGDMA:
- Streaming to Memory Mapped
- Data width: 8
- Data Path FIFO depth: 32
- Descriptor FIFO depth: 32
- Maximum transfer length: 1KB
- Transfer type: Aligned Accesses
- Everything else is disabled
-My customized counter with streaming interface: I made this component just to test the mSGDMA. The counter increase the value every 1 second and output it in streaming interface. It has:
- Data width: 8 bits
- Data bits per symbol: 8 bits
-LED PIO: written by mSGDMA write master with the transfered data and it is supposed to increase every second.
SOFTWARE:
Here is C code:
typedef struct sgdma_descr
{
uint32_t *read_addr;
uint32_t *write_addr;
uint32_t length;
uint32_t control;
}sgdma_descr_t;
int main ()
{
uint32_t status ;
/*bridge configuration*/
alt_bridge_init(ALT_BRIDGE_LWH2F,NULL,NULL);
alt_bridge_init(ALT_BRIDGE_H2F,NULL,NULL);
sgdma_descr_t descr;
sgdma_descr_t *descr_ptr = &descr;
// configure the descriptor for ST to MM transferring
descr->read_addr = NULL;
descr->write_addr = 0; // address of PIO seen by mSGDMA write master
descr->length = 1;
descr->control =(1<<31) ; // no setting, just go for one data transfer
// feed the descriptor to the descriptor slave
alt_write_word(DESCR_RADDR,descr->read_addr);
alt_write_word(DESCR_WADDR,descr->write_addr);
alt_write_word(DESCR_LENGTH,descr->length);
alt_write_word(DESCR_CONTROL,descr->control);
uint32_t status;
while(1)
{
// observe value inside the registers
status = alt_read_word(CSR_STATUS);
printf("Status: %u\n",status);
status = alt_read_word(CSR_CONTROL);
printf("CONTROL: %u\n",status);
status = alt_read_word(CSR_LEVEL);
printf("LEVEL: %u\n",status);
}
return 0;
}It states that the mSGDMA is still busy transfering ( Busy bit is set ) and the descriptor buffer is empty ( Descriptor buffer empty bit is set and the value in Write fill level register is 0 ). However, I see nothing is transferred because the LEDs are not lighted up.
I had tried the same test with regular DMA Controller and it worked fine. But with mSGDMA it does not work with my test.
Hope someone can give me a hint how to fix this. Thanks in advance !
Cheers!