ESP3D-TFT icon indicating copy to clipboard operation
ESP3D-TFT copied to clipboard

The serial port cannot be connected to the printer, but the USB serial port can

Open liqijian101 opened this issue 9 months ago • 18 comments

Has anyone else encountered this problem? I am certain that the hardware of the serial port is correct

liqijian101 avatar May 19 '25 14:05 liqijian101

did you changed anything ? did you set the output as serial ?

luc-github avatar May 19 '25 14:05 luc-github

Yes,I set the output as serial . When I send a command to the printer through its serial port, such as M105, it will continuously return the following information.

ok T:0.00 /0.00 B:0.00 /0.00 @:0 B@:0 echo:Unknown command: "[1" ok echo:Unknown command: "[0" ok echo:Unknown command: "[1" ok

liqijian101 avatar May 21 '25 12:05 liqijian101

what is the baud rate on both side?

luc-github avatar May 21 '25 12:05 luc-github

115200 I suspect there may be a problem with the TX of ESP32, but it's just a guess. I tested the ESP32 itself and there was no problem. I connected the RX to TX of the ESP32 and it can communicate. I cannot communicate normally when I connect ESP32 to MEGA2560 or LPC1789

liqijian101 avatar May 21 '25 13:05 liqijian101

did you tried your esp32 TX/RX connected to usb serial adapter and connect it to PC using serial monitor ?

luc-github avatar May 21 '25 14:05 luc-github

I also have this problem. I connected it to a computer and it worked correctly, but when I connected the ESP32 to the ATMEGA2560 printer, I encountered a problem. However, I tried the ESP3D v2 on the ESP8266, and it worked perfectly. When connected to a computer:

`M220 [esp3d_gcode_host_service.cpp:1546] _handle_stream_states(): Timeout waiting for ack [esp3d_gcode_host_service.cpp:1659] _handle_stream_states(): Stream is in error, cancel it M220 , M220 [esp3d_gcode_parser_service.cpp:117] processCommand(): processing Command Error: Command failed: 'M220' S1

M105 [esp3d_gcode_host_service.cpp:1546] _handle_stream_states(): Timeout waiting for ack [esp3d_gcode_host_service.cpp:1659] _handle_stream_states(): Stream is in error, cancel it M105 , M105 [esp3d_gcode_parser_service.cpp:117] processCommand(): processing Command Error: Command failed: 'M105' S1

M114 [esp3d_gcode_host_service.cpp:1546] _handle_stream_states(): Timeout waiting for ack [esp3d_gcode_host_service.cpp:1659] _handle_stream_states(): Stream is in error, cancel it M114 , M114 [esp3d_gcode_parser_service.cpp:117] processCommand(): processing Command Error: Command failed: 'M114' S1

M220

`

slavaart avatar Jun 25 '25 09:06 slavaart

ESP3D and ESP3D-TFT are not same one use arduino and other use IDF so they cannot compared also you compare esp32 with esp8266 2 different hardware what I can see on log connected to your computer is code is sent to PC but go to error because it do not get answer - which is normal because you pc is not giving printer response

that said if it is ok with esp8266 but not with esp32 - it may be because your ATMEGA2560 tx pin is 5v based and you did not pour voltage regulator to esp32, esp8266 is 5v Tolerant in short time, esp32 need 3.3v max and get stuck is connected to 5v GPIO

luc-github avatar Jun 25 '25 09:06 luc-github

Yes, that's right. I forgot to mention that it freezes when it's first connected, and I've already made a voltage divider. It's after connecting the divider that it starts working, but there's no proper communication between the devices. Sometimes the printer accepts commands, such as moving a few seconds after pressing the move button, but this doesn't happen every time. After a few minutes, the nozzle temperature sometimes appears, but it's rare and doesn't update frequently. I've tried shielding the cable and connecting an additional GND wire, but it hasn't yielded any results. Here's the code from the web panel when the printer is connected:

