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.

MSP430FR5994: Unable to generate STE from UCB1 in SPI mode

Part Number: MSP430FR5994

Hello all,

I am using the MSP430FR5994 Launchpad and am unable to generate the CS (STE) using the DriverLib and EUSCI_B1 (SPI is in the primary module). I can produce the clock and MOSI signals, just not the STE. Below is a scope image, followed the SPI setup configuration snippet and finally followed by a simple loop in the next snippet. 

Scope Image. Signals listed from top (yellow) to bottom (green) are SCLK, MOSI, MISO, #CS (notice it is always high)

I am using Mode 0 which samples data on the first transition of the clock. The interface for UCB1 are P5.0 (SIMO), P5.1 (SOMI), P5.2(SCLK) and P5.3I(STE).

uint8_t ArduCAM_SPI_Init()    //init SPI interface
{



    //Configure Pins for UCB1CLK  P5.2
        GPIO_setAsPeripheralModuleFunctionOutputPin(
            GPIO_PORT_P5,
            GPIO_PIN0 + GPIO_PIN2 + GPIO_PIN3,
            GPIO_PRIMARY_MODULE_FUNCTION
        );

        //Configure Pins for UCB1TXD/UCB1SIMO, UCB1RXD/UCB0SOMI
        GPIO_setAsPeripheralModuleFunctionInputPin(
            GPIO_PORT_P5,
            GPIO_PIN1,
            GPIO_PRIMARY_MODULE_FUNCTION
        );


        PMM_unlockLPM5();

    //Initialize SPI_B1 Master
    EUSCI_B_SPI_initMasterParam SPI_B1_param = {0};
    SPI_B1_param.selectClockSource = EUSCI_B_SPI_CLOCKSOURCE_SMCLK;
    SPI_B1_param.clockSourceFrequency = ArduCAM_CLOCK_FREQ;
    SPI_B1_param.desiredSpiClock =  ArduCAM_DESIRED_SPI_FREQ;
    SPI_B1_param.msbFirst = EUSCI_B_SPI_MSB_FIRST;
    SPI_B1_param.clockPhase = EUSCI_B_SPI_PHASE_DATA_CAPTURED_ONFIRST_CHANGED_ON_NEXT;//EUSCI_B_SPI_PHASE_DATA_CHANGED_ONFIRST_CAPTURED_ON_NEXT;//
    SPI_B1_param.clockPolarity = EUSCI_B_SPI_CLOCKPOLARITY_INACTIVITY_LOW;//EUSCI_B_SPI_CLOCKPOLARITY_INACTIVITY_HIGH;
    SPI_B1_param.spiMode =  EUSCI_B_SPI_4PIN_UCxSTE_ACTIVE_LOW; //EUSCI_B_SPI_3PIN;//
    EUSCI_B_SPI_initMaster(EUSCI_B1_BASE, &SPI_B1_param);

    //Enable SPI module
    EUSCI_B_SPI_enable(EUSCI_B1_BASE);

   //Clear RXIFG interrupt flag
   EUSCI_B_SPI_clearInterrupt(EUSCI_B1_BASE, EUSCI_B_SPI_RECEIVE_INTERRUPT);
      PMM_unlockLPM5();
     // __enable_interrupt();
    return 1;
}

The simple loop I am running (captured on the scope) is below. A couple of notes:  I lifted most of the code from the OUT-OF-BOX example for my test. In that example, the CS was coded separately (it did not use the built in STE) and for some reason chose to use EUSCI_B_SPI_3PIN mode. My understanding is that 3PIN mode multiplexes SIMO/SOMI onto one physical wire. The SD card has separate SIMO and SOMI pins so why he did this I don't know.  Anyone know? I am wondering if STE did not work in 3PIN mode which is why he coded his own..... if so isn't this an errata? 

    while(1)
      
    {
        uint16_t gie = __get_SR_register() & GIE;              // Store current GIE state

    while(!EUSCI_B_SPI_getInterruptStatus(EUSCI_B1_BASE, EUSCI_B_SPI_TRANSMIT_INTERRUPT));
    EUSCI_B_SPI_transmitData(EUSCI_B1_BASE, 0x00 | 0x80);  //register address 0
    while(!EUSCI_B_SPI_getInterruptStatus(EUSCI_B1_BASE, EUSCI_B_SPI_TRANSMIT_INTERRUPT));
    EUSCI_B_SPI_transmitData(EUSCI_B1_BASE, 0x55);   //data 55
    while(EUSCI_B_SPI_isBusy(EUSCI_B1_BASE));

    // Dummy read to empty RX buffer and clear any overrun conditions
     EUSCI_B_SPI_receiveData(EUSCI_B1_BASE);
     __bis_SR_register(gie);                                // Restore original GIE state

     
}
       

**Attention** This is a public forum