AndiDittrich / NodeMCU-Tool

:wrench: Upload + Manage Lua files on NodeMCU
https://www.npmjs.com/package/nodemcu-tool
MIT License
310 stars 54 forks source link

Can't connect to NodeMCU after flashing firmware. #63

Closed nolash closed 5 years ago

nolash commented 5 years ago

Checklist

  1. Can you establish a serial connection WITHOUT Nodemcu-Tool - e.g. with a serial terminal like Putty ?
    YES/NO

YES to /dev/ttyUSB0 but it outputs a bunch of binary garbage:

# cat /dev/ttyUSB0 | hexdump
0000000 434f 9245 4305 4f04 7141 5206 fc52 8230
0000010 3f7e 3496 5293 12b6 ffa3 4f04 2ab4 1ab6
0000020 0443 434f 9245 4305 4704 7151 5206 fc52
0000030 8230 3f7e 2486 4293 12b6 ffa3 5f14 3aa4
0000040 1ab6 0443 434f 9245 4305 4f04 7141 5206
0000050 fc52 8230 3f7e 3496 5293 12b6 ffa3 4f04
0000060 2ab4 1ab6 0443 434f 9245 4305 4f04 7141
0000070 4206 fc52 8230 3f7e 3496 5293 02a6 ffa3
0000080 4f04 2ab4 1ab6 044b 434f 9245 4305 4f04
0000090 7941 5206 fc52 8230 3f7e 3496 4293 12b6
00000a0 ffa3 5f14 3ab4 1ab6 0443 434f 8245 4305
00000b0 4f04 7141 5206 fc52 8230 3f7e 3496 5293
00000c0 12b6 ffa3 4f04 3ab4 1ab6 0443 434f 924d
00000d0 4305 4f04 7141 5206 fc52 8230 3f7e 3496
00000e0 5293 12b6 ffa3 5f14 3ab4 1ab6 0443 434f
00000f0 924d 4305 4f04 7141 5206 fc52 8220 3f6e
0000100 3496 4293 12b6 ffa3 4f04 3ab4 1ab6 0443
0000110 434f 9245 4305 4f04 7141 5206 fc52 8230
0000120 3f7e 3496 5293 12b6 ffa3 4f04 3ab4 1ab6
0000130 0443 434f 9245 4305 4f04 7141 5206 fc52
0000140 8220 1f4e 2486 5293 0286 ffa3 4f04 3ab4
0000150 1ab6 1443 435f 9245 4305 4f04 7141 4206
0000160 fc42 8230 1f76 3496 4293 12b6 ffa3 4f04
0000170 3ab4 1ab6 0443 434f 9245 4305 4f04 7141
  1. Does the nodemcu-tool fsinfo command work ?

NO


Environment

Linux sostenuto 5.0.8-arch1-1-nousbserial #1 SMP PREEMPT Fri May 10 00:18:58 CEST 2019 x86_64 GNU/Linux

NodeMCU Amica. Says on the back use baud rate 9600 and install driver cp2102

$ lsusb -v -d 10c4:ea60

Bus 002 Device 071: ID 10c4:ea60 Cygnal Integrated Products, Inc. CP2102/CP2109 UART Bridge Controller [CP210x family]
Couldn't open device, some information will be missing
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               1.10
  bDeviceClass            0 
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0        64
  idVendor           0x10c4 Cygnal Integrated Products, Inc.
  idProduct          0xea60 CP2102/CP2109 UART Bridge Controller [CP210x family]
  bcdDevice            1.00
  iManufacturer           1 
  iProduct                2 
  iSerial                 3 
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength       0x0020
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0 
    bmAttributes         0x80
      (Bus Powered)
    MaxPower              100mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass      0 
      bInterfaceProtocol      0 
      iInterface              2 
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x01  EP 1 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               0

v11.15.0


Debug Output


$ sudo esptool --port /dev/ttyUSB0 --baud 115200 write_flash -fm dio 0x0000 /home/lash/Downloads/nodemcu-1.5.4.1-final-15-modules-2019-05-13-18-36-43-float.bin 
esptool.py v2.6
Serial port /dev/ttyUSB0
Connecting....
Detecting chip type... ESP8266
Chip is ESP8266EX
Features: WiFi
MAC: 18:fe:34:f1:f5:10
Uploading stub...
Running stub...
Stub running...
Configuring flash size...
Auto-detected Flash size: 4MB
Flash params set to 0x0240
Compressed 433556 bytes to 277352...
Wrote 433556 bytes (277352 compressed) at 0x00000000 in 24.5 seconds (effective 141.8 kbit/s)...
Hash of data verified.

