cancel
Showing results for 
Search instead for 
Did you mean: 

Nextion Display Communication problems with CubeIDE

felino
Associate

 

Hello everyone,

for a project at the university i have to programming an nextion display with a stm32f401re or a stm32g474re. (i can choose between them, i have both here). My problem is that i have configurate the display with the nextion editor. There i can change the text and it works. When i use the stm32f401re, connect the tx from the display to the rx from the processor (D0) and the rx from the display to the tx from the processor(D1) and the 5v with 5v, GND with GND, then i don`t can change the values. In my programm, i write

HAL_UART_Transmit(&huart2, (uint8_t*)"t0.txt=\"Hello\"\xFF\xFF\xFF", sizeof("t0.txt=\"Hello\"\xFF\xFF\xFF"), 1000); HAL_Delay(1000);

When i use a logic analyzer on the pin tx, i see, that i get datas. Furthemore i looked at PuTTy. There i get the correct messages.

My baudrate is 9600 bps. in addition my clock settings are:

|Clock Source|HSE (8 MHz extern)|
|PLL Source|HSE|
|PLL_M|8|
|PLL_N|336|
|PLL_P|4|
|PLL_Q|7|
|System Clock (SYSCLK)|84 MHz|
|AHB Prescaler|1|
|APB1 Prescaler|2|
|APB2 Prescaler|1|
|UART Clock |42 MHz|

In addition i looked which signal level that display need. It need 3.3V. The stm32f401re had also an signal level of 3.3V. So this is also fine.

Now i have no idea what the problem is. Has anyone an idea?

3 REPLIES 3
TDK
Super User

If the UART signals show up correctly on the scope and in PuTTY, this is not an issue on the STM32 side. It could be miswired, or you are not sending the right commands, or some other hardware issue or misunderstanding.

If you feel a post has answered your question, please click "Accept as Solution".
Andrew Neil
Super User

@felino wrote:

When i use a logic analyzer on the pin tx, 


Which one - the STM32's TX, or the display's TX ?

 


@felino wrote:

i see, that i get datas. Furthemore i looked at PuTTy. There i get the correct messages.


Are you sure they're correct?

Have you used an oscilloscope to verify that the waveforms are at the correct levels, not noisy, etc?

Have you checked carefully against the Nextion documentation - including any timing requirements?

 

Do Nextion provide a PC test utility to verify that your display is actually working?

 

Have you contacted Nextion support?

https://nextion.tech/contact-us/

Show them your logic analyser & PuTTY traces and ask them to confirm that they are correct.

 

A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.
Andrew Neil
Super User

You haven't said what STM32 board(s) you're using, or exactly what "Nextion" display.

Please see:  How to write your question to maximize your chances to find a solution.

 

Some good, clear photos of your setup might help.

 

When describing connections, a diagram is clearer than words.

 

PS:


@felino wrote:

In my programm, i write

HAL_UART_Transmit( &huart2, (uint8_t*)"t0.txt=\"Hello\"\xFF\xFF\xFF", sizeof("t0.txt=\"Hello\"\xFF\xFF\xFF"), 1000 ); 
HAL_Delay(1000);

 


Please see How to insert source code for how to properly format code in a forum post.

The Nextion site says, "the peripheral MCU can easily update progress, and status back to Nextion display utilizing simple ASCII text-based instructions"  (my emphasis)

"ASCII text-based" would usually mean that you don't have hex values like \xFF in them - so are you sure that's correct?

AndrewNeil_0-1762199939220.png

https://nextion.tech/ 

A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.