Firmware update, not possible on either windows or mac osx...



  • EDIT Now it freakin works.. SOooo, there's a difference between vcp and the dxx ftdi drivers.. i did not know about the vcp before until just now. installing the vcp seems to be working now. also, i have currently unloaded the apple ftdi driver which might also be necessary but i'm not sure. phew, this is a rather frustrating process to go through.. thanks so much for the help @jmarcelino though!

    Hello,

    Running Mac OSX 10.12.3 with the lopy connected via an original apple dongle to the USB C port. Lopy inserted correctly into the expansion board, all headers inserted properly and jumper is in place. When trying to run the firmware updater tool I just get "the upgrade failed, please check the connections...."

    after several attempts I tried running it on my windows 10 PC, but here there are just no visible ports in the update tool... jesus

    any suggestions ?

    EDIT (just to give an overview):

    • I tried a different USB cable, without any different result.
    • I do see the lopy listed as an ft230x basic UART device in my System Report in OSX
    • Arduino's work just fine on the same mac laptop


  • @robert-hh hello robert, thanks for all the great help - it's really awesome!!

    I managed to figure out, when booting in safe mode - that i can temporarily connect via ftp again (because the boot.py is bypassed).. and thus make changes to the boot.py.

    soo.. the thing is though, that it seems the lopy does not care AT ALL about what I put into the boot.py script now, even after unplugging the short between G28 and 3v (which I assume should make it go back to loading boot and main).

    EDIT
    tinkering more about, it turned out I had to set the heartbeat to false in order to use the rgbled onboard the lopy. well done soren. anyway, it is indeed responding now, but setting up the thing with custom wlan configuration is really difficult. this topic has become pretty messy. I tried to change the topic name, but got a message that i couldn't.. it is pretty misleading atm. are there any admins on here?



  • @soren See my revived post below about erase & reflash



  • @robert-hh

    thanks

    but safe boot doesn't set anything back, only goes into a temporary state where it bypasses boot.py and main.py as far as I can read. also the factory reset filesystem only seems possible when you have UART access...



  • @soren If you are able to update the firmware via USB, then you can co the hard way: : erasing the flash and reflashing the image. I just tried that with my LoPy. That works, erases everything in the device and brings back the REPL prompt on UART, which is set active in a hidden
    _boot.py in flash, which is executed before boot.py. All that requires, that you can reflash your device. Erasing the flash is easy, of you have the source tree installed. Then just call:
    make erase
    But all it needs is esptool.py form the repository, and the command.
    python3 ./esptool.py --chip esp32 --port /dev/cu.xxxx --baud 480800 erase_flash
    Then you could reload the software, connect through UART and a simple terminal program and setup WiFi manually step by step, e.g. using the first four statement of my sample script below.
    I have placed an esptool.zip archive here, which is just a copy of the tree from esp-idf. https://github.com/robert-hh/Shared-Stuff



  • Both rshell and ampy rely on a REPL prompt to be available. Did you try to connect with a simple serial terminal program like screen?

    screen /dev/cu.xxxx 115200
    Do you get the REPL prompt?
    If not, then coding errors in boot.py before activating the UART may stop boot.py, and REPL on UART does not get active. Then, the step I would take is safe boot, which skips boot.py and main.py. Maybe that will set WiFi back to the initial state.



  • @robert-hh it just keeps saying "connecting..." forever..
    wondering if, because i put the wlan stuff in boot.py if this could have hampered the ability to connect to the board ? I mean if what I wrote was wrong and also placed before the uart is initialized?



  • @soren
    e.g.
    connect serial /dev/cu.xxxxx 115200
    or
    rshell -p /dev/cu.xxxx -b 115200
    /dev/cu.xxxx ist the name of your serial port. On my linux machine, it's /dev/ttyUSB0
    Once connected, /flash shows the TLD of WiPY or Lopy.
    It works OK for file transfer and management. That should bring you back to the point where ftp works.



  • @robert-hh thanks for the tip robert!

    trying to connect my board with rshell now, and stuck at not knowing what "TYPE" or "TYPE_PARAMS" is supposed to mean in rshell.. the help method for connect method only says:

    connect TYPE TYPE_PARAMS
    connect serial port [baud]
    connect telnet ip-address-or-name

    EDIT:
    Or the other parameters as well for that sake. I really don't understand when you make something like this, why not also make a good description and examples of everything.



  • @soren If serial is working in a sense that you get a REPL prompt with a serial terminal like screen, then you could try Adafruit's ampy tool or Dave Hylands' rshell (https://github.com/dhylands/rshell). They both are pretty generic and allow to exchange scripts with the board and run them. This way, you can also set your board again for ftp. The script I use on my LoPy to set it to station mode is:

    import network
    import time
    # setup as a station
    wlan = network.WLAN(mode=network.WLAN.STA)
    wlan.connect(ssid=MY_SSID, auth=(network.WLAN.WPA2, MY_PASSWD))
    while not wlan.isconnected():
        time.sleep_ms(50)
    wlan.ifconfig(config=(MY_FIXED_IP, "255.255.255.0", MY_GATEWAY,  MY_DNS))
    print(wlan.ifconfig())
    

    Obviously, you have to set the proper values for MY_xxx. If you do not need a fixed address, you can skip the line with wlan.ifconfig()



  • @jmarcelino Hey, OK so I think I got serial working now, but I still can't sync my project from pymakr... just keeps saying "syncing failed".. is this because there is already bootleader on the lopy? remember, I can't get into ftp because I tried changing wlan password which didn't work and now I can't connect to it.



  • @soren
    You really need serial working to recover properly.

    I suspect your problem is that AppleUSBFTDI.kext is overriding your other FTDI driver.

    There's also FTDIKext.kext - did you install more FTDI drivers in OSX other than the VCP by any chance?

    Try to disable AppleUSBFTDI manually by doing

    cd /System/Library/Extensions/IOUSBFamily.kext/Contents/PlugIns
    sudo mv AppleUSBFTDI.kext AppleUSBFTDI.disabled

    and then restarting. This will prevent it from loading and might allow the correct one to work.

    EDIT That said I'm now more suspicious of the D2xxHelper you listed, let me know if you installed any more drivers from FTDI. You may need to disable more.



  • You could try the safe boot procedure https://docs.pycom.io/pycom_esp32/_downloads/wipy_pinout.pdf. But I'm not sure whether that brings you back to the standard WiFi credentials. I think so, but cannot remember, whethe rI've gone this path once.
    You mentioned to have tried Windows. You need the VCP driver von Windows too. But that should be less of a problem. The easient choice is Linux! You could try to boot a PC (or MAC?) with a Linux test image. Most distributions have images which you can boot from USB or DVD. Try Ubuntu, Lint or Knoppix.



  • @robert-hh hi Robert, thanks for your reply.

    So I managed to get an FTP access up and running (awesome!!) but I also managed to try and change the server and wlan login credentials, which now resulted in the lopy not showing up as a wlan.. (well f*'** done soren).. so now I literally have no idea how to get access to my lopy with USB not working propperly.. any ideas ?

    EDIT
    did a factory reset, but this did not seem to change my boot and main files.. which means i still can't see the lopy on wifi



  • I agree, stick with telnet + ftp for development and leave the serial connection for firmware upgrades and debugging.

    I do think you have too many serial drivers installed and active and - as they say, too many serial drivers in the kitchen spoils the broth - you'll need to actually disable or delete the ones you don't need.



  • When you say: "synched a project", does thar mean you#re using Pymakr? If yes, don't do that. Pymakr simply adds another layer of strange issues. Better use basic tools, like an ftp client of your choice, screen or telnet, ...
    There you have much better response, and if you have issues, the reason is obvious.



  • Just saw your edit on the original post. Glad you got it working in the end!

    Yeah USB serial drivers can be a confusing mess - and actually FTDI has some of the best drivers.



  • @jmarcelino
    so, after being able to connect and I synced a project several times - now I suddenly am back to being unable to connect. I did not reboot my system.. It just tells me "invalid device address.." and the lopy doesn't show up in configurations.. this has got to be the most uneasy mcu i've ever dealt with



  • @jmarcelino said in Firmware update, not possible on either windows or mac osx...:

    kextfind -case-insensitive -bundle-id -substring 'FTDI' -print

    kextfind gives me:
    /System/Library/Extensions/AppleUSBFTDI.kext
    /Library/Extensions/D2xxHelper.kext
    /Library/Extensions/FTDIKext.kext
    /Library/Extensions/FTDIUSBSerialDriver.kext

    this is so weird though. trying to unload the mac ftdi driver with:

    sudo kextunload -b com.apple.driver.AppleUSBFTDI

    just gives me:

    Can't create –b.
    Can't create com.apple.driver.AppleUSBFTDI.



  • @soren
    Yes it's not loading the driver for some reason. Can you post the result of:

    kextfind -case-insensitive -bundle-id -substring 'FTDI' -print

    to see if it's correctly installed and if there's any conflicts?

    you can also try manually loading it with

    sudo kextload -bundle-id com.FTDI.driver.FTDIUSBSerialDriver



Pycom on Twitter