Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp366673pxy; Wed, 21 Apr 2021 05:09:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzQPJMvf6TwVgJ6n4VQiHX2t2KcIigNnQ1MrtGys57dXl20qMjJHfcspbGgEKfB7gsrk7bL X-Received: by 2002:a17:902:7281:b029:ea:afe2:b356 with SMTP id d1-20020a1709027281b02900eaafe2b356mr34219928pll.16.1619006957959; Wed, 21 Apr 2021 05:09:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619006957; cv=none; d=google.com; s=arc-20160816; b=dbL7YAA9GAP0D7SIQQBbEB/u+mMM4hnvxotoD+T8s1lK8k3C76gg3+T9pC1+KYEzYK pSlBH4EmUlM5SnUXe3qP4EyCXhFEMtl3f6MwYkUrFa1hC431sgOOXdkdaaqpUE/xmqV3 tXlWXp1twBhwsZm0BcnsH7WT5BIEjxXOujkb0qzW0h1xzjqS4YWSrnO8OkamVDLR887K 68gpWaHuzYdjpuGg56N/yrBz9W5jTi26Gh5nxD1WdKfyRUCpGQe0adufeirySk78gzcO lIQgTGsvPDI7y5OoTuEUWrbfIvfiydO1weQdrRREcgaiVaOtYVZC/o1RlW6vhFFfTV8w zyeA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=Amhw8bvKHF0P/YwOkjDFZIuS537DvDV3fmjtkAeOJmI=; b=ZF0Dr8O9+WUOY8nyOAPtTucHqZMSI5CPf90a/8+YQmJvUsQEd6YahyV6FwYpp6yYlP D3fDnZBM9+F5dq5qgswU1zdPQglt/6eKn659YuyzIm5ZMj16LbFyZQ3BEFEZvXqLe/AL EYzoQPV4GP7AlBkFsBSe4Vx2LjPj5DpAjBL3ByKi7tEHL+oY6JbM/wXAD9WAgGsRlbCg Y6kSUObFVA657S9gzfEBq2Oy6bHFVmrnqHqhqO5FDwhgFaHxXfT+brAWwYm282NMRWHF SNFnNwNLVrk+hCXkPyr8ea7mVcbKm4+3gjzIEwDv/XTNWpjKe3D14WZN4jr/UBK4f5fb mzzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zoLRYbRn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d31si2412825pgm.492.2021.04.21.05.09.05; Wed, 21 Apr 2021 05:09:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zoLRYbRn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235490AbhDUJzK (ORCPT + 99 others); Wed, 21 Apr 2021 05:55:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52886 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235988AbhDUJzK (ORCPT ); Wed, 21 Apr 2021 05:55:10 -0400 Received: from mail-lj1-x231.google.com (mail-lj1-x231.google.com [IPv6:2a00:1450:4864:20::231]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 31875C06174A for ; Wed, 21 Apr 2021 02:54:37 -0700 (PDT) Received: by mail-lj1-x231.google.com with SMTP id m7so36184072ljp.10 for ; Wed, 21 Apr 2021 02:54:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Amhw8bvKHF0P/YwOkjDFZIuS537DvDV3fmjtkAeOJmI=; b=zoLRYbRnOVyRRdmxgAJ2LPReQuKLKwaN8+bANZQrKWM6q+W6Wn/CVEpZSJlUSBncLv byYshVXoV2Sk4WYQB72TROIW4XGrpnayBThVJcu6UJMwN2hcSNe04vlgnb8kjgO7gSQZ Oi+hzv+UQ4wRuEqgm7uCgv6DgRdqEXzC6M6bf4PWWwt9j3j/odurauNaLTt0OlWJTOhd 5nz9+7BC4qP0XPcmgL27iLMoU1cBrwEfo88PJ5WXHi4gw1euKJXApsYPi+7bksmVTdlO fZfkFwXM4Oc4r66rd+CtUsCFAySFznZ3YBx0vNUA/9HsDZeAVpClxXbDeM9obNXghR7T Tt1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Amhw8bvKHF0P/YwOkjDFZIuS537DvDV3fmjtkAeOJmI=; b=a5CYO4qnGZ1vwrNX66zV9Uf1wnODfdFg6E8IGgglrWFud+oBLa0IlKNy01REcdCntV b0tKXcQ7ide7miVgDL7wV6Wy3Dz90suRNB8Yqy2Hbjm3g/LEDQzqYmrj6gD9ARZ0RJfi sNZfE0tNkZNzKK+IhxB/cqMs0hpFBRvRpVb4QcQEjOyNV1W4CREeZ2bYuUC6OkyrQ2PU s743FL0QIZh0eVfcAGdtdXCS/7Ow/9XnivIcMIDOJBOjQaJIizBd4nrUX1iIRG7ZGlRl FRT0hob0b+WsUKNZ6M77vZ8axPVmlMPRse2fjwfJxx6SxqC3yeecM2rslg78q0T6GTVb VJ1A== X-Gm-Message-State: AOAM533jfqNbwmjq7AvBA2TSn/2iKczbJwB/TXg7nB7rYjigx+x9CC4h gRd5TuT1wYWfFUgvHatmVNGJ4p5K0VJQ4d/B9Pws/A== X-Received: by 2002:a05:651c:503:: with SMTP id o3mr18074061ljp.368.1618998875678; Wed, 21 Apr 2021 02:54:35 -0700 (PDT) MIME-Version: 1.0 References: <483ac17b-705a-38c3-54ee-7f0089262c03@gmail.com> In-Reply-To: From: Linus Walleij Date: Wed, 21 Apr 2021 11:54:24 +0200 Message-ID: Subject: Re: BUG: iio: mpu3050: Wrong temperature scale To: Dmitry Osipenko Cc: Jonathan Cameron , "linux-iio@vger.kernel.org" , Linux Kernel Mailing List , Svyatoslav Ryhel , Nathan Royer , Jean-Baptiste Maneyrol Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Apr 20, 2021 at 11:26 PM Dmitry Osipenko wrote: > I found a non-kernel example > which uses a similar equation [1], but in a different form. The main > difference is that the Arduino code interprets a raw temperature value > as a signed integer, while upstream assumes it's unsigned. > > [1] > https://github.com/blaisejarrett/Arduino-Lib.MPU3050/blob/master/MPU3050lib.cpp#L111 Oh that's nice. Room temperature as mentioned is 20 deg C I think? The divide by 280 part seems coherent in all examples. > Still, even if assume that the raw temperature is a signed s16 value, it > gives us ~35C in a result, which should be off by ~10C. > > Certainly a manual calibration is an option, but we will try to wait for > the answer from Nathans and Jean-Baptiste before going that route. The method I have seen used is: - Collect many bags of silica gel, those little packages of "dryer" that come in shoe boxes. - Put the device with all these in two layers of plastic bags and pull out cables, glue or strap many layers around the bags to make it really tight where the cables come out. - Submerge this into a mixture of ice and water which is known to be a calibration point for 0 degrees C, wait for some hour or so to stabilize, add some ice if it all melts. Now measures should be 0 deg C so any deviance will be the constant offset that need be added for the sensor. I guess the OTP (one time programmable memory) also contains device-unique calibration, maybe also for the temperature sensor, but IIUC that is read in automatically by the hardware since no drivers seem to look into that. Yours, Linus Walleij