-
Notifications
You must be signed in to change notification settings - Fork 5k
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
2021-02-06 update breaks negative temperatures for 1-wire sensors (reports 7000 degrees instead of -10) #4124
Comments
My guess is this is a regression from 9ace0b4 |
Yup in |
I did not know where to report this so I "reported" it on stack overflow instead and got guided here. I also opened a question on the pi forums but either the site is buggy or it's still in moderation. Idk who to tell but it would be great to get this fixed ASAP. @johnterickson do you have some binary for me that I can use to get my thermometers working? Or anything else I can do while avoiding to compile the entire linux kernel on my pi which I imagine takes like 5 weeks. |
Thanks to Jarosław Komar there is a workaround! The thermometers always overreport by 4096°C and by subtracting 4096 if the temperature is over 100°C correct readings can be obtained. |
@danieltroger Glad you found a workaround - I think the "subtract 4096" is equivalent, but you can see how I worked around this in my app here as another reference point: johnterickson/MiPi-1wire-rs@2b852cb |
commit 2f6055c upstream. DS18B20 device driver returns an incorrect value for negative temperatures due to a missing sign-extension in w1_DS18B20_convert_temp(). Fix by using s16 temperature value when converting to int. See: #4124 Fixes: 9ace0b4 (w1: w1_therm: Add support for GXCAS GX20MH01 device.) Cc: stable <stable@vger.kernel.org> Reported-by: Paweł Marciniak <sunwire@gmail.com> Signed-off-by: Ivan Zaentsev <ivan.zaentsev@wirenboard.ru> Link: https://lore.kernel.org/r/20210121093021.224764-1-ivan.zaentsev@wirenboard.ru Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
commit 2f6055c upstream. DS18B20 device driver returns an incorrect value for negative temperatures due to a missing sign-extension in w1_DS18B20_convert_temp(). Fix by using s16 temperature value when converting to int. See: #4124 Fixes: 9ace0b4 (w1: w1_therm: Add support for GXCAS GX20MH01 device.) Cc: stable <stable@vger.kernel.org> Reported-by: Paweł Marciniak <sunwire@gmail.com> Signed-off-by: Ivan Zaentsev <ivan.zaentsev@wirenboard.ru> Link: https://lore.kernel.org/r/20210121093021.224764-1-ivan.zaentsev@wirenboard.ru Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
The upstream fix is now in rpi-5.10.y and rpi-5.11.y. |
kernel: media: i2c: imx290: Support V4L2_CID_ANALOGUE_GAIN as well as V4L2_CID_GAIN See: raspberrypi/linux#4119 kernel: i2c: bcm2835: Handle untimely DONE signal See: raspberrypi/linux#3064 kernel: 5.10 hdmi cec rework See: raspberrypi/linux#3999 kernel: w1: w1_therm: Fix conversion result for negative temperatures See: raspberrypi/linux#4124 kernel: staging:bcm2835-camera: Fix the cherry-pick of AWB Greyworld See: raspberrypi/linux#4131
kernel: media: i2c: imx290: Support V4L2_CID_ANALOGUE_GAIN as well as V4L2_CID_GAIN See: raspberrypi/linux#4119 kernel: i2c: bcm2835: Handle untimely DONE signal See: raspberrypi/linux#3064 kernel: 5.10 hdmi cec rework See: raspberrypi/linux#3999 kernel: w1: w1_therm: Fix conversion result for negative temperatures See: raspberrypi/linux#4124 kernel: staging:bcm2835-camera: Fix the cherry-pick of AWB Greyworld See: raspberrypi/linux#4131
rpi-update contains the potential fix for this. Please test and report. |
Just updated and tested - it works for me, thank you. |
Confirmed here as well - thanks @pelwell and @popcornmix for the quick turnaround! |
Can confirm that this patch fixes reading negatives on a Raspberry Pi Model B Rev 2, kernel 5.10.14. Thanks for the quick fix! |
Can confirm here too it is now working again, thanks a lot! |
commit 2f6055c upstream. DS18B20 device driver returns an incorrect value for negative temperatures due to a missing sign-extension in w1_DS18B20_convert_temp(). Fix by using s16 temperature value when converting to int. See: raspberrypi/linux#4124 Fixes: 9ace0b4 (w1: w1_therm: Add support for GXCAS GX20MH01 device.) Cc: stable <stable@vger.kernel.org> Reported-by: Paweł Marciniak <sunwire@gmail.com> Signed-off-by: Ivan Zaentsev <ivan.zaentsev@wirenboard.ru> Link: https://lore.kernel.org/r/20210121093021.224764-1-ivan.zaentsev@wirenboard.ru Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Tested the fix by way of raspi-config, and negative centigrade temperatures appear to be getting decoded correctly again. Thank you for the rapid fix. |
The w1 driver has been updated in newer kernels, so I added this simplification to the code and also removed the error checking (this issue should not be handled in software, build better onewire networks, please). *NOTE:* There is also a kernel bug when negative temperatures are read, but it will be corrected in the near future. raspberrypi/linux#4124
commit 2f6055c upstream. DS18B20 device driver returns an incorrect value for negative temperatures due to a missing sign-extension in w1_DS18B20_convert_temp(). Fix by using s16 temperature value when converting to int. See: #4124 Fixes: 9ace0b4 (w1: w1_therm: Add support for GXCAS GX20MH01 device.) Cc: stable <stable@vger.kernel.org> Reported-by: Paweł Marciniak <sunwire@gmail.com> Signed-off-by: Ivan Zaentsev <ivan.zaentsev@wirenboard.ru> Link: https://lore.kernel.org/r/20210121093021.224764-1-ivan.zaentsev@wirenboard.ru Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
commit 2f6055c upstream. DS18B20 device driver returns an incorrect value for negative temperatures due to a missing sign-extension in w1_DS18B20_convert_temp(). Fix by using s16 temperature value when converting to int. See: raspberrypi/linux#4124 Fixes: 9ace0b4 (w1: w1_therm: Add support for GXCAS GX20MH01 device.) Cc: stable <stable@vger.kernel.org> Reported-by: Paweł Marciniak <sunwire@gmail.com> Signed-off-by: Ivan Zaentsev <ivan.zaentsev@wirenboard.ru> Link: https://lore.kernel.org/r/20210121093021.224764-1-ivan.zaentsev@wirenboard.ru Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Fang Yafen <yafen@iscas.ac.cn>
commit 2f6055c upstream. DS18B20 device driver returns an incorrect value for negative temperatures due to a missing sign-extension in w1_DS18B20_convert_temp(). Fix by using s16 temperature value when converting to int. See: raspberrypi/linux#4124 Fixes: 9ace0b4 (w1: w1_therm: Add support for GXCAS GX20MH01 device.) Cc: stable <stable@vger.kernel.org> Reported-by: Paweł Marciniak <sunwire@gmail.com> Signed-off-by: Ivan Zaentsev <ivan.zaentsev@wirenboard.ru> Link: https://lore.kernel.org/r/20210121093021.224764-1-ivan.zaentsev@wirenboard.ru Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Fang Yafen <yafen@iscas.ac.cn>
commit 2f6055c upstream. DS18B20 device driver returns an incorrect value for negative temperatures due to a missing sign-extension in w1_DS18B20_convert_temp(). Fix by using s16 temperature value when converting to int. See: raspberrypi/linux#4124 Fixes: 9ace0b4 (w1: w1_therm: Add support for GXCAS GX20MH01 device.) Cc: stable <stable@vger.kernel.org> Reported-by: Paweł Marciniak <sunwire@gmail.com> Signed-off-by: Ivan Zaentsev <ivan.zaentsev@wirenboard.ru> Link: https://lore.kernel.org/r/20210121093021.224764-1-ivan.zaentsev@wirenboard.ru Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Fang Yafen <yafen@iscas.ac.cn>
commit 2f6055c upstream. DS18B20 device driver returns an incorrect value for negative temperatures due to a missing sign-extension in w1_DS18B20_convert_temp(). Fix by using s16 temperature value when converting to int. See: raspberrypi/linux#4124 Fixes: 9ace0b4 (w1: w1_therm: Add support for GXCAS GX20MH01 device.) Cc: stable <stable@vger.kernel.org> Reported-by: Paweł Marciniak <sunwire@gmail.com> Signed-off-by: Ivan Zaentsev <ivan.zaentsev@wirenboard.ru> Link: https://lore.kernel.org/r/20210121093021.224764-1-ivan.zaentsev@wirenboard.ru Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Fang Yafen <yafen@iscas.ac.cn>
commit 2f6055c upstream. DS18B20 device driver returns an incorrect value for negative temperatures due to a missing sign-extension in w1_DS18B20_convert_temp(). Fix by using s16 temperature value when converting to int. See: raspberrypi/linux#4124 Fixes: 9ace0b4 (w1: w1_therm: Add support for GXCAS GX20MH01 device.) Cc: stable <stable@vger.kernel.org> Reported-by: Paweł Marciniak <sunwire@gmail.com> Signed-off-by: Ivan Zaentsev <ivan.zaentsev@wirenboard.ru> Link: https://lore.kernel.org/r/20210121093021.224764-1-ivan.zaentsev@wirenboard.ru Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Fang Yafen <yafen@iscas.ac.cn>
raspberrypi inclusion category: feature bugzilla: 50432 -------------------------------- commit 2f6055c upstream. DS18B20 device driver returns an incorrect value for negative temperatures due to a missing sign-extension in w1_DS18B20_convert_temp(). Fix by using s16 temperature value when converting to int. See: raspberrypi/linux#4124 Fixes: 9ace0b4 (w1: w1_therm: Add support for GXCAS GX20MH01 device.) Cc: stable <stable@vger.kernel.org> Reported-by: Paweł Marciniak <sunwire@gmail.com> Signed-off-by: Ivan Zaentsev <ivan.zaentsev@wirenboard.ru> Link: https://lore.kernel.org/r/20210121093021.224764-1-ivan.zaentsev@wirenboard.ru Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Fang Yafen <yafen@iscas.ac.cn> Signed-off-by: Zheng Zengkai <zhengzengkai@huawei.com>
Is this the right place for my bug report?
This repository contains the Linux kernel used on the Raspberry Pi. If you believe that the issue you are seeing is kernel-related, this is the right place. If not, we have other repositories for the GPU firmware at github.com/raspberrypi/firmware and Raspberry Pi userland applications at github.com/raspberrypi/userland. If you have problems with the Raspbian distribution packages, report them in the github.com/RPi-Distro/repo. If you simply have a question, then the Raspberry Pi forums are the best place to ask it.
Describe the bug
I have a temperature sensor in Rasp Pi 2 in my garage. It's been running great for over a year. I have it set to update nightly. Last night, as soon as the update rebooted, I got a notification that my freezer was at 7000 degrees F. Fridge temp was nominal. I hard-powered off and on the device. No change.
Looking at the data sheet I realized that the 7000 deg F temp was way beyond what the sensor could even represent in binary. I double checked the direct output from the sensor (see below) to make sure it wasn't my code that messed it up.
To reproduce
Attach DS18B20, enable 1-wire, put sensor below 0 degrees celcius.
Expected behaviour
Negative temperatures from 1-wire sensors are correct.
Actual behaviour
Negative temperatures are incorrectly sign extended.
System
Copy and paste the results of the raspinfo command in to this section. Alternatively, copy and paste a pastebin link, or add answers to the following questions:
Raspberry Pi 2
cat /etc/rpi-issue
)?vcgencmd version
)?uname -a
)?Logs
Additional context
You can find my mitigation to properly sign-extend here: johnterickson/MiPi-1wire-rs@2b852cb
The text was updated successfully, but these errors were encountered: