For the pyboard D-series you must enter the mboot DFU bootloader by holding down the USR button, pressing and releasing the RST button, and continuing to hold down USR until the LED is white (4th in the cycle), then let go of USR while the LED is white. The LED will then flash red once per second to indicate it is in USB DFU mode. You can then program the firmware using a DFU programmer, eg dfu-util or pydfu.py.
dfu-util 0.9
Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2016 Tormod Volden and Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to http://sourceforge.net/p/dfu-util/tickets/
Match vendor ID from file: 0483
Match product ID from file: df11
Deducing device DFU version from functional descriptor length
Opening DFU capable USB device...
ID 0483:df11
Run-time device DFU version 011a
Claiming USB DFU Interface...
Setting Alternate Setting #0 ...
Determining device status: state = dfuIDLE, status = 0
dfuIDLE, continuing
DFU mode device DFU version 011a
Device returned transfer size 2048
DfuSe interface name: "Internal Flash "
file contains 1 DFU images
parsing DFU image 1
image for alternate setting 0, (2 elements, total size = 901712)
parsing element 1, address = 0x08008000, size = 411088
Download [=========================] 100% 411088 bytes
Download done.
parsing element 2, address = 0x90000000, size = 490608
Download [=========================] 100% 490608 bytes
Download done.
done parsing DfuSe file
Unfortunately, the error is the same with the current firmware bringing in MicroPython v1.11.
offgrid:hiveeyes-micropython-firmware amo$ make console
Device port: usb => /dev/cu.usbmodem1412
Connecting via serial port /dev/cu.usbmodem1412.
.venv3/bin/miniterm.py /dev/cu.usbmodem1412 115200
--- Miniterm on /dev/cu.usbmodem1412 115200,8,N,1 ---
--- Quit: Ctrl+] | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H ---
1.2890 [terkin.device ] INFO : Turning off LTE modem
Traceback (most recent call last):
File "main.py", line 43, in <module>
File "main.py", line 38, in main
File "datalogger.py", line 119, in start
File "device.py", line 287, in power_off_lte_modem
File "logging/__init__.py", line 72, in exception
AttributeError: 'module' object has no attribute 'exc_info'
MicroPython v1.11-312-g22099ab88 on 2019-09-15; PYBD-SF2W with STM32F722IEK
We got some valuable information from the MicroPython core developers and finally closed the issue at upstream [1].
sys.exc_info() is not enabled by default on MicroPython as it is not 100% compatible with the CPython version.
Following that discussion, we will adapt the MicroPython code to a different error handling pattern by propagating the exception object into log.exc(ex) instead of using the log.exception() method which gets the exception object by invoking sys.exc_info().