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.

Compiler: SPI MISO idle state



Tool/software: TI C/C++ Compiler

Good morning, 

I am workying on a device that uses SPI communications. I have notices that the MISO cable is always high when a trasnference is not in process. Is there any way to make it stay low?

Thank you.

  • Unfortunately, I lack the expertise needed to help you.  Which TI device do you use?  Based on that, I can probably move this thread to the right forum.

    Thanks and regards,

    -George

  • I'm using a MSP432P4111. 

    What I am trying to do is communicate one master with multiple slaves. My problema was that the MISO stayed high corrupting the communications. I was able to make the System workying by doing this:

            sem_wait(&slaveSem);
            slaveSpi = SPI_open(Board_SPI1, &slaveSpiParams);
            if (slaveSpi == NULL) {
                printf("Error initializing slave SPI\n");
                while (1);
            }
            else {
                printf("\nSlave SPI initialized");
            }
            transferOK = SPI_transfer(slaveSpi, &slaveTransaction);
            SPI_close(slaveSpi);
            GPIO_setAsInputPin(GPIO_PORT_P3, GPIO_PIN7);
    Port 3_7 is the SS. As I set it to an input it no longer stays in ghigh but I am sure this is no the proper way of solving this.
    Thank you very much for your answer.
  • I do not see an issue with doing it that way.  You can also try to use the 4-pin SPI slave mode as a type of signal to put SOMI in the input direction.  

    const SPIMSP432DMA_HWAttrsV1 spiMSP432DMAHWAttrs[MSP_EXP432P4111_SPICOUNT] = {
        {
            .baseAddr = EUSCI_B0_BASE,
            .bitOrder = EUSCI_B_SPI_MSB_FIRST,
            .clockSource = EUSCI_B_SPI_CLOCKSOURCE_SMCLK,
            .defaultTxBufValue = 0xFF,
            .dmaIntNum = INT_DMA_INT1,
            .intPriority = (~0),
            .rxDMAChannelIndex = DMA_CH1_EUSCIB0RX0,
            .txDMAChannelIndex = DMA_CH0_EUSCIB0TX0,
            .clkPin  = SPIMSP432DMA_P1_5_UCB0CLK,
            .simoPin = SPIMSP432DMA_P1_6_UCB0SIMO,
            .somiPin = SPIMSP432DMA_P1_7_UCB0SOMI,
            .stePin  = SPIMSP432DMA_P1_4_UCB0STE,
            .pinMode  = EUSCI_SPI_3PIN,
            .minDmaTransferSize = 10
        },
    
    #define EUSCI_SPI_3PIN                      EUSCI_B_CTLW0_MODE_0
    #define EUSCI_SPI_4PIN_UCxSTE_ACTIVE_HIGH   EUSCI_B_CTLW0_MODE_1
    #define EUSCI_SPI_4PIN_UCxSTE_ACTIVE_LOW    EUSCI_B_CTLW0_MODE_2

    See the trm for a more details, ti.com/lit/pdf/slau356 . Section 25.3.4.1 4-Pin Slave Mode

    25.3.4.1 4-Pin SPI Slave Mode
    In 4-pin slave mode, UCxSTE is a digital input used by the slave to enable the transmit and receive
    operations and is driven by the SPI master. When UCxSTE is in the slave-active state, the slave operates
    normally. When UCxSTE is in the slave- inactive state:
    • Any receive operation in progress on UCxSIMO is halted.
    • UCxSOMI is set to the input direction.
    • The shift operation is halted until the UCxSTE line transitions into the slave transmit active state.
    The UCxSTE input signal is not used in 3-pin slave mode.

    Regards,

    Chris

**Attention** This is a public forum