Need help with I2C register access in bootloader

rahul.b.patel
Posts: 62
Joined: Wed Apr 19, 2017 6:35 am

Need help with I2C register access in bootloader

Postby rahul.b.patel » Tue Sep 25, 2018 6:26 am

Hello,
I have a requirement to use I2C in bootloader in master mode. As I2C driver is not added as component into bootloader, using I2C with low level registers is the only way to do it.
I have tried to configure I2C registers from TRM as below, but not getting success.
Can anyone point me out what am I missing in it.?

Code: Select all

gpio_matrix_out(15, I2CEXT0_SDA_OUT_IDX, 0,  0);       //set output signal for io_matrix
gpio_matrix_in (15, I2CEXT0_SDA_IN_IDX, 0);            //set input  signal for io_matrix
gpio_matrix_out(2, I2CEXT0_SCL_OUT_IDX, 0,  0);       //set output signal for io_matrix
gpio_matrix_in (2, I2CEXT0_SCL_IN_IDX, 0);            //set input  signal for io_matrix

DPORT_SET_PERI_REG_MASK(DPORT_PERIP_CLK_EN_REG, DPORT_I2C_EXT0_CLK_EN);	/*	enable clock	*/
DPORT_CLEAR_PERI_REG_MASK(DPORT_PERIP_RST_EN_REG, DPORT_I2C_EXT0_RST);

WRITE_PERI_REG(I2C_CTR_REG(0),0xff);
WRITE_PERI_REG(I2C_FIFO_CONF_REG(0),I2C_NONFIFO_EN);
WRITE_PERI_REG(I2C_SDA_HOLD_REG(0),10);
WRITE_PERI_REG(I2C_SCL_LOW_PERIOD_REG(0),14); 
WRITE_PERI_REG(I2C_SCL_HIGH_PERIOD_REG(0),14); 
WRITE_PERI_REG(I2C_SDA_SAMPLE_REG(0),10); 

/* command and data write */
WRITE_PERI_REG(I2C_COMD0_REG(0), 0x00);	/* start */
WRITE_PERI_REG(I2C_COMD1_REG(0), 0x803);	/* write	*/
WRITE_PERI_REG(I2C_DATA_APB_REG(0), 0x20 << 1 | 0);	/*	slave address with write	*/
WRITE_PERI_REG(I2C_DATA_APB_REG(0), 0x07);	/*	data  */
WRITE_PERI_REG(I2C_DATA_APB_REG(0), 0x00);	/* data	*/
WRITE_PERI_REG(I2C_COMD2_REG(0), 0x1800);		/* stop	*/
Can anyone help what am I missing in it.? Or if there is any other way to use i2c_driver.c directly in bootloader.

Thanks.

rahul.b.patel
Posts: 62
Joined: Wed Apr 19, 2017 6:35 am

Re: Need help with I2C register access in bootloader

Postby rahul.b.patel » Wed Sep 26, 2018 3:53 am

Hello Guys,
Can any body help me with this.?

Thanks.

rahul.b.patel
Posts: 62
Joined: Wed Apr 19, 2017 6:35 am

Re: Need help with I2C register access in bootloader

Postby rahul.b.patel » Mon Oct 01, 2018 3:46 am

Hello Guys,
Can you please look above configurations if I am missing anything.?

Thanks.

Soloxxx666
Posts: 1
Joined: Mon Mar 25, 2019 7:29 pm

Re: Need help with I2C register access in bootloader

Postby Soloxxx666 » Mon Mar 25, 2019 7:31 pm

Hi Raul,
I'm having the same problem. Did you manage to resolve this?

Best.

rahul.b.patel
Posts: 62
Joined: Wed Apr 19, 2017 6:35 am

Re: Need help with I2C register access in bootloader

Postby rahul.b.patel » Tue Mar 26, 2019 4:01 am

Soloxxx666 wrote:
Mon Mar 25, 2019 7:31 pm
Hi Raul,
I'm having the same problem. Did you manage to resolve this?

Best.
Hello,
No I dropped this and skipped to make any changes in bootloader it self, so did not check anything further in this.

Who is online

Users browsing this forum: No registered users and 338 guests