Why Dwin Display is Showing Invalid Header error

Hi there,

Can somebody help with DWIN Display.. It is very new for me..
I want to change a boolean value state from 0 to 1 by just touching Dwin display. As I have created a GUI which has two buttons(Test_Fun and Run_Fun) and now I'm not able to figure our that which action should I perform on buttons so that when I touch that buttons on dwin display then It will change the boolean variable state then I'll use that variable for further steps.

//for interfacing dwin display
unsigned char test_run[9];
unsigned char Buffer[9];
#define test_fun 0x10 // VP in DGUS Software
#define run_fun 0x11  // VP in DGUS Software
bool test_run_bool = 0;

const int leftEnable = 15; //driver2(left) [Paper movement forward-->motor ccw]
const int rightEnable = 23; //driver1(right) [Paper movement backward-->motor cw]
const int pinchEnable = 5; //driver3(pinch roller) [repeatative movement of paper forard backward by 50 mm]

void setup(){
  // Set the step and direction pins as outputs
  Serial.begin(9600);
  Serial2.begin(9600);
  Serial.println("Serial began at 9600..!");

  pinMode(rightEnable, OUTPUT); //driver 2
  pinMode(leftEnable, OUTPUT);//driver 1
  pinMode(pinchEnable, OUTPUT);

  digitalWrite(leftEnable, LOW);
  digitalWrite(rightEnable, LOW);
  digitalWrite(pinchEnable, LOW); 

  Serial.println("system powered ON");
}

void loop(){

  if(Serial2.available())
  {
    for(int i = 0; i <= 8; i++)
    {
      Buffer[i] = Serial2.read();
      Serial2.println(Buffer[i]);
      //Serial.print(Buffer[i]);
    }

    if(Buffer[0] == 0x5A)
    {
      switch (Buffer[4])
      {
        case 0x10:
          test_run_bool = 1;
          Serial.println("Test Function clicked..!");
          break;

        case 0x11:
          Serial.println("Run Function clicked..!");
          break;

        default:
          Serial2.println("Default case");
          break;
      }
    }
  }

  if(test_run_bool == 1){
    digitalWrite(leftEnable, HIGH);
    digitalWrite(rightEnable, HIGH);
    digitalWrite(pinchEnable, HIGH);
  }

  Serial.print("test_run_bool value : ");
  Serial.println(test_run_bool);
}

can anybody pls tell me what I'm missing because when running this program I'm getting Invalid header error..

12:52:56.134 -> rst:0x10 (RTCWDT_RTC_RESET),boot:0x37 (SPI_FAST_FLASH_BOOT)
12:52:56.179 -> invalid header: 0xffffffff
12:52:56.211 -> invalid header: 0xffffffff
12:52:56.258 -> invalid header: 0xffffffff
12:52:56.303 -> invalid header: 0xffffffff
12:52:56.350 -> invalid header: 0xffffffff
12:52:56.397 -> invalid header: 0xffffffff
12:52:56.442 -> invalid header: 0xffffffff

1 Like

which board are you using?

1 Like

I'm using ESP32 DEV KIT V1.

1 Like

This section of the Forum is for Nano ESP32 specifically.
Your post should be moved to a more generic section of the Forum.

I'll ask the moderators to do so.
Thank you

u.

This will help your serial not tried the rest of your program.
Try not to do other work in the serial loop.
Did you edit the screen config file to 9600? the default of 115200 would be fine with the esp32.

#define READ_TIMEOUT 100 // maybe more for your 9600
 
if(Serial2.available() > 5) // minimum dwin instruction length is 6 
{
  unsigned long startTime = millis(); 
      for(int i = 0; i <= 8; i++)
      {
        Buffer[i] = Serial2.read();
        delay(2);
        if (Buffer[0] != 0x5A) break; 
        if (millis() > (startTime + READ_TIMEOUT)) break;
        Serial.print("0x");
        Serial.print(Buffer[i],HEX);
        Serial.print(" ");
      }
}   
1 Like

I moved your topic to a more appropriate forum category @sudheer474.

The Nano ESP32 category you chose is only used for discussions directly related to the Arduino Nano ESP32 board.

In the future, please take the time to pick the forum category that best suits the subject of your question. There is an "About the _____ category" topic at the top of each category that explains its purpose.

Thanks in advance for your cooperation.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.