Nextion screen does not answer, Connecting Nextion to the expansion port

Hi all,

I am trying to connect a Nextion 7'' intelligent screen to a D21G and I have 2 ongoing problems.

First, Nextion screen does no answer the "bkcmd=3" command. The RS485 card red LED blinks, but not the other (green, I guess) LED. I switched TD/RD on the screen side, even changed the 4-pin connector + cables coming out of the screen, no improvement. I will change the RS485 module soon, just in case. Same situation with the original Tom-code. Is there something I missed ? Would the Intelligent series have a different comms speed ? format ?

[ Okay, the RS485 module was faulty, both LEDs blink now, but the screen only answers "0, 0, 0" to the "bkcmd=3" command.]

Second, I would like to keep my RS485 free for Modbus communication and still use a Nextion screen. How do I connect it to the expansion port (which means I sacrifice my IP extension possibility, I know). I guess the 5V on the exp.port is strong enough to power the RS485 interface since it powers up the RJ45 card. 

Stay home if possible, and keep well and safe, all of you !

Didier, DG2R 

Didier DORGUIN
Didier DORGUIN
172
| 4 1 3
Asked on 4/6/20, 6:48 AM
0
vote
2216 Views

Hi Didier, i have just made a blog post to illustrate the standard TTL connection on Serial1 (D10/D5) see https://industruino.com/blog/our-news-1/post/nextion-hmi-with-industruino-44

Tom
on 4/6/20, 11:10 AM

Hi Didier,

I used this test sketch to communicate with the Nextion over RS485 by using the commands, so it does not rely on the library. You are probably using similar code but anyway let me post mine:

/*
   Industruino INDIO RS485 serial demo   RECEIVER
   INDIO has a half duplex RS485 port connected to hardware Serial
   TxEnablePin is D9

   NEXTION commands:
   rest       reset
   bkcmd=3    always get feedback (default is 2: only on failure)
   page 0     go to page 0
*/

// Industruino RS485 has transmission enable pin on D9
const int TxEnablePin = 9;

void setup() {

  Serial.begin(9600);    // RS485
  SerialUSB.begin(115200);
  delay(1000);
  SerialUSB.println("RS485 receiver and sender");
  pinMode(TxEnablePin, OUTPUT);
  digitalWrite(TxEnablePin, LOW);  // for receiving

}

void loop() {

  while (Serial.available()) {
    byte byte_received = Serial.read();
    SerialUSB.println(byte_received, HEX);
  }

  if (SerialUSB.available()) {
    String cmd = SerialUSB.readStringUntil('\n');
    SerialUSB.print("sending cmd= ");
    SerialUSB.println(cmd);
    digitalWrite(TxEnablePin, HIGH);  // for sending
    //delay(10);
    Serial.print(cmd);
    Serial.write(0xFF);
    Serial.write(0xFF);
    Serial.write(0xFF);
    Serial.flush();  // important to wait until the Serial buffer has emptied itself
    digitalWrite(TxEnablePin, LOW);   // for receiving
  }

}

Open the Serial Monitor, type the command and hit 'enter' or 'send'.

'rest' should come back with 0 0 0 FF FF FF 88 FF FF FF

'bkcmd=3' with 1 FF FF FF

Have you uploaded your .tft file to the Nextion? The 7'' spec page seems to say 9600 baud as well.

Regarding the IDC expansion port: the Industruino's DC/DC converter (V+/V- to 5V) is 2W, so can supply 400mA max on the 5V line. The topboard needs around 50mA, depending on the LCD backlight, so 350mA is available on the IDC 5V. Enough for the RS485 converter but not for the screen (1A recommended).

Tom
Tom
5675
| 1 1 3
Answered on 4/6/20, 9:05 AM
1
vote

Hi Tom,

In fact, I also tried your code just to watch what happens on startup (since the adresses of the controls on my screens differ from yours) : same pb. I tried adding some delays between the "bkcmd=3" being sent, but no success so far. The TFT file is loaded and the screen starts on it all right. I had a search on the Nextion site and came up with the same answer : 9600 Bd. I feel like incriminating the screen serial communication as faulty, right now. I guess I will put another RS485 interface D21G in its place to see if the characters arrive on the TTL serial port, just to be sure, but I will try your test code first.

IDC expansion port : RX is D0 (pin 3), TX is D1 (pin 4), GND is pin 10 and 5V pin 15. Right ? And I guess I will have to consider the RS485 part in the library as a comment.

Thanks for the fast answer.

Didier, DG2R

Didier DORGUIN
Didier DORGUIN
172
| 4 1 3
Answered on 4/6/20, 2:55 PM
0
vote

I'm not sure i understand correctly, but if you want to use RS485 on the INDIO then of course use the A/B terminals, and Serial. For the IDC i suggest to use the D21G second hardware serial: D10/D5 Serial1 (as in my blog example); if you want to use D0/D1 Serial on the IDC, you need to disconnect these pins from the RS485 port by moving the hardware switch on the baseboard to its up position.

Tom
on 4/10/20, 6:55 AM

Your answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

Ask a Question

Keep Informed

About This Forum

This community is for professionals and enthusiasts of our products and services.

Read Guidelines

Question tools

60 follower(s)

Stats

Asked: 4/6/20, 6:48 AM
Seen: 2216 times
Last updated: 4/6/20, 2:59 PM