when i use eDMA ,I always found the source bus error in bit SBE of DMA_ES register.
My chip is K22FX512VLL12.
I define a array like this:uint32_t wdata1[4]={0x12345678,0x87654321,0x12345678,0x87654321};
Then DMA0->TCD[0].SADDR = (uint32_t)wdata1;
Another case happens again.
I define RAM_ADDRESS=0x20000000;
Then Then DMA0->TCD[0].SADDR =RAM_ADDRESS;
The same source bus error occurs.
I confused heavily.
Anything wrong? Help me with this problem,please.
Hi, Wu,
After the error, pls check the DMA_ES register to know the error source.
Hope it can give you a clue.
BR
Xiangjun Rong
Hi
I think that you need to show the complete configuration since the source address initial setup is OK. Probably the error is due to a different setup configuration.
Regards
Mark
void K64_DMA_init(void)
{
SIM->SCGC6 |= SIM_SCGC6_DMAMUX_MASK;// enable clock gate to the DMA Mux module
SIM->SCGC7 |= SIM_SCGC7_DMA_MASK;// enable clock gate to the DMA module
/*Enable DMA MUX ch 0*/
DMAMUX->CHCFG[0] |= DMAMUX_CHCFG_ENBL_MASK;
DMAMUX->CHCFG[0] |=DMAMUX_CHCFG_SOURCE(63);
/*Start the sequence*/
DMA0->ERQ |= DMA_ERQ_ERQ0_MASK;
/*** Initialize CH0, MRAM -> FlexBus, transfer 16 bytes ***/
/* Set the Source Address*/
DMA0->TCD[0].SADDR = (uint32_t)wdata1;
/* Destination address */
DMA0->TCD[0].DADDR = (uint32_t)(FB_ADDRESS);
/* Source offset*/
DMA0->TCD[0].SOFF = 0x10; // 16 byte
/*Modulo off and port sizes*/
DMA0->TCD[0].ATTR = DMA_ATTR_SSIZE(4) | DMA_ATTR_SMOD(0) | DMA_ATTR_DSIZE(4) | DMA_ATTR_DMOD(0); //16-byte burst
//DMA_TCD0_ATTR = DMA_ATTR_SSIZE(2) | DMA_ATTR_DSIZE(2); //source and destination size 2 = 32 bits
/* Transfer size */
DMA0->TCD[0].NBYTES_MLNO = 16; //16 bytes
/* No adjustment to source address */
DMA0->TCD[0].SLAST = 0;
/* Destination offset*/
DMA0->TCD[0].DOFF = 0x0; //16 bytes
/* No link channel, transactions */
DMA0->TCD[0].CITER_ELINKNO = 1;
/* Adjustment to destination address */
DMA0->TCD[0].DLAST_SGA = 0;
/* No link channel, transactions */
DMA0->TCD[0].BITER_ELINKNO = 1;
DMA0->TCD[0].CSR = 0;
Hi
Move
DMA0->ERQ |= DMA_ERQ_ERQ0_MASK;
to the end and it may work.
You are enabling DMA transfer before you have configured it and if it triggers it probably tries to transfer from random addresses to random addresses (registers in the DMA area tend to not have a defined value after reset)
Regards
Mark
Trouble-free K22:
http://www.utasker.com/kinetis/FRDM-K22F.html
http://www.utasker.com/kinetis/TWR-K22F120M.html
http://www.utasker.com/kinetis/BLAZE_K22.html
The result is the same.
The source read error still exists.
I just use eDMA with flexbus to realize the 16bytes transfer.(Does the MK22 support 16bytes(line) burst model )
#define FB_ADDRESS 0x60000200
uint32_t wdata1[4]={0x12345678,0x87654321,0x12345678,0x87654321};
for(n=0;n<4;n+=1) //address offset
{
*(uint32_t*)(FB_ADDRESS)=wdata1[n];//write
DMA0->SSRT = DMA_SSRT_SSRT(0);// a DMA request is asserted via software
}
Ofcourse, I have configurated the flexbus and eDMA.