yozik04 / nextion

Nextion serial client
GNU Lesser General Public License v3.0
25 stars 10 forks source link

Baud issues #26

Open JYunusov opened 2 years ago

JYunusov commented 2 years ago

Hi, I am currently trying to upload .tft file to nextion display using raspberrypi zero through serial. But I get an error:

Any help will be appreciated, thanks!

pi@raspberrypi:~ $ nextion-fw-upload /dev/ttyS0 hello.tft 2022-02-11 14:29:31,833 INFO nextion.nextion.client Connecting: /dev/ttyS0, baud: 2400 2022-02-11 14:29:31,841 INFO nextion.nextion.protocol.base Connected to serial 2022-02-11 14:29:33,646 WARNING nextion.nextion.client No valid reply on 2400 baud. Closing connection 2022-02-11 14:29:33,651 ERROR nextion.nextion.protocol.base Connection lost 2022-02-11 14:29:33,656 WARNING nextion.nextion.client Baud 2400 did not work 2022-02-11 14:29:33,660 INFO nextion.nextion.client Connecting: /dev/ttyS0, baud: 4800 2022-02-11 14:29:33,667 INFO nextion.nextion.protocol.base Connected to serial 2022-02-11 14:29:34,645 WARNING nextion.nextion.client No valid reply on 4800 baud. Closing connection 2022-02-11 14:29:34,649 ERROR nextion.nextion.protocol.base Connection lost 2022-02-11 14:29:34,654 WARNING nextion.nextion.client Baud 4800 did not work 2022-02-11 14:29:34,657 INFO nextion.nextion.client Connecting: /dev/ttyS0, baud: 9600 2022-02-11 14:29:34,664 INFO nextion.nextion.protocol.base Connected to serial 2022-02-11 14:29:34,933 INFO nextion.nextion.client Address: 30611 2022-02-11 14:29:34,936 INFO nextion.nextion.client Detected model: NX4024T032_011R 2022-02-11 14:29:34,939 INFO nextion.nextion.client Firmware version: 78 2022-02-11 14:29:34,942 INFO nextion.nextion.client Serial number: DE602478A74A6831 2022-02-11 14:29:34,945 INFO nextion.nextion.client Flash size: 4194304 2022-02-11 14:29:34,999 INFO nextion.nextion.client Successfully connected to the device 2022-02-11 14:29:35,001 INFO nextion.nextion.client About to upload 168299 bytes 2022-02-11 14:29:35,193 WARNING nextion.nextion.client Additional sleep configuration failed: Variable name invalid for command: usup=1 2022-02-11 14:29:35,197 INFO nextion.nextion.client Reconnecting at new baud rate: 115200 2022-02-11 14:29:35,251 ERROR nextion.nextion.protocol.base Connection lost 2022-02-11 14:29:35,259 INFO nextion.nextion.protocol.base Connected to serial 2022-02-11 14:29:35,631 INFO nextion.nextion.client Device is ready to accept upload 2022-02-11 14:29:41,764 ERROR root Failed to upload firmware Traceback (most recent call last): File "/home/pi/.local/lib/python3.9/site-packages/nextion/protocol/base.py", line 37, in read return await self.queue.get() File "/usr/lib/python3.9/asyncio/queues.py", line 166, in get await getter asyncio.exceptions.CancelledError

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/lib/python3.9/asyncio/tasks.py", line 492, in wait_for fut.result() asyncio.exceptions.CancelledError

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/home/pi/.local/lib/python3.9/site-packages/nextion/console_scripts/upload_firmware.py", line 14, in upload await nextion.upload_firmware(args.file, args.upload_baud) File "/home/pi/.local/lib/python3.9/site-packages/nextion/client.py", line 394, in upload_firmware res = await self.read_packet(timeout=timeout) File "/home/pi/.local/lib/python3.9/site-packages/nextion/client.py", line 221, in read_packet return await asyncio.wait_for(self._connection.read(), timeout=timeout) File "/usr/lib/python3.9/asyncio/tasks.py", line 494, in wait_for raise exceptions.TimeoutError() from exc asyncio.exceptions.TimeoutError

yozik04 commented 2 years ago

A solution to that is very welcome =) This tft upload is kinda like a demo. I've managed to upload it once on my device and have not tried anymore. Nextion does not share documentation how to upload tft (at least when I looked for it some years ago)

EyitopeIO commented 2 years ago

Nextion upload protocol documented here last year: https://itead.cc/nextion/nextion-hmi-upload-protocol/

yozik04 commented 2 years ago

Want to make a pull request? 😉