Hello, I am reading a type K thermocouple sensor on an arduino portenta machine.
Library used: Arduino_MachineControl new version.
It reads the normal value when the temperature has not increased.
The problem is that when the sensor starts to increase in temperature, it returns the NaN value.
Here is the temperature when it is normal
Here is the temperature when it is increase
BUT!!!!
A very miraculous thing, somehow when I tried to read this sensor twice at the same time
This way:
temp_probes.selectChannel(0);
pLvSensor->pmcSensor.heaterSensor.temperature = temp_probes.tc.readTemperature(PROBE_K); // need to read double time to fix the issue : "nan" fault returrn
pLvSensor->pmcSensor.heaterSensor.temperature = temp_probes.tc.readTemperature(PROBE_K); // TODO: check root cause
As a result, it returned the correct value on the second reading.
I think the problem may lie in the spi function receiving data. Can you help me find the cause for this?