i2c

Reading multiple bytes using I2C in U-Boot

ぃ、小莉子 提交于 2020-01-02 06:55:11
问题 I am having a problem with the I2C driver for a Freescale p1022tw board. There is a command on U-Boot's console to read from an I2C device: i2c md chip address[.0, .1, .2] [# of objects] When I read 4 bytes from a device with id 0x60, at address 0x0, I get: tw=>i2c md 60 0 4 0000: 45 45 45 45 EEEE These values that it returned are wrong. I can get the right values if I read one byte at the time: tw=>i2c md 60 0 1 0000: 45 E tw=>i2c md 60 1 1 0001: 45 E tw=>i2c md 60 2 1 0002: 46 F tw=>i2c md

Probe problem when writing a I2C device driver

不羁岁月 提交于 2020-01-02 03:49:11
问题 I am a newbie in writing linux device driver, forgive me if anything stupid a asked and my poor English^^ I am trying to write a driver for a touch panel, which communicate with CPU via I2C. I tried to add a device driver into linux platform, and the register was success, I mean the driver was loaded, but the probe function didn't fired up!! Above is partial code of the driver i wrote. static int i2c_ts_probe(struct i2c_client *client, const struct i2c_device_id * id) { /* ... */ } static int

Why I2C_SMBUS_BLOCK_MAX is limited to 32 bytes?

青春壹個敷衍的年華 提交于 2020-01-01 03:29:06
问题 I'm trying to configure a SAA6752HS chip (a MPEG-2 encoder) through I2C bus using a Raspberry Pi as a development kit. It was a piece of cake until I had to write at the address 0xC2 of the chip. For this task, I have to use an I2C command that expects a payload of size 189 bytes. So then I stumbled upon a 32 bytes limitation inside the I2C driver, defined by I2C_SMBUS_BLOCK_MAX, in /usr/include/linux/i2c.h. It is not possible to force different values of max limit. Everything around I2C lib

I2C addresses > 63 are not usable with atTiny85

时光怂恿深爱的人放手 提交于 2019-12-25 04:37:52
问题 Hi I have a big problem with addressing multiple attiny85-chips with I2C: For what I know the attiny uses 7-bit addresses for communication. I am using the TinyWireS lib, which works perfectly fine for me, untill I am reaching address: '64' which is '1000000' in binary. The highest usable address should be '1111111'. This is what happens: Slave: Attiny85: switches led on or off when msg is received over I2C. Slaveaddress: 64 #include <TinyWireS.h> #include <usiTwiSlave.h> #define output (4)

Linux: Instantiate from user-space : eeprom new_device

五迷三道 提交于 2019-12-25 03:49:10
问题 Environment : x86 / Ubuntu 14.04 I want obtain something similar to &i2c0 { eeprom: eeprom@50 { compatible = "at,24c32"; reg = <0x50>; }; }; But because in x86 no Device Tree is available, I am follow i2c/instantiating-device document in the Linux kernel and use "Method 4: Instantiate from user-space". Process to instantiate: Load at24 driver Load i2c-dev driver Instantiate: # echo eeprom 0x50 > /sys/bus/i2c/devices/i2c-0/new_device Response from kernel in dmesg: i2c i2c-0: new_device:

Integrate readings from a 3 axis Gyroscope?

狂风中的少年 提交于 2019-12-24 17:26:24
问题 So I have written a program in C to print values of 3 axis gyro at a very high data rate. The values are instantaneous values of angular speed that rise on movement and fall if the device is still. I need it to hold the high values and come back to zero when returned to position. If I integrate the values over a fixed sample time, would I achieve this? How do I go about integrating? I am a beginner in C programming. Thank you 回答1: Angular velocity is: ω = Δφ/Δt = (φ n − φ n−1 )/(t n − t n−1 )

Read byte fails on Raspberry Pi 3: [errno 5] input/output error

坚强是说给别人听的谎言 提交于 2019-12-24 09:57:42
问题 I have adafruit pressure and temperature sensor BMP180 connected to I2C of Raspberry Pi 3. The device is detected on 0x77 address of I2C, i2cdump runs with no error and shows correct values (e.g. byte 0x55 in 0xD0 as described in Bosch documentation). But reading a byte in most cases results in input/output error. pi@raspberrypi:~ $ i2cdetect -y 1 0 1 2 3 4 5 6 7 8 9 a b c d e f 00: -- -- -- -- -- -- -- -- -- -- -- -- -- 10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 20: -- -- -- -- -- -

C i2c chip reading MCP9800 suddenly starts failing

只愿长相守 提交于 2019-12-24 05:34:15
问题 I have some code: #define AMB_LSB 0.0625 void Ambient::read() { uint32_t raw; float filtered; uint8_t bytes = 2; uint8_t buf[bytes]; if(i2c_smbus_read_i2c_block_data(i2c_bus_address, A_TEMP_REG, bytes, buf) < 0) printf("AMB Block Read Failed\n"); uint32_t va = buf[0]; uint32_t vb = buf[1]; uint32_t result = ((va<<8)+vb); // 12-bit code raw = result >> 4; filtered = filter.execfilter( raw ); temperature = filtered * AMB_LSB; << CALCULATION printf("AMB buffers %d %d -> result %d -> raw %d ->

TI TivaC Launchpad I2C Errors

假如想象 提交于 2019-12-24 04:55:09
问题 I am trying to communicate over I2C with a Pololu MinIMU9v2 from a TM4C123GXL Launchpad , but every time I try to write to the bus, I am getting I2C_MASTER_ERR_ADDR_ACK and I2C_MASTER_ERR_DATA_ACK . Printing out the slave address shows that it looks right, so I'm thinking this may be something I may be doing wrong with the use of the TI Launchpad driver library. Here's the initialization routine: void InitI2CBus(void) { // Initialize the TM4C I2C hardware for I2C0 SysCtlClockSet(SYSCTL_SYSDIV

Reading motherboard sensors with Java Device I/O

♀尐吖头ヾ 提交于 2019-12-24 00:48:31
问题 OpenJDK has the Device I/O (DIO) library, which can be used to read hardware sensors. One supported bus in the DIO library is I2C. I have heard that desktop motherboard sensors are behind SMBus, basically a more restricted version of the I2C bus. Can I use DIO to read sensor data from my motherboard - for example, the CPU temperature? If so, how? 来源: https://stackoverflow.com/questions/42539556/reading-motherboard-sensors-with-java-device-i-o