Hi
Please refer attached code about Flexbus burst transfer, which is using DMA to transfer 16 bytes data from/to Flexbus.
The DMA setting of SOFF and DOFF must be aligned to 16-byte address, otherwise the transfer is not started.
Please check below code about SOFF and DOFF setting:
void K70_DMA_init(void)
{
SIM_SCGC6 |= SIM_SCGC6_DMAMUX0_MASK;
SIM_SCGC7 |= SIM_SCGC7_DMA_MASK;
/*Enable DMA MUX ch 0*/
//DMAMUX0_CHCFG0 |= DMAMUX_CHCFG_ENBL_MASK;// | DMAMUX_CHCFG_SOURCE(63);
DMAMUX0_CHCFG0 = DMAMUX_CHCFG_SOURCE(63);
/*Start the sequence*/
DMA_ERQ |= DMA_ERQ_ERQ0_MASK;
/*** Initialize CH0, MRAM -> FlexBus, transfer 16 bytes ***/
/* Set the Source Address*/
DMA_TCD0_SADDR = (uint32_t)(&RAM_START_ADDRESS);
/* Destination address */
DMA_TCD0_DADDR = (uint32_t)(&MRAM_START_ADDRESS);
/* Source offset*/
DMA_TCD0_SOFF = 0x16; // 1 byte
/*Modulo off and port sizes*/
DMA_TCD0_ATTR = DMA_ATTR_SSIZE(4) | DMA_ATTR_SMOD(0) | DMA_ATTR_DSIZE(4) | DMA_ATTR_DMOD(0); //source 8 bits, Destination size is 16-byte burst //DMA_TCD0_ATTR = DMA_ATTR_SSIZE(2) | DMA_ATTR_DSIZE(2); //source and destination size 2 = 32 bits
/* Transfer size */
DMA_TCD0_NBYTES_MLNO = 16; //16 bytes
/* No adjustment to source address */
DMA_TCD0_SLAST = -32;//-32
/* Destination offset*/
DMA_TCD0_DOFF = 0x16; //16 bytes
/* No link channel, transactions */
DMA_TCD0_CITER_ELINKNO = 2; //2
/* Adjustment to destination address */
DMA_TCD0_DLASTSGA = -32;//-32
/* No link channel, transactions */
DMA_TCD0_BITER_ELINKNO = 2; //2
DMA_TCD0_CSR = DMA_CSR_DREQ_MASK;
//DMA_TCD0_CSR = 0;
}
Wish it helps.
Have a great day,
Ma Hui
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------