cancel
Showing results for 
Search instead for 
Did you mean: 

st board=spc582b .salve device=24c128. read data 0xff , so i can not able to write and read, my result is WRITEDATA=S,ADDRS=0X50,A,SUBADDR=0X20,A,0X55,A0X66,A,S. READ DATA=S,ADDRS=0X50,A,SUBADDR=0X20,A,0XFF,A,0XFF,N,S.

Sal-a.1
Associate II

i have uploaded my main.c code.

This discussion has been locked for participation. If you have a question, please start a new topic in order to ask your question
1 ACCEPTED SOLUTION

Accepted Solutions
Sal-a.1
Associate II

thanks angelo,

in solved due to this changes

I2C_16_BIT_REG_ADDRESS changed before it is I2C_8_BIT_REG_ADDRESS

i2c_result_t i2c_lld_write(I2CDriver *i2cd, uint8_t dev_addr, uint16_t reg_addr, uint8_t *data, uint8_t ndata_bytes) {

 if (ndata_bytes == 0U) {

  return I2C_NO_ERROR;

 }

 /* Check for valid address */

 if ((dev_addr == 0U) || ((dev_addr & 1U) == 1U)) {

  return I2C_ERROR_INVALID_ADDRESS;

 }

 if (data == NULL) {

  return I2C_ERROR_INVALID_ARGUMENT;

 }

 return (i2cd->ops.write != NULL) ? i2cd->ops.write(i2cd->ops.priv, dev_addr, reg_addr, I2C_16_BIT_REG_ADDRESS, data, ndata_bytes) : I2C_ERROR_INVALID_ARGUMENT;

}

View solution in original post

2 REPLIES 2
Angelo Castello
Associate III

Good morning,

Could you please tell me if the original demo is or not working fine into your environment ?

Did you changed some configurations in term of I2C clock ?

If you are using the SPC582B-DISP

https://www.st.com/content/st_com/en/products/evaluation-tools/product-evaluation-tools/mcu-mpu-eval-tools/spc5-automotive-mcu-eval-tools/spc582b-dis.html

and the expansion board based on VL6180X

https://www.st.com/content/st_com/en/products/ecosystems/stm32-open-development-environment/stm32-nucleo-expansion-boards/stm32-ode-sense-hw/x-nucleo-6180xa1.html#documentation

they are totally pin compatible and then you should run the demo as it is without problem. Please confirm to me.

Let me know,

Regards, Angelo

Sal-a.1
Associate II

thanks angelo,

in solved due to this changes

I2C_16_BIT_REG_ADDRESS changed before it is I2C_8_BIT_REG_ADDRESS

i2c_result_t i2c_lld_write(I2CDriver *i2cd, uint8_t dev_addr, uint16_t reg_addr, uint8_t *data, uint8_t ndata_bytes) {

 if (ndata_bytes == 0U) {

  return I2C_NO_ERROR;

 }

 /* Check for valid address */

 if ((dev_addr == 0U) || ((dev_addr & 1U) == 1U)) {

  return I2C_ERROR_INVALID_ADDRESS;

 }

 if (data == NULL) {

  return I2C_ERROR_INVALID_ARGUMENT;

 }

 return (i2cd->ops.write != NULL) ? i2cd->ops.write(i2cd->ops.priv, dev_addr, reg_addr, I2C_16_BIT_REG_ADDRESS, data, ndata_bytes) : I2C_ERROR_INVALID_ARGUMENT;

}