# I2c\_dev\_write \_reg(0x0248) doing a read?

**URL:** <https://cern-ipmc-forum.web.cern.ch/t/i2c-dev-write-reg-0x0248-doing-a-read/301>\
**Category:** Software\
**Created:** [February 13, 2024, 10:28am UTC](https://cern-ipmc-forum.web.cern.ch/t/i2c-dev-write-reg-0x0248-doing-a-read/301 "2024-02-13T10:28:40Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![slafrass](https://cern-ipmc-forum.web.cern.ch/letter_avatar_proxy/v4/letter/s/5daacb/32.png) [@slafrass](https://cern-ipmc-forum.web.cern.ch/u/slafrass)\
**Post date:** [February 13, 2024, 10:28am UTC](https://cern-ipmc-forum.web.cern.ch/t/i2c-dev-write-reg-0x0248-doing-a-read/301/1 "2024-02-13T10:28:40Z")

</div>

Hello,

Did anyone already observe such strange behavior ?  
We reproduced it (scope traces) on both the DevKit and on our LATOURNETT board…

Best regards,  
Sylvain

---

<div class="post-metadata">

**Author:** ![joos](https://cern-ipmc-forum.web.cern.ch/letter_avatar_proxy/v4/letter/j/a3d4f5/32.png) [@joos](https://cern-ipmc-forum.web.cern.ch/u/joos)\
**Post date:** [February 13, 2024, 10:55am UTC](https://cern-ipmc-forum.web.cern.ch/t/i2c-dev-write-reg-0x0248-doing-a-read/301/2 "2024-02-13T10:55:44Z")

</div>

Hello,

I had a quick look at the source code of Pigeon Point but cannot see how this could happen.

Best regards,

Markus

---

<div class="post-metadata">

**Author:** ![slafrass](https://cern-ipmc-forum.web.cern.ch/letter_avatar_proxy/v4/letter/s/5daacb/32.png) [@slafrass](https://cern-ipmc-forum.web.cern.ch/u/slafrass)\
**Post date:** [February 14, 2024, 4:15pm UTC](https://cern-ipmc-forum.web.cern.ch/t/i2c-dev-write-reg-0x0248-doing-a-read/301/3 "2024-02-14T16:15:10Z")

</div>

![Screenshot 2024-02-14 at 17.12.46](https://cern-ipmc-forum.web.cern.ch/uploads/default/original/1X/1945edcc4ea0e0803af5f02fb0032b299e354a18.jpeg)

 ![Screenshot 2024-02-14 at 17.12.51](https://cern-ipmc-forum.web.cern.ch/uploads/default/original/1X/e8643ca8c387073eb2a621af0c8dff0ba4244d14.jpeg)

---

<div class="post-metadata">

**Author:** ![haass](https://cern-ipmc-forum.web.cern.ch/letter_avatar_proxy/v4/letter/h/f9ae1b/32.png) [@haass](https://cern-ipmc-forum.web.cern.ch/u/haass)\
**Post date:** [February 14, 2024, 6:00pm UTC](https://cern-ipmc-forum.web.cern.ch/t/i2c-dev-write-reg-0x0248-doing-a-read/301/4 "2024-02-14T18:00:16Z")

</div>

Hello Sylvain,

just saw the scope traces, I think you’re using the function wrong, the last argument gives the number of bytes to transfer, this should be at least 1, probably 2 in the case of the TMP464, since it has 16 bit registers.

cheers,

Stefan

---

<div class="post-metadata">

**Author:** ![slafrass](https://cern-ipmc-forum.web.cern.ch/letter_avatar_proxy/v4/letter/s/5daacb/32.png) [@slafrass](https://cern-ipmc-forum.web.cern.ch/u/slafrass)\
**Post date:** [February 15, 2024, 1:29pm UTC](https://cern-ipmc-forum.web.cern.ch/t/i2c-dev-write-reg-0x0248-doing-a-read/301/5 "2024-02-15T13:29:33Z")

</div>

Hello,

We of course already tried all those possibilities without success…

Cheers,

---

<div class="post-metadata">

**Author:** ![haass](https://cern-ipmc-forum.web.cern.ch/letter_avatar_proxy/v4/letter/h/f9ae1b/32.png) [@haass](https://cern-ipmc-forum.web.cern.ch/u/haass)\
**Post date:** [February 15, 2024, 5:46pm UTC](https://cern-ipmc-forum.web.cern.ch/t/i2c-dev-write-reg-0x0248-doing-a-read/301/6 "2024-02-15T17:46:13Z")

</div>

Hello Sylvain,

I had another look at the scope traces and they do in fact make sense. The bits are:

START(0) 0 1 0 0 1 0 0 W(0) NACK(1) STOP(0)

So it is a write cycle as expected, however there is no ACK from the slave since the address is wrong. You need to pass the 8-bit address to the function, i.e. 0x290. I’m afraid this is often causing confusion with I2C devices, since some vendors specify 7-bit addresses and other 8-bit addresses. We should spell this out clearly in the sensor driver documentation.

Can you please try with 0x290 and see if it works?

cheers,

Stefan

---

<div class="post-metadata">

**Author:** ![slafrass](https://cern-ipmc-forum.web.cern.ch/letter_avatar_proxy/v4/letter/s/5daacb/32.png) [@slafrass](https://cern-ipmc-forum.web.cern.ch/u/slafrass)\
**Post date:** [February 21, 2024, 10:06am UTC](https://cern-ipmc-forum.web.cern.ch/t/i2c-dev-write-reg-0x0248-doing-a-read/301/7 "2024-02-21T10:06:41Z")

</div>

Sadly this is it…  
Best regards,

---

<div class="post-metadata">

**Author:** ![spiwoks](https://cern-ipmc-forum.web.cern.ch/letter_avatar_proxy/v4/letter/s/e19b73/32.png) [@spiwoks](https://cern-ipmc-forum.web.cern.ch/u/spiwoks)\
**Post date:** [February 21, 2024, 10:22am UTC](https://cern-ipmc-forum.web.cern.ch/t/i2c-dev-write-reg-0x0248-doing-a-read/301/8 "2024-02-21T10:22:37Z")

</div>

Hi Sylvain,

Does this mean that you can do the read now OK?

I would not call that “sad” – so it is a success! 😉

Cheers,  
ralf.

---

<div class="post-metadata">

**Author:** ![slafrass](https://cern-ipmc-forum.web.cern.ch/letter_avatar_proxy/v4/letter/s/5daacb/32.png) [@slafrass](https://cern-ipmc-forum.web.cern.ch/u/slafrass)\
**Post date:** [February 21, 2024, 11:35am UTC](https://cern-ipmc-forum.web.cern.ch/t/i2c-dev-write-reg-0x0248-doing-a-read/301/9 "2024-02-21T11:35:51Z")

</div>

Hi Ralf,

Sorry, but several months lost just to succeed at one i2c read is not such a great achievement according to me…  
But thank you anyway !

Cheers,  
Sylvain

---

<div class="post-metadata">

**Author:** ![spiwoks](https://cern-ipmc-forum.web.cern.ch/letter_avatar_proxy/v4/letter/s/e19b73/32.png) [@spiwoks](https://cern-ipmc-forum.web.cern.ch/u/spiwoks)\
**Post date:** [February 21, 2024, 11:57am UTC](https://cern-ipmc-forum.web.cern.ch/t/i2c-dev-write-reg-0x0248-doing-a-read/301/10 "2024-02-21T11:57:26Z")

</div>

Hi Sylvain,

I am really sorry to hear about the time lost.

We will add a warning on the I2C addressing issue. If it helps we could also add pointers to the I2C documentation; there are also some pretty good tutorials on the web.

Cheers,

Ralf.

---

<div class="post-metadata">

**Author:** ![spiwoks](https://cern-ipmc-forum.web.cern.ch/letter_avatar_proxy/v4/letter/s/e19b73/32.png) [@spiwoks](https://cern-ipmc-forum.web.cern.ch/u/spiwoks)\
**Post date:** [February 21, 2024, 12:01pm UTC](https://cern-ipmc-forum.web.cern.ch/t/i2c-dev-write-reg-0x0248-doing-a-read/301/11 "2024-02-21T12:01:32Z")

</div>

E.g. here is a one I found helpful: [https://www.robot-electronics.co.uk/i2c-tutorial](https://www.robot-electronics.co.uk/i2c-tutorial)

Cheers,

Ralf
