Update LoPy firmware using Pysense as expansion board



  • Hello,

    I can't manage to update the LoPy firmware (from pycom_update_1.1.1.b2) using the Pysense as expansion board (on Ubuntu 16.04).

    I plug the expansion board, it is seen as /dev/ttyACM0 interface, as reported by the kernel console as:

    [  829.904731] usb 2-1.3: new full-speed USB device number 9 using ehci-pci
    [  829.999863] usb 2-1.3: New USB device found, idVendor=04d8, idProduct=f012
    [  829.999868] usb 2-1.3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
    [  829.999871] usb 2-1.3: Product: Pysense
    [  829.999873] usb 2-1.3: Manufacturer: Pycom
    [  829.999875] usb 2-1.3: SerialNumber: Py343434
    [  830.001385] cdc_acm 2-1.3:1.0: ttyACM0: USB ACM device
    

    I then plug LoPy on the Pysense, and the LoPy RGB LED starts blinking in blue.

    Then, I connect G23 and GND together, and start the update wizard. I specify the serial interface /dev/ttyACM0 and end up with the following error:

    Something failed trying to connect to the device.

    After investigation, I try the following command:

    python bin/esptool.py --port /dev/ttyACM0 read_mac

    And I get:

    esptool.py v2.0-beta1
    Connecting...
    Traceback (most recent call last):
      File "bin/esptool.py", line 2257, in <module>
        main()
      File "bin/esptool.py", line 2027, in main
        esp = ESPLoader.detect_chip(args.port, initial_baud, args.before)
      File "bin/esptool.py", line 187, in detect_chip
        detect_port.connect(connect_mode)
      File "bin/esptool.py", line 299, in connect
        self._port.setDTR(False)  # IO0=HIGH
      File "/usr/local/lib/python2.7/dist-packages/serial/serialutil.py", line 597, in setDTR
        self.dtr = value
      File "/usr/local/lib/python2.7/dist-packages/serial/serialutil.py", line 469, in dtr
        self._update_dtr_state()
      File "/usr/local/lib/python2.7/dist-packages/serial/serialposix.py", line 625, in _update_dtr_state
        fcntl.ioctl(self.fd, TIOCMBIC, TIOCM_DTR_str)
    IOError: [Errno 32] Broken pipe
    

    I tried reinstalling pyserial for both Python 2 and 3, but nothing happens.

    I noticed that no one ever report the serial interface being /dev/ttyACMx. Instead, it's always /dev/ttyUSBx. Is there a problem with the Python script related to this (there shouldn't be I believe)?

    Thanks for your help, it's quite frustrating not being able to connect to my new toy!



  • @robert-hh said in Update LoPy firmware using Pysense as expansion board:

    So better never supply the board by the 3.3V Pin. That's an output, not an input. Use the Vin Pin for supply.
    @daniel: Please remove note, that the device can be supplied through the 3.3V pin. Even if that may work under certain conditions, the risk is too high that devices will be broken.

    I see that we disscuss this 6 months ago ;-)
    https://forum.pycom.io/topic/316/wipy-pin-3v3-not-work
    But conclusion was different.
    Now when we have schematic i do not see there any diode or something like LTC4357
    And schematic(and description) for LM3281 does not bring light if there is some protection - especially that there is comparator output



  • @jellium The OEM Baseboard gives a good hint: https://docs.pycom.io/pycom_esp32/_downloads/OEM-baseboard-schematic.pdf
    The regulator is a LM3281 (http://www.ti.com/lit/ds/symlink/lm3281.pdf), which is the smaller of the two chips next to the RGB-LED.
    The esp32 itself works with supply between 3.0 and 3.6 V.


  • administrators

    @jellium I had added it to my updates and changes to adapt the documentation to make this more clear. Apologies for the confusion! I've also asked Daniel if he has any particular suggestions regarding the regulator.

    @jmarcelino I've also fried two ESP8266s doing this... It's incredibly frustrating to be misled by a cable...



  • @jellium said in Update LoPy firmware using Pysense as expansion board:

    TTL-232R-3V3

    Yes, it is confusing :( but FTDI cables always supply 5V on Vcc, even the 3V3 version (the 3V3 is just the signal level)



  • @robert-hh said in Update LoPy firmware using Pysense as expansion board:

    @jellium There were other posts telling, that supplying the Lopy though the 3.3V Pin breaks the board. Actually it is 'only' the on.board 3.3v Regulator which gets killed. If you remove the regulator form the board, you can at least then supply it with 3.3V.

    So better never supply the board by the 3.3V Pin. That's an output, not an input. Use the Vin Pin for supply.
    @daniel: Please remove note, that the device can be supplied through the 3.3V pin. Even if that may work under certain conditions, the risk is too high that devices will be broken.

    Thanks for the pieces of info. In the pinout diagram, there is no mention of Vin or Vout, it says Power (in red) and corresponds to 5V and 3V3 pins. It is extremely ambiguous, especially now one considers it is an output. I cannot find a schematic helping me to locate the 3V3 regulator, any hint?



  • @jellium There were other posts telling, that supplying the Lopy though the 3.3V Pin breaks the board. Actually it is 'only' the on.board 3.3v Regulator which gets killed. If you remove the regulator form the board, you can at least then supply it with 3.3V.

    So better never supply the board by the 3.3V Pin. That's an output, not an input. Use the Vin Pin for supply.
    @daniel: Please remove note, that the device can be supplied through the 3.3V pin. Even if that may work under certain conditions, the risk is too high that devices will be broken.



  • @bucknall said in Update LoPy firmware using Pysense as expansion board:

    Hi @jellium,

    You need to ensure that GND and G23 are connected prior to powering on the LoPy. This way the device boots into Firmware Update Mode!

    There are some changes with the USB to Serial converter chip used in the Pysense & Pytrack boards - we'll update you/documentation as we write them (currently doing that as I write this!).

    Thanks!

    Alex

    I did try to plug GND and G23 prior to plugging the board already (sorry for not stating that in my first post). Did not change anything.

    @Xykon said in Update LoPy firmware using Pysense as expansion board:

    I'm not sure the PySense and PyTrack boards currently support firmware updates. Even after running sudo systemctl stop ModemManager.service and checking for the "waiting for download" message in minicom, I can't get esptool.py to talk to the board.

    I'm actually getting the same output and I think this has to do with the CDC-ACM driver not (or at least not properly) supporting flow control.

    I figured that there is something wrong with the way serial to USB is handled. OK, I will wait.

    This morning I tried to connect the LoPy directly with a TTL-232R-3V3 cable connecting GND, 3V3, RX, TX, CTS, RTS pins directly to the LoPy. EDIT : I just measured the output voltage of "TTL-232R-3V3" cable and it is 5 V when connected to USB. I have probably burnt the 3V3 input power of the LoPy and basically the whole thing. Stupid.

    First, I did not connect GND to G23. Then I connected the USB on my computer, and noticed the LED flashing quickly (can't tell the color), and then no blink. No serial interface was created and the kernel did not return anything about this new connection. What's wrong?

    Secondly, I disconnected everything and connected the LoPy on the Pysense, to check if the blue LED blinks when using the Pysense. Again, I did not connect GND to G23 (to allow normal boot and LED blink) but now, even though a serial interface is created (ttyACM0 as before, and the kernel can read the product information), the LED does not blink anymore. And much more preoccupating... the LoPy heats a lot on the left hand side of the RGB LED (I noticed the heating because of... the very distinguishable smell of PCB heating abnormally). Anyway, I am scared things went bad for the LoPy, even though I did nothing special except using a direct USB TTL serial cable on 3v3.

    Any hope for the card not being bricked? I have waited for 2,5 months for the Pysense, and now nothing works and worst than that, I may have broken the card. :(


  • Global Moderator

    I'm not sure the PySense and PyTrack boards currently support firmware updates. Even after running sudo systemctl stop ModemManager.service and checking for the "waiting for download" message in minicom, I can't get esptool.py to talk to the board.

    I'm actually getting the same output and I think this has to do with the CDC-ACM driver not (or at least not properly) supporting flow control.


  • administrators

    Hi @jellium,

    You need to ensure that GND and G23 are connected prior to powering on the LoPy. This way the device boots into Firmware Update Mode!

    There are some changes with the USB to Serial converter chip used in the Pysense & Pytrack boards - we'll update you/documentation as we write them (currently doing that as I write this!).

    Thanks!

    Alex



Looks like your connection to Pycom Forum was lost, please wait while we try to reconnect.