Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Tap on the LCD does not respond

Status
Not open for further replies.
We're going to need a lot more info than that!

So! the sketch worked on the Arduino but not on the STM32? Same sketch? Was it compiled for the STM32?

Have you installed the JSON for the STM32?
No, I don't have JSON installed on the STM32.
The STM32 and Arduino are basically connected to the display in the same way, via 8pin lines to DIN DOUT GND, and VIN.
Here is the connection diagram of the display and Arduino:
arduino connection diagram.jpg

Here is the connection diagram of the display and STM32:
STM32 connection diagram.JPG
 
My LCD is 12v power supply, Arduino through USB is 5v power supply, stm32 because there is a DCDC chip can be 12v power supply.
 
I know what the reason is, it's because when I use Arduino I solder the interface to the TTL interface, but STM32 is using the RS232 interface.
 
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 , 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
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top