-
Categories
-
Platforms
-
Content
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.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
Resize to < 300 kB.I can't insert a photo here and I can't upload my connection picture.
Sorry the picture is very blurry after compression, my STM32 model is stm32f030f4I can't read the type of STM board from these images.
That's the part number of the controller, not the board.my STM32 model is stm32f030f4
.The printed markings may differ depending on the supply chain.
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.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.
You cannot use an RS232 with TTL logic level. RS232 has vastly different voltages.my LCD is an RS232 interface
At the beginning of everything, there is the initialization code, GPIO initialization, and so on, through which you can change the TTL or RS232.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.
Makes no sense at all. Your circuit diagram of the STM board shows no RS-232 interface.through which you can change the TTL or RS232.
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);
}
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
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.interface of the LCD is still TTL at this time, then I need to change it by initialization.