2019-07-11 07:00 PM
Dear Members,
Is my I2C at STM32F107 sending properly ?
void lcd_send_cmd (char cmd)
{
char data_u, data_l;
uint8_t data_t[4];
data_u = (cmd&0xf0);
data_l = ((cmd<<4)&0xf0);
data_t[0] = data_u|0x0C; //en=1, rs=0
data_t[1] = data_u|0x08; //en=0, rs=0
data_t[2] = data_l|0x0C; //en=1, rs=0
data_t[3] = data_l|0x08; //en=0, rs=0
HAL_I2C_Master_Transmit (&hi2c1, SLAVE_ADDRESS_LCD,(uint8_t *) data_t, 4, 100);
}
void lcd_init (void)
{
lcd_send_cmd (0x02);
lcd_send_cmd (0x28);
lcd_send_cmd (0x0c);
lcd_send_cmd (0x80);
printf("LCD Init DONE!\r\n");
}
2019-07-11 11:20 PM
I'm not unpacking this for you.
Start with one transaction. Make sure the I2C IO Expander is responding with an ACK.
Once you know the IO Expander is responding, send bit patterns to it, and test the corresponding pins on the chip itself.
2019-07-15 10:58 PM
it did the command already, I sent a wrong address...suppose to be 7E
many thanks