Question
4 devices on I2C ?
Dear Members,
I have 4 devices on I2C 1, 2LCD s and 2 Sensors,
I tried to init 16x2 I2C LCD, it seems that it blocked all the process,
Is it because of 3.3V databus ? Does it need 5V databus?
HAL_StatusTypeDef LCD_SendInternal(uint8_t lcd_addr, uint8_t data, uint8_t flags) {
HAL_StatusTypeDef res;
printf("lcd addr:%X",lcd_addr);
for(;;) {
res = HAL_I2C_IsDeviceReady(&hi2c1, lcd_addr, 1, HAL_MAX_DELAY);
if(res == HAL_OK)
break;
}
uint8_t up = data & 0xF0;
uint8_t lo = (data << 4) & 0xF0;
uint8_t data_arr[4];
data_arr[0] = up|flags|BACKLIGHT|PIN_EN;
data_arr[1] = up|flags|BACKLIGHT;
data_arr[2] = lo|flags|BACKLIGHT|PIN_EN;
data_arr[3] = lo|flags|BACKLIGHT;
res = HAL_I2C_Master_Transmit(&hi2c1, lcd_addr, data_arr, sizeof(data_arr), HAL_MAX_DELAY);
HAL_Delay(LCD_DELAY_MS);
return res;
}
any clues ?thanks
