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.

MSP432P401R: MSP432 SPI B2 to DMA not working

Part Number: MSP432P401R

Hi.

I'm trying to work with the SPI-B2 with DMA transfer but the DMA does not start the transfers to the SPI TX buffer. i also connected a logic analyzer to the CLK and TX, RX pins, and there was nothing there.

here is the code i'm using: 

 // Init SPIB2 (P3.5-7) in master mode 3-wire, and DMA CH6 (Tx) DMA CH7 (Rx) and DMA's interrupts.

MAP_GPIO_setAsPeripheralModuleFunctionOutputPin(GPIO_PORT_P3, GPIO_PIN5 | GPIO_PIN6, GPIO_PRIMARY_MODULE_FUNCTION);
MAP_GPIO_setAsPeripheralModuleFunctionInputPin(GPIO_PORT_P3, GPIO_PIN7, GPIO_PRIMARY_MODULE_FUNCTION);

// use P3.4 as CSN for slaves
MAP_GPIO_setAsOutputPin(GPIO_PORT_P3, GPIO_PIN4);
MAP_GPIO_setOutputHighOnPin(GPIO_PORT_P3, GPIO_PIN4);
P3OUT |= GPIO_PIN4; // set all CSNs to high (inactive)

// Configure SPIB2
//-------------------
MAP_SPI_enableModule(EUSCI_B2_BASE);

EUSCI_B2->CTLW0 |= EUSCI_B_CTLW0_SWRST; // Put eUSCI state machine in reset
EUSCI_B2->CTLW0 = EUSCI_B_CTLW0_SWRST | // Remain eUSCI state machine in reset
                                     EUSCI_B_CTLW0_CKPL | // Set clock polarity high, CKPH=0. data sampled on the rising edge of the clock.
                                     EUSCI_B_CTLW0_MSB | // MSB first, 8bit
                                     EUSCI_B_CTLW0_MST | // Set as SPI master
                                     EUSCI_B_CTLW0_MODE_0 | // 3-wire mode 00
                                     EUSCI_B_CTLW0_SYNC | // Set as synchronous mode
                                     EUSCI_B_CTLW0_SSEL__SMCLK | // use SMCLK
                                     EUSCI_B_CTLW0_STEM ; // ignored in 3-wire mode, in 4 wire mode activates Slave enable signal.
EUSCI_B2->BRW = (US)(SMClock / SpiB2BaudRate); // fBitClock = fBRCLK/(UCBRx+1).
EUSCI_B2->CTLW0 &= ~EUSCI_B_CTLW0_SWRST;// Initialize USCI state machine - enable module
MAP_SPI_enableModule(EUSCI_B2_BASE);

/* Configuring DMA module */

MAP_DMA_enableModule();
MAP_DMA_setControlBase(DMAcontrolTable);

MAP_DMA_assignChannel(DMA_CH6_EUSCIB2TX1);
MAP_DMA_assignChannel(DMA_CH7_EUSCIB2RX1);

/* Setting up Buffer for TX primary */
MAP_DMA_setChannelControl(DMA_CH6_EUSCIB2TX1 | UDMA_PRI_SELECT,
                                                   UDMA_SIZE_8 | UDMA_SRC_INC_8 | UDMA_DST_INC_NONE | UDMA_ARB_1);
MAP_DMA_setChannelTransfer(DMA_CH6_EUSCIB2TX1 | UDMA_PRI_SELECT, UDMA_MODE_BASIC, &SpiB2_OutBuf[0],
                                                     (void*) MAP_UART_getTransmitBufferAddressForDMA(EUSCI_B2_BASE), 8);


/* Setting up Buffer for RX */
MAP_DMA_setChannelControl(DMA_CH7_EUSCIB2RX1 | UDMA_PRI_SELECT,
                                                   UDMA_SIZE_8 | UDMA_SRC_INC_NONE | UDMA_DST_INC_8 | UDMA_ARB_1);
MAP_DMA_setChannelTransfer(DMA_CH7_EUSCIB2RX1 | UDMA_PRI_SELECT, UDMA_MODE_BASIC,
                                                    (void*) MAP_SPI_getReceiveBufferAddressForDMA(EUSCI_B2_BASE), &SpiB2_InBuf[0], 8); // Rx Data buffer

/* Enable DMA interrupt */

MAP_DMA_assignInterrupt(INT_DMA_INT1, DMA_CHANNEL_7);
MAP_DMA_clearInterruptFlag(DMA_CH7_EUSCIB2RX1 & 0x0F);

/* Assigning/Enabling Interrupts */
MAP_Interrupt_enableInterrupt(INT_DMA_INT1);
MAP_DMA_enableInterrupt(INT_DMA_INT1);

MAP_DMA_enableChannel(DMA_CHANNEL_7);
MAP_DMA_enableChannel(DMA_CHANNEL_6);

Thank you for any advice.

**Attention** This is a public forum