Leaving...
Hard resetting via RTS pin...

$ sudo node bin/nodemcu-tool.js -p /dev/ttyUSB0 --debug init
[config]      ~ debug mode enabled 
[config]      ~ Project based configuration loaded 
[config]      ~ baudrate             = 9600 (type:string) 
[config]      ~ port                 = /dev/ttyUSB0 (type:string) 
[config]      ~ connectionDelay      = 0 (type:number) 
[config]      ~ minify               = false (type:boolean) 
[config]      ~ compile              = false (type:boolean) 
[config]      ~ keeppath             = false (type:boolean) 
[config]      ~ remotename           = null (type:object) 
[config]      ~ run                  = false (type:boolean) 
[config]      ~ all                  = false (type:boolean) 
[config]      ~ json                 = false (type:boolean) 
[config]      ~ raw                  = false (type:boolean) 
[config]      ~ softreset            = false (type:boolean) 
[NodeMCU-Tool]~ Creating project based configuration file.. 
[NodeMCU-Tool]~ Baudrate in Bit per Seconds, e.g. 115200 (default) (115200) 9600
[NodeMCU-Tool]~ Serial connection to use, e.g. COM1 or /dev/ttyUSB2 (/dev/ttyUSB0) 

$ sudo node bin/nodemcu-tool.js -p /dev/ttyUSB0 --debug --connection-delay 1000 mkfs
[config]      ~ debug mode enabled 
[config]      ~ Project based configuration loaded 
[config]      ~ baudrate             = 9600 (type:string) 
[config]      ~ port                 = /dev/ttyUSB0 (type:string) 
[config]      ~ connectionDelay      = 1000 (type:string) 
[config]      ~ minify               = false (type:boolean) 
[config]      ~ compile              = false (type:boolean) 
[config]      ~ keeppath             = false (type:boolean) 
[config]      ~ remotename           = null (type:object) 
[config]      ~ run                  = false (type:boolean) 
[config]      ~ all                  = false (type:boolean) 
[config]      ~ json                 = false (type:boolean) 
[config]      ~ raw                  = false (type:boolean) 
[config]      ~ softreset            = false (type:boolean) 
[NodeMCU-Tool]~ Do you really want to format the filesystem and delete all file ? (no) yes
[NodeMCU-Tool]~ Unable to establish connection 
[NodeMCU-Tool]~ Timeout, no response detected - is NodeMCU online and the Lua interpreter ready ? 
[NodeMCU-Tool]~ Error: Timeout, no response detected - is NodeMCU online and the Lua interpreter ready ?
    at Timeout._onTimeout (/home/lash/bin/nodemcu/node_modules/nodemcu-tool/lib/connector/check-connection.js:13:20)
    at listOnTimeout (internal/timers.js:535:17)
    at processTimers (internal/timers.js:479:7) 

$ lsmod | grep usb
btusb                  57344  0
btrtl                  20480  1 btusb
btbcm                  16384  1 btusb
btintel                28672  1 btusb
bluetooth             651264  4 btrtl,btintel,btbcm,btusb
usbserial              57344  1 cp210x
usb_storage            73728  1 uas
usbhid                 61440  1 wacom
hid                   147456  3 wacom,usbhid,hid_generic
scsi_mod              253952  5 sd_mod,usb_storage,uas,libata,sg

$ dmesg
[...]
[281208.163027] usb 1-1.2: new full-speed USB device number 37 using ehci-pci
[281208.262822] usb 1-1.2: New USB device found, idVendor=10c4, idProduct=ea60, bcdDevice= 1.00
[281208.262829] usb 1-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[281208.262832] usb 1-1.2: Product: CP2102 USB to UART Bridge Controller
[281208.262835] usb 1-1.2: Manufacturer: Silicon Labs
[281208.262838] usb 1-1.2: SerialNumber: 0001
[281208.264431] cp210x 1-1.2:1.0: cp210x converter detected
[281208.267162] usb 1-1.2: cp210x converter now attached to ttyUSB0
AndiDittrich commented 5 years ago

Hi @nolash

your issue is not related to NodeMCU-Tool...it's related to your firmware because you cannot establish a working connection (this assumes the serial transport as well as the terminal is functional).

maybe it's a baudrate related issue

nolash commented 5 years ago

Oh well yeah it seems this unit has its own software actually. Sorry ;/