I am trying to develop device with i2c modules. Unfortunatelly my PHY6222 does not comunicate with any module. There is no activity on SCL and SDA lines.
My code:
hal_i2c_pin_init(I2C_1, P1, P0);
void* i2c_inst_main = hal_i2c_init(I2C_1,I2C_CLOCK_100K);
uint8_t address;
int err_code = 0;
uint8_t sample_data = 0;
bool detected_device = false;
LOG_DEBUG("TWI scanner started.");
for (address = 1; address <= 127; address++) {
err_code = hal_i2c_read(i2c_inst_main, address, 0x01, &sample_data, sizeof(sample_data));
if (sample_data != PPlus_SUCCESS) {
detected_device = true;
LOG_DEBUG("\r\nDevice detected at address 0x%x.\r\n", address);
}
else{
LOG_DEBUG("Error: %d at 0x%x.\r\n", err_code, address);
}
}
if (!detected_device) {
LOG_DEBUG("\r\nNo device was found.\r\n");
}
LOG_DEBUG("TWI device scan ended.");
My code is in function called from osalInitTasks(void).
In result I get error 13 (PPlus_ERR_TIMEOUT) for all I2C address.
I use bleUart_at example. I add i2c.h import, and i add i2c.c file to project.
There is no difference between: I2C_1 and I2C_0, clock: I2C_CLOCK_100K and I2C_CLOCK_400K does not change anything.
These pins aren't use by me to any other tasks.
I try also pins P18 and P20 and thats the same. Pins are only pull up by PHY6222.
I use PHY6222 board V1.7 and self solded board, there are no differences.
Resistors don't make any difference.