Page 3 of 3

Re: DS18B20 not reading every time

Posted: Wed Mar 23, 2022 2:14 pm
by BenR
Hello,

Ok the problem is occurring as the WIFI comunications will be generating interrupts which will be lengthening the delays for the 1-wire communications. I've had a bit of a dig and it looks like there may be a way to use the onboard peripheral to do the 1-wire timings but before we go down that route we can try temporarily disabling the interrupts and see if that helps at all or creates more issues.

So before you start the 1-wire comms try calling this via a C-code icon.

Code: Select all

portDISABLE_INTERRUPTS();
Then immediatley after the 1-wire comms is complete re-enable the interrupts.

Code: Select all

portENABLE_INTERRUPTS();
fingers crossed.

I would try something like this
1-wire_ESP.jpg
1-wire_ESP.jpg (53.04 KiB) Viewed 3391 times

Re: DS18B20 not reading every time

Posted: Wed Mar 23, 2022 3:11 pm
by jollybv
Hi Ben

Thanks i will give this a try and let you know.

Re: DS18B20 not reading every time

Posted: Thu Mar 24, 2022 5:27 am
by jollybv
Hi Ben

That work around worked. I tested it all night with WIFI connected and the system was stable it never once dropped a temp reading.

Re: DS18B20 not reading every time

Posted: Thu Mar 24, 2022 10:00 am
by BenR
Hello,

Excellent that's great thanks for letting me know. Really pleased it's now working reliably again.

I'll now build the workaround into the base OneWire component so you don't have to manually add it into your projects.

Re: DS18B20 not reading every time

Posted: Thu Mar 24, 2022 10:35 am
by BenR
Right, I've now added the code into the one wire component on the update system so you can now try disabling the C code icons and fingers crossed everything will keep working.

Re: DS18B20 not reading every time

Posted: Fri Mar 25, 2022 6:17 am
by jollybv
Hi Ben

Thanks its working like a dream :D I have changed the sampling rate of the prob from 350ms (where it missed a beat every now and then) to 500ms and now it dose not miss a beat at all.