Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
9 years, 4 months ago.
Can I use an unused SPI pin (MISO) for GPIO?
Is it possible or is the pin unavailable once the SPI peripheral is selected? I've run out of other GPIO pins.
By the way I am using the lpc1768 mbed
Question relating to:
1 Answer
9 years, 4 months ago.
If you aren't using that pin for SPI, sure you can use it for GPIO.
I had this same question. So what would the declaration/configuration code look like for using SPI0 as output only(writes only?) and utilizing the MISO pin as a digital GPIO? I'm also using an LPC1768 MBED module.
Thanks in advance for any assistance!
posted by 06 Sep 2015You can use 'NC' to set a pin as non-connected. This doesn't work on all peripherals: I2C without clock makes no sense. SPI without MISO, or UART without RX, makes perfect sense, so thats supported.
For your question:
SPI spi(<mosi_pin>, NC, <sclk_pin>); DigitalInOut dinout(<the_old_miso_pin>);