Is my I2C sending properly ?
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-07-11 7: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");
}
Labels:
- Labels:
-
I2C
-
STM32F1 Series
This discussion is locked. Please start a new topic to ask your question.
2 REPLIES 2
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎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.
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Up vote any posts that you find helpful, it shows what's working..
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-07-15 10:58 PM
it did the command already, I sent a wrong address...suppose to be 7E
many thanks
