- #include "gdma_struct.h"
- typedef struct dma_link {
- struct {
- uint32_t size : 12; //the size of buf, must be able to be divisible by 4
- uint32_t length: 12; //in link,
- uint32_t reversed: 6; //reversed
- uint32_t eof: 1; //if this dma link is the last one, you shoule set this bit 1.
- uint32_t owner: 1; //the owner of buf, bit 1 : DMA, bit 0 : CPU.
- } des;
- uint8_t *buf; //the pointer of buf
- struct dma_link *pnext; //point to the next dma linke, if this link is the last one, set it NULL.
- } dma_link_t;
- dma_link_t dma_trans;
- dma_link_t dma_receive;
- uint8_t transmit[5]="hello";
- uint8_t receive[5]={0};
- void app_main()
- {
- //load outlink
- dma_trans.des.size = 0;
- dma_trans.des.length = 5;
- dma_trans.des.eof = 1;
- dma_trans.des.owner = 1;
- dma_trans.buf = transmit;
- dma_trans.pnext = NULL;
- //load inlink
- dma_receive.des.size = 5;
- dma_receive.des.length = 0;
- dma_receive.des.eof = 1;
- dma_receive.des.owner = 1;
- dma_receive.buf = receive;
- dma_receive.pnext = NULL;
- //reset GDMA's transmit channel
- GDMA.channel[0].out.out_conf0.out_rst = 1;
- GDMA.channel[0].out.out_conf0.out_rst = 0;
- //reset GDMA's receive channel
- GDMA.channel[0].in.in_conf0.in_rst = 1;
- GDMA.channel[0].in.in_conf0.in_rst = 0;
- //address of the transmit descriptor
- GDMA.channel[0].out.out_link.addr = (((uint32_t)&(dma_trans)) & (0xfffff << 0));
- //address of the receive descriptor
- GDMA.channel[0].in.in_link.addr = (((uint32_t)&(dma_receive)) & (0xfffff << 0));
- //enable memory to memory transfer
- GDMA.channel[0].in.in_conf0.mem_trans_en = 1;
- //enable transmit channel
- GDMA.channel[0].out.out_link.start = 1;
- //enable receive channel
- GDMA.channel[0].in.in_link.start = 1;
- }
I need to enable GDMA in esp32c3 but I get descriptor error, did I fill descriptor correctly?
-
- Posts: 2
- Joined: Thu Feb 23, 2023 7:34 pm
I need to enable GDMA in esp32c3 but I get descriptor error, did I fill descriptor correctly?
-
- Posts: 9730
- Joined: Thu Nov 26, 2015 4:08 am
Re: I need to enable GDMA in esp32c3 but I get descriptor error, did I fill descriptor correctly?
Code: Select all
dma_trans.des.size = 0;
-
- Posts: 2
- Joined: Thu Feb 23, 2023 7:34 pm
Re: I need to enable GDMA in esp32c3 but I get descriptor error, did I fill descriptor correctly?
I set dma_trans.des.size but I did't get any response, but I read in technical reference for esp32c3 in system and memory chapter the following:
""when accessing a memory via GDMA, a corresponding access permission is nedded, otherwisethis access may fail""
also:
""All of the internal memories are managed by Permission Control module. An internal memory can only be accessed
when it is allowed by Permission Control, then the internal memory can be available to the CPU""
in the default mode, is access permission enabled for GDMA?
is there another reason for my problem?
""when accessing a memory via GDMA, a corresponding access permission is nedded, otherwisethis access may fail""
also:
""All of the internal memories are managed by Permission Control module. An internal memory can only be accessed
when it is allowed by Permission Control, then the internal memory can be available to the CPU""
in the default mode, is access permission enabled for GDMA?
is there another reason for my problem?
Who is online
Users browsing this forum: FX2032 and 112 guests