Skip to main content
FLine.1
Associate II
June 13, 2020
Question

Nextion Communication issue

  • June 13, 2020
  • 4 replies
  • 2599 views

0693W000001qeRtQAI.pngHello

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);

This topic has been closed for replies.

4 replies

Tesla DeLorean
Guru
June 13, 2020

You can't just cast 0xFF to a pointer, and do strlen() on it either.

Use

uint8_t ch = 0xFF;

​H​AL_UART_Transmit(&huart2, &ch,1, 20);

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
FLine.1
FLine.1Author
Associate II
June 13, 2020

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);

0693W000001qeYVQAY.png

FLine.1
FLine.1Author
Associate II
June 13, 2020

is it possible , add Nextion library (for arduino) to STM32CubeIDE ?

https://github.com/itead/ITEADLIB_Arduino_Nextion

Tesla DeLorean
Guru
June 13, 2020

You could probably port it if sufficiently motivated. Looks like it would be a bit of work.

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..