cancel
Showing results for 
Search instead for 
Did you mean: 

STM32U535RET6 and LCD I2C communication

Zer0
Associate II

Hello!
I have a major and pretty dumb problem regarding my communication between a RX2004A LCD (Documentation if needed) and a custom board with a STM32U535RET6 chipset. I'm just trying to print any message on the display. The problem is that the display's reset pin is low active, so I'm trying to pull it up while sending the message, and the let it pull down again. The exact opposite happens, the message is sent in the time interval when the reset pin is pulled down, resetting the display while I'm trying to communicate. 

I have attached down below the scripts (lcd_i2c.h being here, since I can't attach more than 3 files) that I'm using and some screenshots that illustrate the problem. I'm apologizing in advance if I chose the wrong board to post this on, or if this issue was already solved. I'm genuinely at the end of the line at this moment.

 

 

 

 

 

/*

* lcd_i2c.h

*

* Created on: Aug 22, 2024

*/



#ifndef LCD_I2C_H

#define LCD_I2C_H



#include "stm32u5xx_hal.h"



// I2C's address

#define LCD_ADDRESS 0x49 << 1



// LCD commands

#define LCD_CLEAR_DISPLAY 0x01

#define LCD_RETURN_HOME 0x02

#define LCD_ENTRY_MODE_SET 0x04

#define LCD_DISPLAY_CONTROL 0x08

#define LCD_CURSOR_SHIFT 0x10

#define LCD_FUNCTION_SET 0x20

#define LCD_SET_CGRAM_ADDR 0x40

#define LCD_SET_DDRAM_ADDR 0x80



// Display control

#define LCD_DISPLAY_ON 0x04

#define LCD_CURSOR_ON 0x02

#define LCD_BLINK_ON 0x01



// Display function

#define LCD_8BIT_MODE 0x10

#define LCD_2LINE_MODE 0x08

#define LCD_5x10DOTS_MODE 0x04



void LCD_Init(I2C_HandleTypeDef *hi2c);

void LCD_SendCommand(I2C_HandleTypeDef *hi2c, uint8_t cmd);

void LCD_SendData(I2C_HandleTypeDef *hi2c, uint8_t data);

void LCD_SendString(I2C_HandleTypeDef *hi2c, char *str);



#endif

 

 

 

 

4 REPLIES 4
Andrew Neil
Evangelist III

@Zer0 wrote:

RX2004A LCD


Please give a datasheet/specification link for that

 


@Zer0 wrote:

display's reset pin is low active, so I'm trying to pull it up while sending the message, and the let it pull down again. It does the exact opposite, it send the message in the time interval when the reset


Please show your schematic for that

 


@Zer0 wrote:

 It does the exact opposite,


What are you referring to as "it" here ?

 

Please see the posting tips - in particular, how to properly post source code:

https://community.st.com/t5/community-guidelines/how-to-write-your-question-to-maximize-your-chances-to-find-a/ta-p/575228

 

Thanks for the advice!

TDK
Guru

> The problem is that the display's reset pin is low active, so I'm trying to pull it up while sending the message, and the let it pull down again. The exact opposite happens, the message is sent in the time interval when the reset pin is pulled down, resetting the display while I'm trying to communicate. 

So make the pin high at the start of your program and leave it alone. Your code sets it low (i.e. RESET) at initialization, I don't see any code which makes it high.

If you feel a post has answered your question, please click "Accept as Solution".
Zer0
Associate II

Managed to pull the RESET pin high. My problem now is that almost every message is a framing error on SCL.

 

\x1C\x1C\x1C\x1C\x1C\xFE\x1C\x1C\x1C\x1C\x1C\xFEwrite to 0x49 ack data: 0x4D 0x49 0x8D 0x89
write to 0x49 ack data: 0x6D 0x69 0x5D 0x59
write to 0x49 ack data: 0x6D 0x69 0xCD 0xC9
write to 0x49 ack data: 0x6D 0x69 0xCD 0xC9
write to 0x49 ack data: 0x6D 0x69 0xFD 0xF9
write to 0x49 ack data: 0x2D 0x29 0x0D 0x09
write to 0x49 ack data: 0x7D 0x79 0x7D 0x79
\x1C\x1C\x1C\x1C\x1C\xFE\x1C\x1C\x1C\x1C\x1C\xFE\x1C\x1C\x1C\x1C\x1C\xFE\x1C\x1C\x1C\x1C\x1C\xFE\x1C\x1C\x1C\x1C\x1C\xFE\x1C\x1C\x1C\x1C\x1C\xFE\x1C\x1C\x1C\x1C\x1C\xFEwrite to 0x49 ack data: 0x6D 0x69 0xFD 0xF9
write to 0x49 ack data: 0x7D 0x79 0x2D 0x29
write to 0x49 ack data: 0x6D 0x69 0xCD 0xC9
write to 0x49 ack data: 0x6D 0x69 0x4D 0x49
write to 0x49 ack data: 0x2D 0x29 0x1D 0x19
\x1C\x1C\x1C\x1C\x1C\xFE\x1C\x1C\x1C\x1C\x1C\xFE\x1C\x1C\x1C\x1C\x1C\xFCwrite to 0x49 ack data: 0x4D 0x49 0x8D 0x89
write to 0x49 ack data: 0x6D 0x69 0x5D 0x59
write to 0x49 ack data: 0x6D 0x69 0xCD 0xC9
write to 0x49 ack data: 0x6D 0x69 0xCD 0xC9
write to 0x49 ack data: 0x6D 0x69 0xFD 0xF9
\x1C\x1C\x1C\x1C\x1C\xFC\x1C\x1C\x1C\x1C\x1C\xFC\x1C\x1C\x1C\x1C\x1C\xFC\x1C\x1C\x1C\x1C\x1C\xFE\x1C\x1C\x1C\x1C\x1C\xFC\x1C\x1C\x1C\x1C\x1C\xFE\x1C\x1C\x1C\x1C\x1C\xFE\x1C\x1C\x1C\x1C\x1C\xFE\x1C\x1C\x1C\x1C\x1C\xFE\x1C\x1C\x1C\x1C\x1C\xFCwrite to 0x49 ack data: 0x2D 0x29 0x0D 0x09
write to 0x49 ack data: 0x7D 0x79 0x7D 0x79
write to 0x49 ack data: 0x6D 0x69 0xFD 0xF9
write to 0x49 ack data: 0x7D 0x79 0x2D 0x29
write to 0x49 ack data: 0x6D 0x69 0xCD 0xC9
write to 0x49 ack data: 0x6D 0x69 0x4D 0x49
write to 0x49 ack data: 0x2D 0x29 0x1D 0x19
\x1C\x1C\x1C\x1C\x1C\xFE\x1C\x1C\x1C\x1C\x1C\xFC