2020-06-13 02:08 AM
Hello
I have Nextion display. Ican control it with arduino library in Arduino ide good.
I am learning communication nextion without itead nextion library via uart.
I designed simply page in nextion. it has just a textbox named "t0".
I try send a word from STM32F103C8T6 , but i couldnt. This my code pls tell me what is wrong.I use STM32CubeIDE 1.3
Thanks for advance.
//texte gonderelim
//char com_giden[]="merhaba";
//int ix = 0;
// sprintf(com_giden,"Sayi: %d",ix++);
char dizi[]="t0.txt=\"dene\"";
HAL_UART_Transmit(&huart2,(uint8_t*)dizi,strlen(dizi),20);
// HAL_UART_Transmit(&huart2,(uint8_t*)com_giden,strlen(com_giden),20);
char bitis[]="0xff";
HAL_UART_Transmit(&huart2,(uint8_t*)0xff,strlen(0xff),20);
HAL_UART_Transmit(&huart2,(uint8_t*)0xff,strlen(0xff),20);
HAL_UART_Transmit(&huart2,(uint8_t*)0xff,strlen(0xff),20);
HAL_Delay(500);
2020-06-13 05:07 AM
You can't just cast 0xFF to a pointer, and do strlen() on it either.
Use
uint8_t ch = 0xFF;
HAL_UART_Transmit(&huart2, &ch,1, 20);
2020-06-13 05:48 AM
I set baud 115200 in nextion and st mcu. it is ok.
I try this code but issue is continious. I cant send any data display but i can send data to pc via uart .
What is my fault?
char dizi[]="t0.txt=\"dene\"\r\n";
HAL_UART_Transmit(&huart2,&dizi,strlen(dizi),50);
// HAL_UART_Transmit(&huart2,(uint8_t*)dizi,strlen(dizi),20); or i tried this line same result
uint8_t ch = 0xFF;
HAL_UART_Transmit(&huart2, &ch, 1, 20);
HAL_UART_Transmit(&huart2, &ch, 1, 20);
HAL_UART_Transmit(&huart2, &ch, 1, 20);
HAl_Delay(800);
2020-06-13 05:50 AM
is it possible , add Nextion library (for arduino) to STM32CubeIDE ?
2020-06-13 11:43 AM
You could probably port it if sufficiently motivated. Looks like it would be a bit of work.