�o M21 � M20 ok ech����c�o{�ρ� ok �=����~o���������z��7 �� [�:Un�������� "[1" ok k y�����~g�~�~ "�k ��U~{~�:�_� ��k ���U���:�����1" � o=���U~k~��:��� �� k � ���o~o�:������ "[1" k xzwn���:��<� �" o� Yz�������oa��~ �� �o � ���zW�}�� c�� .;_��� �� ok ok O���U~k~�:����~d:���íY�OU~����c}}c��~ &����O]�=��������";���YzUn�n������[��� �o ok �k ���U������ma��_1��� {���w~ ���_p"�[�w�������cnd��L��Y�]�������nd�������o���� g[�"�0" � y�:U~�~ �omo���_0"�Y Y��-~����a����.,�� ok �� � ���:]�n� g�}a��_p& �� o � Y ����?�~���c��~ &?��k �� �k k �/������o�����and: "[1" �[�U��n�� ��}���"���� k k �� � � ok �ok Y�U~onown`cm�a~d: "�ok ok ok o� ��-�ݹ c��n�> "�0" ok ok ok o{Y�빭ow��֫�nd[��[땹��~ co�and� { �n-�ݹc_&�0�k ����Unk�~ gommanl: &[1" ok ok { �m��:U~��߻coan_p��� o� Y����ow��֫m�nd:���ok�[�known coma���0" { �K}�-w~ co�[�z "$�k

slavaart avatar Jun 25 '25 10:06 slavaart

yes looks like communication corruption, do you have same when esp is connected to PC using usb connector ?

luc-github avatar Jun 25 '25 10:06 luc-github

no. my first message is that the ESP32 is connected to a computer. Here is the result from the WEB panel. (I sent "test" from the computer to the ESP32 via serial):

Error: Command failed: 'M220' S1 test Error: Command failed: 'M105' S1 Error: Command failed: 'M21' S1 Error: Command failed: 'M20' S1 Error: Command failed: 'M114' S1 Error: Command failed: 'M220' S1

slavaart avatar Jun 25 '25 10:06 slavaart

sorry what firmware and what board are you using ?

so ESP RX seems working because it echo on web panel the word test you entered from Serial but not ESP TX ? what happen if you type test back from web panel to the serial output ?

luc-github avatar Jun 25 '25 11:06 luc-github

I use ESP32-2432S028R and ESP3D-TFT ->main branch Communication between the ESP32 and the computer works successfully in both directions.

I sent the "test" command from the WEB panel, and the result appeared in the serial port connected to the computer:

M220 [esp3d_gcode_host_service.cpp:1546] _handle_stream_states(): Timeout waiting for ack [esp3d_gcode_host_service.cpp:1659] _handle_stream_states(): Stream is in error, cancel it M220 , M220 [esp3d_gcode_parser_service.cpp:117] processCommand(): processing Command Error: Command failed: 'M220' S1

test [esp3d_gcode_host_service.cpp:1546] _handle_stream_states(): Timeout waiting for ack [esp3d_gcode_host_service.cpp:1659] _handle_stream_states(): Stream is in error, cancel it test , test [esp3d_gcode_parser_service.cpp:117] processCommand(): processing Command Error: Command failed: 'test' S1

M105

slavaart avatar Jun 25 '25 11:06 slavaart

so issue is your voltage regulator that bring noise

luc-github avatar Jun 25 '25 11:06 luc-github

The signal is quite clean, close to 3.3 V

this is the signal after the voltage divider, taken from the ESP32 input Image

Image

slavaart avatar Jun 25 '25 14:06 slavaart

I am not electronician sorry - but as you mentionned esp32 <->pc => communication are ok esp32<-voltage regulator-> ATMEGA2560 => not ok So for me it is hardware related you can try esp32<-voltage regulator-> pc to check if behavior is same as with ATMEGA2560

luc-github avatar Jun 25 '25 14:06 luc-github

I think it is because of the mismatch of TTL voltage between ESP32 and MEGA2560, ESP32 is 3.3V MEGA2560 is 5V. In general, a level conversion circuit should be designed.

Image

liqijian101 avatar Jun 25 '25 14:06 liqijian101

I think it is because of the mismatch of TTL voltage between ESP32 and MEGA2560, ESP32 is 3.3V MEGA2560 is 5V. In general, a level conversion circuit should be designed.

Image

I designed the circuit according to this, but I have not tested it yet.

liqijian101 avatar Jun 25 '25 14:06 liqijian101

@liqijian101 any update ? should I close issue ?

luc-github avatar Jul 29 '25 08:07 luc-github