This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Decrementing addresses with DMA - SPI communication

Hello!

Anyone knows if possible to use decrement source address operation with block transfer?

I'm interfacing my DMA with my SPI.... the second command is to send a Word (address), with MSB first.

So, if i want to send address 0x1011, i should send 0x10 and then 0x11.

Working on it, my DMA just don't decrement addresses bytes when block mode.... here goes my codes... anyone knows if this type of operation is possible or i'm getting something wrong?

Thx

unsigned int endereco = 0x1011;

DMACTL0 = 0;
// Limpa registrador do DMA
DMACTL0 |= DMA0TSEL_0;
// Seta como fonte de disparo ADC12 (ADC12IFG)

DMA0CTL |= DMASRCINCR_2 + DMADSTINCR_0 + DMADT_1 + DMASBDB;

// DMASRCINCR_2 -> Decrementa endereço de partida
// DMADSTINCR_0 -> Não incrementa endereço de chegada
// DMADT_1 -> Modo bloco
// DMASBDB -> Transferência byte para byte

DMA0SA = (int)&endereco+1;
// Endereço de partida é o endereço da variável endereço
DMA0DA = (unsigned char)&UCB0TXBUF;
// Endereço de chegada é o buffer de transmissão SPI
DMA0SZ = 2;
// Configura tamanho da transferência - endereço de 2 bytes
DMA0CTL |= DMAEN + DMAREQ;
// Enable para transferência

  • Yes, SRCINCR_2 can be used. (it is called INC, but actually it controls INC, DEC, or FIXED). However, the entire block of source will be accessed backwards.

    I think you should structure the block you want to transfer either in the forward order or in the backward order before you start DMA. DMA cannot handle a block with mixed byte order.

**Attention** This is a public forum