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.

LP-MSPM0G3507: No SPI Communication

Part Number: LP-MSPM0G3507
Other Parts Discussed in Thread: MSPM0G3507

Tool/software:

Hello, 
I'm trying to program the MSP to communicate with a CAN device with the spi_controller_register_format example. I  have used a similar format to the SPI_Controller_writeReg, but using single byte. It seems as if it's getting stuck in an endless loop because of incorrect SPI communication. When testing with the debugger it stops at 

   while (gControllerMode != IDLE_MODE) {
    __WFI();
}
 
uint8_t* spi_write(uint8_t writeCmd, uint8_t data) {
    static uint8_t result[2];
    gControllerMode = TX_REG_ADDRESS_WRITE_MODE;
    gTxBuffer[0] = data;
    gTxByteCount = 1;
    gRxByteCount = 1;
    gRxIndex = 0;
    gTxIndex = 0;

    DL_SPI_clearInterruptStatus(SPI_0_INST, DL_SPI_INTERRUPT_TX);
    DL_SPI_transmitData8(SPI_0_INST,writeCmd); // write
    DL_SPI_enableInterrupt(SPI_0_INST, DL_SPI_INTERRUPT_TX);

 
    while (gControllerMode != IDLE_MODE) {
    __WFI();
}


which makes me assume that it might be because of SPI CS or incorrect PICO POCI wiring. I have verified I'm connecting to the correct pins, so I'm not sure how to fix this.What would you recommend? 
Best,
Leah
  • If you start from a SPI code example:

    C:\ti\mspm0_sdk_2_05_00_05\examples\nortos\LP_MSPM0G3507\driverlib\spi_controller_multibyte_fifo_poll

    You can see the SPI waveform on PICO pin and clock pin.

    When testing with the debugger it stops at 

    For a interrupt changed variable, please add volatile:

    volatile uint8_t gControllerMode = 0;

    Also, you need to confirm whether you enable SPI NVIC interrupt.

    Each byte send or trigger Tx FIFO trigger level will enter SPI's Tx interrupt.

    And as the same time, you can try to monitor the SPI PICO using logic analyzer, to confirm there are data sent on SPI bus.

    For a SPI interrupt application, please refer to this example:

    C:\ti\mspm0_sdk_2_05_00_05\examples\nortos\LP_MSPM0G3507\driverlib\spi_controller_echo_interrupts