cancel
Showing results for 
Search instead for 
Did you mean: 

I2C read is not working in latest spc5 studio 6.0, but the same code works in the old version spc5 studio. I don't know what to do.

Ypvt .1
Associate

Hello I'm sharan from yali mobilities. Here we are shifting from old spc5 studio to latest version spc5 studio 6.0. For testing I2C, I have used Arduino as a slave device. The programme which I have writen is attached as image. Arduino sends a inter value when an request event is occured. The programme runs in old spc5 studio, but it's not working in spc5 studio 6.0. I have used same configurations, setups and same board.

I have tried I2C write function it works properly for all the devices, which I have tested. If any one knows the solution kindly reply.

Thank you for reading.

0693W00000NqYnDQAV.png

1 ACCEPTED SOLUTION

Accepted Solutions
ODOUV.1
ST Employee

Hello,

would you please try with this fixed file and let us know ?

====patch====

@@ -619,8 +619,12 @@ static int i2c_hw_read(void *priv, uint8_t dev_addr, uint16_t reg_addr, uint8_t

  i2cd->i2c_tagp->IBCR.B.RSTA = 0x1;

  i2cd->i2c_tagp->IBCR.B.IIC_MS = (uint8_t)i2cd->mode;

  i2cd->i2c_tagp->IBCR.B.IIC_TX = 0x1;

- i2cd->i2c_tagp->IBDR.R = i2cd->dev_addr| I2C_HW_READ;

- i2cd->state = I2C_MASTER_READ_DUMMY_DATA;

+ if (reg_addr_size == I2C_16_BIT_REG_ADDRESS) {

+ i2cd->i2c_tagp->IBDR.R = i2cd->dev_addr;

+ } else {

+ i2cd->i2c_tagp->IBDR.R = i2cd->dev_addr| I2C_HW_READ;

+ i2cd->state = I2C_MASTER_READ_DUMMY_DATA;

+ }

  } else {

  /* In slave mode it reads until no data on the I2C bus */

  i2cd->i2c_tagp->IBAD.R = dev_addr;

=============

-Best regards,

-Olivier

View solution in original post

14 REPLIES 14
Erwan YVIN
ST Employee

Hello Sharan ,

Could you send me your installation details ?

I need the version of SPC5RLA used for your device

You can revert the drivers installation from 1.17.0 to 1.16.0 , 1.14.0.

0693W00000NqZ4JQAV.png Best Regards

Erwan

Yali Mobilities
Associate III

Could you tell me please, where can I find these details and I'm having SPC58EC80 disp board. Thank you

Could you tell me please, where can I find these details and I'm having SPC58EC80 disp board. Thank you

ODOUV.1
ST Employee

go to Menu Help-> About SPC5Studio

click on Installation Details

use Filter SPC58EC

0693W00000Nr0VMQAZ.png

Here I've attached the image. I checked for the update and it's upto date. Kindly look into it. Thank you.

0693W00000Nr58XQAR.png

ODOUV.1
ST Employee

Hello,

would you please try with this fixed file and let us know ?

====patch====

@@ -619,8 +619,12 @@ static int i2c_hw_read(void *priv, uint8_t dev_addr, uint16_t reg_addr, uint8_t

  i2cd->i2c_tagp->IBCR.B.RSTA = 0x1;

  i2cd->i2c_tagp->IBCR.B.IIC_MS = (uint8_t)i2cd->mode;

  i2cd->i2c_tagp->IBCR.B.IIC_TX = 0x1;

- i2cd->i2c_tagp->IBDR.R = i2cd->dev_addr| I2C_HW_READ;

- i2cd->state = I2C_MASTER_READ_DUMMY_DATA;

+ if (reg_addr_size == I2C_16_BIT_REG_ADDRESS) {

+ i2cd->i2c_tagp->IBDR.R = i2cd->dev_addr;

+ } else {

+ i2cd->i2c_tagp->IBDR.R = i2cd->dev_addr| I2C_HW_READ;

+ i2cd->state = I2C_MASTER_READ_DUMMY_DATA;

+ }

  } else {

  /* In slave mode it reads until no data on the I2C bus */

  i2cd->i2c_tagp->IBAD.R = dev_addr;

=============

-Best regards,

-Olivier

I have replaced those two lines with these condition lines. But it doesn't work. The result as I2C_ERROR_BUS_BUSY.

ODOUV.1
ST Employee

Hello,

would you please provide your structure:0693W00000NrVPeQAN.png

-Best regards

Olivier

Kindly look into it.

0693W00000NreyYQAR.png