Hello Matthew,

in theory it should be possible to use read / write together with some ioctls to set the address. But normally I would suggest to create i2c_msg structures for a finer grained control. Take a look at the i2cget command for a simple example hot to read from an EEPROM like device:

https://git.rtems.org/rtems/tree/cpukit/libmisc/shell/main_i2cget.c#n49

The i2c.h that gedare mentioned has some more details about the meaning of the fields:

https://git.rtems.org/rtems/tree/cpukit/include/dev/i2c/i2c.h

Best regards

Christian

On 12/02/2021 17:20, Gedare Bloom wrote:
the linux api is exported via cpukit/include/dev/i2c/i2c.h
the include path should be #include <dev/i2c/i2c.h>

I'm not aware of any good examples to follow. The embedded brains
folks have most experience working with it.

On Thu, Feb 11, 2021 at 8:51 AM Matthew J Fletcher <ami...@gmail.com> wrote:

Hi,

The ATSAM BSP has I2C support, but i am slightly unclear about the API that 
should be used to access it.

Using pread() & pwrite() seems to trigger assertions that look like memory 
corruption in atsam_i2c_bus.c

The linux I2C userspace API seems to be suggested, which looks like ioctrl(), 
but there is also a i2c_smbus_write_byte() type interface.



regards
---
Matthew J Fletcher

_______________________________________________
users mailing list
users@rtems.org
http://lists.rtems.org/mailman/listinfo/users
_______________________________________________
users mailing list
users@rtems.org
http://lists.rtems.org/mailman/listinfo/users

_______________________________________________
users mailing list
users@rtems.org
http://lists.rtems.org/mailman/listinfo/users

Reply via email to