Hi
I have a very bizzard problem ( for me at least so if somebody could explain whats going on and how to fix it it will be great!
I have the following setup copied from this tutorial:
https://learn.adafruit.com/adafruit-max ... cuitpython
I use different nodemcu v2 or v3 and get the same behavior such as described below
I use stock adafruit max31856 boards
My boot and main are shown below (also taken from the internet with the necessary library so my personal coding is absolutely minimal).
Now here is the problem:
1-With all hardware connected as in the tutorial, the system dont start. Both repl and webrepl are not responding and the board does not respond to ping. So I cannot reproduce the tutorial result
BUT
2- If I disconnect the max31856 board and power the esp3266 Then wifi connection is established and webrepl is active and display negative temperatures as the max31856 is not connected
while webrepl is running I then connect the max31856board the webrepl remains live and temeprature shift from negative to 0C
3 if I then do ctrlC for keyboard interrupt I get a prompt
then I do on the prompt a soft reset:
Code: Select all
from machine import reset
reset()
it works and I get the max31856 correct temperature.
So both my hardware and codes are (kind of..) correct but they dont start properly as it requires the complicated gimick described above to get temperature readings
The problem occur at boot time because if I remove main I cannot boot with max31856 board connected
so I am at a loss to figures out what's going on and how to fix it.... ( maybe some specific boot instructions that I am not aware of...)
Any help will be welcome
Thanks
boot.py:
Code: Select all
import uos, machine
import time
import machine
import micropython
import network
import esp
esp.osdebug(None)
import gc
import ConnectWIFI
statusConnection=ConnectWIFI.connect()
print(statusConnection)
import webrepl
webrepl.start()
gc.collect()
Code: Select all
import machine
from time import sleep_ms
import max31856
from max31856 import MAX31856
spi = machine.SPI(1, baudrate=5000000, polarity=0, phase=1)
cs = machine.Pin(15, machine.Pin.OUT)
cs.on()
therm = MAX31856(spi, cs,tc_type=max31856.MAX31856_K_TYPE)
while True:
print('Temp: {} C (Junction: {} C)\n'.format(therm.read_temp_c(),therm.read_internal_temp_c()))
sleep_ms(1000)