I have a MKR1000 hooked up to MAX31855 thermocouple breakout and 4x20 OpenLCD display. My sketch is working fine and I am happy with it. Basically my application measures the temperature of our kiln, displays it, and every so often sends data to a database via wifi.
I decided to move the application to the esp8266 Thing, make appropriate changes to my sketch, but things don’t quite work.
This is the wiring:
MAX31855 GND → GND
VCC → Thing’s 3.3V
SCK → Thing’s SCL (D14)
SO → Thing’s MISO (D12)
CS → Thing’s 4 (D4)
OpenLCD GND → GND
RAW → Thing’s 3.3V
SDA → Thing’s SDA (D2)
SCL → Thing’s SCL (D14)
The “getting started” tutorial on the esp8266 Thing suggests that SCL (D14) can be used both for Wire and SPI.
What I’m noticing is this:
-
in my setup(), if I call SPI.begin() before Wire.begin(), then my thermocouple readings are always 32 F (i.e. no data read) and my display shows this.
-
in my setup(), if I call Wire.begin() before SPI.begin(), then my thermocouple readings are as expected (about 72 F and 95 F when I touch the thermocouple tip) but the display is blank.
It seems that the latter begin() undoes something that the former begin() configures. I thought they would have been independent. Is there a chance that this sharing of pin D14 between as the clock for both SPI and Wire is causing me trouble?
Does default SPI.begin() and Wire.begin() methods setup different clock rates?
Thanks for any advice/hints.