Able to get register ack from slave ! Finally !

i2c
kerem 3 years ago
parent 68da9734e1
commit f708b410a9

@ -116,10 +116,6 @@ void i2cMasterRecieve(i2c_t *i2cHardware, uint8_t devAddress, uint8_t registerAd
//Set Buffer size
I2C_BASE->CR2 |= 1 << I2C_CR2_NBYTES_Pos;
//Check if the TX buffer is empty
while(!(I2C_BASE->ISR & (I2C_ISR_TXE)));
//Register to be sent
I2C_BASE->TXDR |= 0xCE;
//Generate start condition
I2C_BASE->CR2 |= I2C_CR2_START;
@ -127,8 +123,12 @@ void i2cMasterRecieve(i2c_t *i2cHardware, uint8_t devAddress, uint8_t registerAd
//Wait until the start condition in generated.
while(!(I2C_BASE->ISR & (I2C_ISR_BUSY)));
//Check if the TX buffer is empty
while(!(I2C_BASE->ISR & (I2C_ISR_TXE)));
//Register to be sent
I2C_BASE->TXDR |= 0xf0;
//while(!(I2C_BASE->ISR & (I2C_ISR_RXNE)));
while(!(I2C_BASE->ISR & (I2C_ISR_RXNE)));
i2cCR1= I2C_BASE->CR1;
i2cCR2= I2C_BASE->CR2;

Loading…
Cancel
Save