Greetings,
I was trying to upload a tft file to nextion using Arduino Mega and SD card module with Upload example provided by Nextion library. . Here is my code:
#include "NexUpload.h"
NexUpload nex_download("test.tft",53,115200);
void setup() {
// put your setup code here, to run once:
nex_download.upload();
}
void loop() {
// put your main code here, to run repeatedly:
}
This returns:
12:32:00.184 -> start _checkFile
12:32:00.184 -> file is not exit
12:32:00.231 -> tft file size is:
12:32:00.231 -> 0
12:32:00.231 -> check file ok
12:32:00.916 -> get baudrate error
Any ideas?
Thanks.
J-M-L
November 24, 2021, 12:55pm
2
is you screen configured at 9600 bauds and connected on pin 2 (Arduino Rx) and 3(Arduino Tx) ?
Thank you for the reply,
I am using Arduino Mega hence it is connected to 16(Arduino Rx2) and 17(Arduino Tx2) and screen is configured at 115200.
J-M-L
November 24, 2021, 1:13pm
4
I'm not using their stuff but I would look into NexUpload.cpp to see the assumption they make.
How does the code know the screen is on Serial2?
Default conf file for this library, is for mega and it is on Serial2:
/**
* Define nexSerial for communicate with Nextion touch panel.
*/
#define nexSerial Serial2
/**
* @file NexConfig.h
*
* Options for user can be found here.
*
* @author Wu Pengfei (email:<pengfei.wu@itead.cc>)
* @date 2015/8/13
* @copyright
* Copyright (C) 2014-2015 ITEAD Intelligent Systems Co., Ltd. \n
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*/
#ifndef __NEXCONFIG_H__
#define __NEXCONFIG_H__
/**
* @addtogroup Configuration
* @{
This file has been truncated. show original
Btw, I can manipulate a text field on Nextion through Arduino, which means Serial communication is established.
J-M-L
November 24, 2021, 1:38pm
6
OK
the error message you see
12:32:00.916 -> get baudrate error
comes from here
if(_getBaudrate() == 0)
{
dbSerialPrintln("get baudrate error");
return;
}
so for some reason _getBaudrate()
returned 0
system
Closed
May 23, 2022, 1:39pm
7
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.