Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Very long and unreliable startup, unreliable reading #8

Open
sokol07 opened this issue Oct 19, 2021 · 2 comments
Open

Very long and unreliable startup, unreliable reading #8

sokol07 opened this issue Oct 19, 2021 · 2 comments

Comments

@sokol07
Copy link

sokol07 commented Oct 19, 2021

Hi,
I am using your code with STM32F411 (disco board) and some chinese probe based on DS18B20.
I am using CubeIDE but I've modified a few places in code to let is find all definitions and I've got the code running.
However, the temperature read from DS18B20 is extremely unstable and unreliable, making the sensor totally unusable.
The task is called as it should be, the DS18B20 address is detected correctly (I can see the address in the debug), usually the temperature is read correctly once and then the data is not read (isValid=0) for dozen seconds (sometimes minutes). After this time the data is read once again and then is invalid again.
image
Sometimes the situation is even worse - I don't even get the address of the DS18B20.
I lowered the update interval timeout to 1000ms but this doesn't seem to cause the issue because I have the same problems when the timeout is set to 10000ms or even 20000ms.
Is there something I am missing which causes these problems? Can this be made more reliable some way?

EDIT - after some debugging I see that the issue is the CRC which is invalid (crc is not equal to data[8]). There are values within data[] are partially just series of 1s like this:
image

@sokol07 sokol07 changed the title Very long startup Very long and unreliable startup Oct 19, 2021
@sokol07 sokol07 changed the title Very long and unreliable startup Very long and unreliable startup, unreliable reading Oct 20, 2021
@sokol07
Copy link
Author

sokol07 commented Oct 20, 2021

Using an oscilloscope I determined that the responses from the DS18B20 were valid but for some reason not read correctly by the STM32.
I moved the task so it is created first (I don't remember whether the order of task creation matters on their execution but I think I have read that they are executed subsequently as created (as long there isn't some kind of flow control) and changed its priority to higher than any other task.
For now the sensor is working correctly, it is starting without problems and keeps working without invalid data with refresh rate of 450ms (I had some invalid data with lower refresh times).

I'll keep watching the device, if the problem is solved we can consider this issue closed but I suggest adding a note to library readme to point out that the task priority can be an issue.

@sokol07
Copy link
Author

sokol07 commented Oct 21, 2021

Unfortunately, increasing the priority only seemed to fix the issue - it worked for some time but today the same code doesn't read the temperatures correctly (i get only one valid read in a dozen). The problem lies somewhere else and the DS18B20 is still unusable. Therefore, the issue is still open...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant