cancel
Showing results for 
Search instead for 
Did you mean: 

I2C-Mangling with STM32MP2 (i2c-stm32f7.c linux driver)

mb_tua
Associate

Hello,

I'm working with a STM32MP257D, which is using the I2C-driver "i2c-stm32f7.c" in the Linux kernel (compatible: st,stm32mp25-i2c). I'm using kernel version v6.6.78. 


I need to use I2C mangling, specifically I2C_M_NOSTART and I2C_M_STOP, to handle a receiving master scenario.

My specific situation: I'm communicating with a device that sends the length of the data payload in the third byte of the transmission. This means I need to:
1. Read the first 3 bytes to get the length information
2. Continue reading the remaining data without sending a STOP condition after the initial 3-byte read
3. Continue reading without sending a START condition when fetching the remaining data

Code Example:

struct i2c_msg xfer[2];
xfer[0].addr = addr;
xfer[0].flags = I2C_M_RD | I2C_M_STOP;
xfer[0].len = 0x03;
xfer[0].buf = buff;

ret = i2c_transfer(i2c->adapter, xfer[0], 1);

xfer[1].addr = addr;
xfer[1].flags = I2C_M_RD | I2C_M_NOSTART;
xfer[1].len = buff[2];
xfer[1].buf = &buff[3];

ret = i2c_transfer(i2c->adapter, xfer[1], 1);

Questions:
From investigating the driver I know that using I2C_M_STOP / I2C_M_NOSTART isn't supported.

- Is there an existing patch or workaround for this use case?
- Has anyone encountered a similar situation and found a solution?
- Is it even possible with this device?

Any guidance would be greatly appreciated!

Best regards

Manuel

0 REPLIES 0