[Using uart pins tx & rx and SPI with NodeMCU
Posted: Thu Mar 29, 2018 1:01 pm
Hello,
I'm having trouble using GPIO3 and GPIO1 (uart tx and rx pins) on an ESP8266 for basic discrete input & output when I'm already using other pins for SPI. On an ESP8266 (nodeMCU), I have the following:
SPI display (4 pins, SPI)
Color sensor (5 pins, Discrete)
single LED (1 pin discrete)
single push button (1 pin discrete)
TThe program works fine when I only have the OLED display and the color sensor going. As soon as I try to declare another pin as INPUT or OUTPUT for use as push button or LED, the SPI seems to stop working (the OLED display becomes blank after download).
I've run into these types of issues before probably because the ESP8266 is multiplexing some pins, but I didn't think RX and TX (GPIO3 & GPIO1) serial pins would be effected by SPI, since I'm pretty sure I've used SPI devices and enable serial uart for debug before.
Some things I've tried: moving the LED and push button to GPIO0 and GPIO15. Same effect, and I'm sure GPIO15 effects SPI. The OLED library I'm using for some reason makes me use GPIO4 and GPIO5 for the MISO and SS, instead of the regular HSCLK(GPIO14) and HMISO(GPIO12).
I'm having trouble using GPIO3 and GPIO1 (uart tx and rx pins) on an ESP8266 for basic discrete input & output when I'm already using other pins for SPI. On an ESP8266 (nodeMCU), I have the following:
SPI display (4 pins, SPI)
Color sensor (5 pins, Discrete)
single LED (1 pin discrete)
single push button (1 pin discrete)
TThe program works fine when I only have the OLED display and the color sensor going. As soon as I try to declare another pin as INPUT or OUTPUT for use as push button or LED, the SPI seems to stop working (the OLED display becomes blank after download).
I've run into these types of issues before probably because the ESP8266 is multiplexing some pins, but I didn't think RX and TX (GPIO3 & GPIO1) serial pins would be effected by SPI, since I'm pretty sure I've used SPI devices and enable serial uart for debug before.
Some things I've tried: moving the LED and push button to GPIO0 and GPIO15. Same effect, and I'm sure GPIO15 effects SPI. The OLED library I'm using for some reason makes me use GPIO4 and GPIO5 for the MISO and SS, instead of the regular HSCLK(GPIO14) and HMISO(GPIO12).