[riot-notifications] [RIOT-OS/RIOT] i2c_read_regs / i2c_write_regs and endianess (#11544)

Federico Pellegrin notifications at github.com
Sun May 19 15:22:42 CEST 2019


@keestux : many thanks for checking this out! I don't have indeed much practice with I2C so that's why I was very cautious on this before doing a PR or so :) 

In my case the device is an ST EEPROM model M24C64, you can find the datasheet [here](https://www.st.com/resource/en/datasheet/m24c64-f.pdf). The datasheet indeed is not so very explicit about ordering, but it mentions in 5.1 first the most significant address byte. Indeed by using it the other way around then I get into wraparound problems as mentioned.

One more similar chip I found from Microchip, [datasheet here](http://ww1.microchip.com/downloads/en/DeviceDoc/21754M.pdf) also uses the most significant byte first and here it's explicitly seen in figure 6-1.

I've searched a bit around and found a couple of examples and they were usually using big endianess for such memories, but indeed also found for example [here](https://www.raspberrypi.org/forums/viewtopic.php?t=122923) a mention that it may purely depend on the device (in this case is the data, not the address).

I wonder if _registers_ are not in the I2C specs and are device dependant, then how "useful" are the `_reg_` functions? Or maybe we could put a big fat warning in the doc.



-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/issues/11544#issuecomment-493757070
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190519/6e4049d4/attachment.html>


More information about the notifications mailing list