Maker Pro
Maker Pro

Tap on the LCD does not respond

I made a project to implement it on LCD through both Arduino and STM32, but after I use Arduino, there is no response when I connect to STM32 to click, what is going on?
 

Harald Kapp

Moderator
Moderator
What logic levels does the LCD use? 3.3 V or 5 V?
The STM32 uses 3.3 V, the Arduino uses 5 V. If the LCD has a 3.3 V interface, you may have destroyed it by applying 5 V from the Arduino :(
 
What logic levels does the LCD use? 3.3 V or 5 V?
The STM32 uses 3.3 V, the Arduino uses 5 V. If the LCD has a 3.3 V interface, you may have destroyed it by applying 5 V from the Arduino :(
The logic level used for my LCD is TTL, the Arduino uses USB power, and I think the STM32 is using 12v power. There is a DCDC chip on the board.
I can't insert a photo here and I can't upload my connection picture.
 
Last edited:

Harald Kapp

Moderator
Moderator
I can't insert a photo here and I can't upload my connection picture.
Resize to < 300 kB.
The LCD uses 5 V TTL signal levels. If your STM32 board doesn't use level shifters, the defect may be on the STM32 board. Applying 5 V TTL signals to a 3.3 V input may destroy that input. Please tell us which STM32 board you use. There may be level shifters or not.
 
FOVOBLWKQQMUYQZ.jpg

FDN99UVKQQMUYR0.jpg
 

Harald Kapp

Moderator
Moderator
Not the chip, the board.
STM32F030F4 is the part number of the controller (chip).
A chip of the type CKS32F303 can't be found. Is this the inscription on the chip? Then it is only an indication of the type. The datasheet states
The printed markings may differ depending on the supply chain.
.

You're using a kind of demo board or eval board. This surely has a part number/name of its own. like e.g. this one or one of these.
Alternatively look up the interface description of your board in the manual to find out whether it is TTL (5 V) compatible or 3.3 V compatible.
 
Not the chip, the board.
STM32F030F4 is the part number of the controller (chip).
A chip of the type CKS32F303 can't be found. Is this the inscription on the chip? Then it is only an indication of the type. The datasheet states .

You're using a kind of demo board or eval board. This surely has a part number/name of its own. like e.g. this one or one of these.
Alternatively look up the interface description of your board in the manual to find out whether it is TTL (5 V) compatible or 3.3 V compatible.
I looked carefully and found that my interface is not connected correctly, my LCD is an RS232 interface by default, when I use Arduino I solder it as an TTL interface, my STM32 should be using RS232 interface, I did not connect the adapter board, so it may lead to no response when connecting STM32.
 

Harald Kapp

Moderator
Moderator
my LCD is an RS232 interface
You cannot use an RS232 with TTL logic level. RS232 has vastly different voltages.
TTL: Low = 0 V - 0.8 V, High = 2.7 V - 5 V
RS232: Low = -3 V - - 25 V, High = +3 V - + 25 V
See also the datasheet of the LCD:
upload_2021-7-7_6-32-26.png
The LCD has the appropriate interface chip on board:
upload_2021-7-7_6-33-23.png
If you use the RS-232 (J3) you absolutely need to use an interface board RS-232 <> 3.3 V logoc level to connect to the STM32. Otherwise the high voltages on the RS-232 interface will destroy your STM32 board.
Or don't use the RS-232 at all but the serial interface (D1, D4) which uses a UART protocol but TTL levels. You'll still need a 5 V <> 3.3 V logic level converter to use the 5 V interface of the LCD with the 3.3 V interface of the STM32 board.

Since you refuse to give more information on the specific STM32 board you are using I cannot provide more information or help.
 
Sorry for the somewhat late reply, I've posted the circuit diagram as an attachment.
 

Attachments

  • designer.pdf
    118.6 KB · Views: 2

Harald Kapp

Moderator
Moderator
Obviously this board has no level shifters. Thus the interface is 3.3 V only. You cannot connect it to the LCD without either
- a 3.3 V to 5 V level shifter when using he TTL interface of the LCD
- an RS-232 interface when using the RS-232 interface of the LCD.
When you connected the STM32's Rx and TX line to the LCD's RS-232 interface without the required converter, chances are your STM is no defect due to overvoltage on the interface pins.
 

Harald Kapp

Moderator
Moderator
No. You can't convert 3.3 V to 15 V by code. Impossible.
You can invert logic levels 1 -> 0 or 0 -> 1 by code, but not the physical voltages.
 
Last edited:
No. You can't convert 3.3 V to 15 V by code. Impossible.
You can invert logic levels 1 -> 0 or 0 -> 1 by code, but not the physical voltages.
At the beginning of everything, there is the initialization code, GPIO initialization, and so on, through which you can change the TTL or RS232.
 

Harald Kapp

Moderator
Moderator
through which you can change the TTL or RS232.
Makes no sense at all. Your circuit diagram of the STM board shows no RS-232 interface.
upload_2021-7-7_12-42-44.png
DIN and DOUT are directly connected to the CPU's UART1_TX and UART1_RX. This is a 3.3. V logic UART interface, not an RS-232 interface.

You can't do that, by the way, on the Arduino either. The Arduino's UART interface is also TTL only.
 
My arduino is fine because I changed the interface on the LCD to TTL when I used the arduino. when I use the same LCD to connect to the STM32, the interface of the LCD is still TTL at this time, then I need to change it by initialization.
Calls the hal library, which is a structure for uart advanced initialization and corresponds to assigning values to each of the structure's members.
The following is part of the code that defines the uart

Code:
void
MX_USART1_UART_Init(void)
{
UART1_Handler.Instance = USART1;
UART1_Handler.Init.BaudRate = 115200;
UART1_Handler.Init.WordLength = UART_WORDLENGTH_8B;
UART1_Handler.Init.StopBits = UART_STOPBITS_1;
UART1_Handler.Init.Parity = UART_PARITY_NONE;
UART1_Handler.Init.Mode = UART_MODE_TX_RX;
UART1_Handler.Init.HwFlowCtl = UART_HWCONTROL_NONE;
UART1_Handler.Init.OverSampling = UART_OVERSAMPLING_16;
UART1_Handler.Init.OneBitSampling = UART_ONE_BIT_SAMPLE_DISABLE;
// Advanced initialization options for the serial port, the mask is off by default
// UART1_Handler.AdvancedInit.AdvFeatureInit = UART_ADVFEATURE_TXINVERT_INIT|UART_ADVFEATURE_RXINVERT_INIT
// |UART_ADVFEATURE_DATAINVERT_INIT|UART_ADVFEATURE_SWAP_INIT;
// UART1_Handler.AdvancedInit.TxPinLevelInvert = UART_ADVFEATURE_TXINV_ENABLE;
// UART1_Handler.AdvancedInit.RxPinLevelInvert = UART_ADVFEATURE_RXINV_ENABLE;
// UART1_Handler.AdvancedInit.DataInvert = UART_ADVFEATURE_DATAINV_DISABLE;
//// UART1_Handler.AdvancedInit.Swap = UART_ADVFEATURE_SWAP_ENABLE;
HAL_UART_Init(&UART1_Handler);
}
void
MX_USART1_UART_Init2(void)
{
UART1_Handler.Instance = USART1;
UART1_Handler.Init.BaudRate = 115200;
UART1_Handler.Init.WordLength = UART_WORDLENGTH_8B;
UART1_Handler.Init.StopBits = UART_STOPBITS_1;
UART1_Handler.Init.Parity = UART_PARITY_NONE;
UART1_Handler.Init.Mode = UART_MODE_TX_RX;
UART1_Handler.Init.HwFlowCtl = UART_HWCONTROL_NONE;
UART1_Handler.Init.OverSampling = UART_OVERSAMPLING_16;
UART1_Handler.Init.OneBitSampling = UART_ONE_BIT_SAMPLE_DISABLE;
// Advanced initialization options for the serial port, the mask is off by default
UART1_Handler.AdvancedInit.AdvFeatureInit = UART_ADVFEATURE_TXINVERT_INIT|UART_ADVFEATURE_RXINVERT_INIT
|UART_ADVFEATURE_DATAINVERT_INIT|UART_ADVFEATURE_SWAP_INIT;
UART1_Handler.AdvancedInit.TxPinLevelInvert = UART_ADVFEATURE_TXINV_ENABLE;
UART1_Handler.AdvancedInit.RxPinLevelInvert = UART_ADVFEATURE_RXINV_ENABLE;
UART1_Handler.AdvancedInit.DataInvert = UART_ADVFEATURE_DATAINV_DISABLE;
//UART1_Handler.AdvancedInit.Swap = UART_ADVFEATURE_SWAP_ENABLE;
HAL_UART_Init(&UART1_Handler);
}

Here is the part code to be called in the main function

Code:
int main(void)
{
uint8_t color_buf = 0;
//Function Selection
/* Reset of all peripherals, Initializes the Flash interface and the Systick. */
HAL_Init();
/* Configure the system clock */
SystemClock_Config();
/* Initialize all configured peripherals */
MX_GPIO_Init();
TX_Mode = HAL_GPIO_ReadPin(GPIOA,GPIO_PIN_4);
if(TX_Mode)
MX_USART1_UART_Init();
//232 Initialization
else
MX_USART1_UART_Init2();
//TTl Initialization
 

Harald Kapp

Moderator
Moderator
interface of the LCD is still TTL at this time, then I need to change it by initialization.
You can't do that in software. The hardware of the STM32 is 3.3 V compatible while the LCD's TTL interface is 5 V. No code can change that, whatever you try to initialize.
 
Top