SPI-transfer over the DMA

Go To Last Post
4 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi, all!

I use PDCA example on EVK1100. First, SPI modules, drivers were added into the project. SPI is corectly worked in this project.
Then PDCA were configured for transfer from RAM to SPI0

// PDCA channel options
static const pdca_channel_options_t PDCA_SPI_OPTIONS =
{
    .addr = (void *)ascii_anim1,   // memory address
    .pid = AVR32_PDCA_PID_SPI0_TX ,       // select peripheral - data are transmit on SPI TX line.
    .size = sizeof(ascii_anim1),           // transfer counter
    .r_addr = NULL, // next memory address
    .r_size = 0,	   // next transfer counter
    .mode = PDCA_MODE_BYTE,                // select size of the transfer
};

Ttransfer started only after execute commands

spi_selectChip(SPARE_SPI, SPARE_SPI_NPCS);
SPARE_SPI->tdr = 0xsmth;

I reads in datasheet about SPI and PDCA, but I don't understand what I need to do for SPI-DMA-transfer. Does I need set any flag?

-Vyacheslav

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Did you set the TEN bit (transfer enable) in the PDCA control register?

Letting the smoke out since 1978

 

 

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yes, I using standard function of SOFTWARE FRAMEWORK pdca_enable()
{
...
pdca_channel->cr = AVR32_PDCA_TEN_MASK;
}
This function set the TEN bit.

-Vyacheslav

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Problem is resolved.
Right seqence:

 spi_selectChip(SPARE_SPI, SPARE_SPI_NPCS);
pdca_enable(PDCA_CHANNEL_USART_EXAMPLE);  // Enable now the transfer.

wrong sequence:

 pdca_enable(PDCA_CHANNEL_USART_EXAMPLE);  // Enable now the transfer.
spi_selectChip(SPARE_SPI, SPARE_SPI_NPCS);

-Vyacheslav