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.

MSP430FR5989: Can read the value of a GPIO pin when Its configured to be used as a Input pin for the SPI module?

Part Number: MSP430FR5989

I am trying to interface with the AD7193 ADC over SPI.

This ADC multipliexs its MISO pin with its Data Ready function.  After initiating a conversion, it indicates that the data is ready by pulling the MISO line low.

On the MSP, I am using SPI A0 in master mode using pins Port2 Pin {0..2} , with Pin1 configured as an Input pin with the Primary module function.

So after writing the convert command to the ADC, will the P2IN register contain valid pin values ? I want to poll this register and wait till the MISO line goes low.

Currently, when I try to read this pin, it always returns a 1. Do I need to reconfigure the pin to GPIO mode each time?

  • Hello,

    No, you can not read the GPIO when the pin is configured for another function with the PxSELx registers.  

    You may have two options:

    1. Switchback and forth between SPI and GPIO on this pin
    2. You may be able to connect another GPIO as in input and use it to monitor.  
      1. Be careful with this as you don't want the GPIO's to ever be outputs and drive against each other.  A series resistor would probably be a good idea for protection.  

    Thanks,

    JD

  • Switching between GPIO and PRIMARY modes seems to be working fine!

    Thanks for the quick confirmation!

**Attention** This is a public forum