Hello I modified the spi_dma_loopback example mode to only work with 1 spi slave my idea is to get DMA trigger after RX buff is full then move the RX buff data on a data array "slrxData" of 3 bytes but the DMA is never triggering. I have 2 Timers SCLK at 3 MHz and Bitstream Timer at 125 KHz. I feed the spi slave clock with the SCLK Timer, as it is configured in 3 pin mode CS is out of the equation. I feed the spi slave SIMO with the Bitstream Timer. ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ The configuration Parameter are as follows ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ /* SPI Slave Configuration Parameter */ const eUSCI_SPI_SlaveConfig spiSlaveConfig = { EUSCI_B_SPI_MSB_FIRST, EUSCI_B_SPI_PHASE_DATA_CAPTURED_ONFIRST_CHANGED_ON_NEXT, EUSCI_B_SPI_CLOCKPOLARITY_INACTIVITY_HIGH, EUSCI_B_SPI_3PIN }; /* DMA Control Table */ #if defined(__TI_COMPILER_VERSION__) #pragma DATA_ALIGN(MSP_EXP432P401RLP_DMAControlTable, 1024) #elif defined(__IAR_SYSTEMS_ICC__) #pragma data_alignment=1024 #elif defined(__GNUC__) __attribute__ ((aligned (1024))) #elif defined(__CC_ARM) __align(1024) #endif static DMA_ControlTable MSP_EXP432P401RLP_DMAControlTable[32]; #define MAP_SPI_MSG_LENGTH 3 uint32_t isrCounter = 0; uint8_t slrxData[3]; ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ Setting SPI and DMA ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ /* Configure SLAVE CLK, MOSI and SOMI (EUSCI_B2) */ MAP_GPIO_setAsPeripheralModuleFunctionInputPin(GPIO_PORT_P3, GPIO_PIN5 | GPIO_PIN6 | GPIO_PIN7, GPIO_PRIMARY_MODULE_FUNCTION); /* Configuring SPI module */ MAP_SPI_initSlave(EUSCI_B2_BASE, &spiSlaveConfig); /* Enable the SPI module */ MAP_SPI_enableModule(EUSCI_B2_BASE); /* Configuring DMA module */ MAP_DMA_enableModule(); MAP_DMA_setControlBase(MSP_EXP432P401RLP_DMAControlTable); /* Assign DMA channel 5 to EUSCI_B0_RX2 */ MAP_DMA_assignChannel(DMA_CH5_EUSCIB2RX0); /* SPI Slave Settings */ /* Setup the RX transfer characteristics & buffers */ MAP_DMA_setChannelControl(DMA_CH5_EUSCIB2RX0 | UDMA_PRI_SELECT, UDMA_SIZE_8 | UDMA_SRC_INC_NONE | UDMA_DST_INC_8 | UDMA_ARB_1); MAP_DMA_setChannelTransfer(DMA_CH5_EUSCIB2RX0 | UDMA_PRI_SELECT, UDMA_MODE_AUTO, (void *) MAP_SPI_getReceiveBufferAddressForDMA(EUSCI_B2_BASE), slrxData, MAP_SPI_MSG_LENGTH); /* Enable DMA interrupt */ MAP_DMA_assignInterrupt(INT_DMA_INT1, 5); MAP_DMA_clearInterruptFlag(5); ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ Then after configuring the timers /* Enabling SRAM Bank Retention */ MAP_SysCtl_enableSRAMBankRetention(SYSCTL_SRAM_BANK1); /* Enabling MASTER interrupts */ MAP_Interrupt_enableMaster(); /* Assigning/Enabling Interrupts */ // MAP_Interrupt_enableInterrupt(INT_DMA_INT1); MAP_DMA_enableInterrupt(INT_DMA_INT1); MAP_DMA_enableChannel(5); TA1CTL |= TASSEL__SMCLK | MC__UP | TACLR; // SMCLK, Up Mode (Counts to TA1CCR0), Clear TAR1, Start Counting from here TA3CTL |= TASSEL__SMCLK | MC__UP | TACLR; // SMCLK, Up Mode (Counts to TA3CCR0), Clear TAR3, Start Counting from here ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ DMA IRQ HANDLER ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ void DMA_INT1_IRQHandler(void) { MAP_DMA_clearInterruptFlag(5); /* Disable the interrupt to allow execution */ MAP_Interrupt_disableInterrupt(INT_DMA_INT1); MAP_DMA_disableInterrupt(INT_DMA_INT1); } ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ Notice how I comment the line of enabling the DMA interrupt by SW as I want the DMA to be triggered by HW (in this case SPI RX buffer Interrupt). Debugging the session makes the SPI looks right it is recieving the bitstream and RXbuff is plenty with 1 and 0 but the DMA never notices and my destination array slrxData is empty. Something maybe wrong with configuration parameters can somebody enlight me?
↧