Start a new topic

MCU Return Data does not match Simulator

I have created a slider (h0) that outputs the values from 0 to 10.

The simulator output is correct - the output is 0x00 to 0x0a for 0 to 10.

However the User MCU Return data is not correct (see example below).  Ignoring the housekeeping bits, what is output on the simulator monitor (which agrees with the output of a terminal monitor) for the numbers 0 to 10 is as follows:

FF 7F BF 7E DF 7D BE 7C EF 7B BD


image


I have tried to decipher these numbers by standing on my head, looking in a mirror, translating from ASCII, big endian, little endian, invert... I got 'nothin.


The hex values are real.  Any ideas on why this is happening and how to decipher?


FWIW this is 4.3" Basic display, editor V0.48 (but that shouldn't matter because a terminal monitor produces the same results).


0x0A is 10.  Nextion Simulator Return Data is printing '10' to the MCU

But why is your MCU sending 0xBD 0xFF 0xFF 0x00 is MCU side code.

image



I am connecting to the Nextion from my PC with a serial to USB cable.  DB9 pin 2 (Rx) is connected to Nextion blue wire (Tx).  DB9 pin 3 (Tx) is connected to Nextion yellow wire (Rx).


To confirm the assertion that the data is coming FROM the PC to the Nextion, I disconnected the yellow wire (Rx) from the Nextion.  Now, if the data is coming from the PC, it is NOT going to get to the Nextion.


The result is the same as previously reported - both the Terminal monitor on my PC and the "User MCU Return Data" are seeing FF 7F BF 7E DF 7D BE 7C EF 7B BD for the numbers 0 to 10.  What I would EXPECT to see is 00, 01, 02, 03, 04, 05, 06, 07, 08, 09, 0A.


What am I missing?

Sorry, your details are too less clear to make sense of.

 - what serial to USB

 - DB9 ? ... generally not for 5V TTL devices, but anything can use a DB9

 - so what is the source of the DB9?


Perhaps such details like

 - Nextion Model

 - Version of Nextion Editor

 - Your HMI code that is giving this on Nextion

Perhaps then with details of fact and no assumptions


I would highly doubt you should expect to see 00,01,02,03,04

- rather 0x00 0x00 0x00 0x00, 0x01 0x00 0x00 0x00, ... 0x0A 0x00 0x00 0x00

- or when using Nextion Return Data so you can debug properly then

  0x71 0x00 0x00 0x00 0x00 0xFF 0xFF 0xFF as per the Nextion Instruction Set.




maybe your USB2RS232 adapter is not a TTL one ...


:-)

Appears that - Logic is inverted, and protocol is not correct

Your Nextion Model's Datasheet clearly states TTL

TTL is Serial N81 with LSB sent first.



Thank you Patrick,


The problem was indeed that I was using a USB to Serial cable, rather than converting the signals from TTL to serial.  I connected an Arduino Uno as a "translator" (Tx, Rx of Arduino to display, USB from Arduino to computer, pull reset pin of Arduino to ground).  Then the USB output of the Arduino sends the translated data to my PC.  You can find videos on YouTube describing this connection, just search for "Arduino USB to TTL converter".

You can also search the Forum for Nextion TTL Serial using the above Search Bar.

http://support.iteadstudio.com/support/discussions/topics/11000012112

 - authoritative information about the actual product

   (without the thumb covering the camera for 5 min).


Most Nextion users do not have YouTube - Nextion is global.

Why use a $9 UNO to do "translation"

  when a $2 USB to TTL Serial adapter is readily available.

...because I have about 20 leftover Unos from a previous project, so they are free and on hand.

However it is important to note that since the Uno is a 5V device, it can have issues (because the Nextion logic is 3.3V nominal as noted on the data sheet).

I ended up using an HC-05 Bluetooth device to connect to the display, now I am connected to my PC wireless-ly, which is even better.

As noted in the Datasheet, Nextion accepts 5V (5V tolerant rx/tx, gpio pin) when Nextion is a 5V device.


Anyrate ... now up and running so Happy coding.

never a good strategy in general to build and design a project around "something I already have" ...


btw. be aware that the usage of your normal USB2RS232 adaptor with PC logic levels could already damage your TTL interface on Nextion ...

even it seems now all works, does not mean it really does reliable. With all futural "misbehave" you can ask yourself ...


    - is it a real bug

    - is something wrong with my code

    - is it a result of my overvoltage on TX/RX

    - ...


:-)