AnsweredAssumed Answered

SPI DMA interrupt issue

Question asked by jasonedn y. on Mar 8, 2019
Latest reply on Mar 15, 2019 by Aldo Gutierrez

I'm writing the second boot loader for LPC54101. When it jumps from boot to application, the SPI DMA interrupt never fired again, but other interrupts such as tick did. The boot and application use the SPI DMA initialization codes. 

 

The jump codes are below.

void jumpToUserApp( void )
{
USER_ENTRY_PFN user_entry;
user_entry = (USER_ENTRY_PFN)*((uint32_t*)(APP_IMAGE_START + 4));

 

// stop all interrupts
__disable_irq();
__set_CONTROL(0);

__set_MSP(*(uint32_t *)APP_IMAGE_START); // load stack pointer with initial value
(user_entry)();
}

 

The SPI DMA initialization codes:

 

// Config SPI
spi_slave_config_t slaveConfig;
SPI_SlaveGetDefaultConfig(&slaveConfig);
slaveConfig.sselPol = (spi_spol_t)kSPI_SpolActiveAllLow;
slaveConfig.fifoConfig.enableTxFifo = true;
slaveConfig.fifoConfig.enableRxFifo = true;
slaveConfig.fifoConfig.txFifoSize = 3;
slaveConfig.fifoConfig.rxFifoSize = 3;
slaveConfig.fifoConfig.txFifoThreshold = 3;
slaveConfig.fifoConfig.rxFifoThreshold = 3;
SPI_SlaveInit(SPI0, &slaveConfig);

// Config DMA
DMA_Init(DMA0);
DMA_EnableChannel(DMA0, 9);
DMA_EnableChannel(DMA0, 8);
DMA_SetChannelPriority(DMA0, 9, kDMA_ChannelPriority0);
DMA_SetChannelPriority(DMA0, 8, kDMA_ChannelPriority1);

DMA_CreateHandle(&s_slaveTxHandle, DMA0, 9); 

DMA_CreateHandle(&s_slaveRxHandle, DMA0, 8); 

{
//DMA_EnableChannelPeriphRq( DMA0, 8 );
//DMA_EnableChannelPeriphRq( DMA0, 9 );
}

NVIC_SetPriority(DMA0_IRQn, 2);

// Create handle for slave instance
SPI_SlaveTransferCreateHandleDMA(SPI0, &s_slaveHandle, SPI_SlaveUserCallback, NULL, &s_slaveTxHandle, &s_slaveRxHandle);

// Set slave transfer ready to receive/send data
s_xfer.txData = (uint8_t*) &s_txSpiCmd;
s_xfer.rxData = (uint8_t*) &s_rxSpiCmd;
s_xfer.dataSize = 3;

// Start SPI
SPI_SlaveTransferDMA(SPI0, &s_slaveHandle, &s_xfer);

Outcomes