← index #5548PR #4877
Off-topic · high · value 2.926
QUERY · ISSUE

STM32: Not able to build mboot without USB and user switch

openby marc-baopened 2020-01-18updated 2020-01-20
port-stm32

I'm trying to do a board without a USB or switch, using the STM32F411. I want to use MBOOT to update the FW only when it is called from within an application so have no need for a USB or switch. It will use an external SPI flash chip. I've got this working on the basic pyboard.

I've declared the below - yet MBOOT gives multiple errors when calling sudo make BOARD=NAME__ USE_MBOOT=1 clean all

#define MICROPY_HW_HAS_SWITCH (0)
#define MICROPY_HW_ENABLE_USB (0)
#define MICROPY_HW_USB_FS (0)

Is there a way to use MBOOT without a USB or switch?

CANDIDATE · PULL REQUEST

stm32/mboot: Automatically reboot when USB is disconnected.

closedby andrewleechopened 2019-06-27updated 2019-10-08
port-stm32

This mboot PR detects when USB is disconnected (after being connected) and automatically resets back out of mboot mode.

I'm not confident my method is the cleanest, though from a search online of stm hal related posts I couldn't see a particularly official way of detecting disconnects.

In our (battery powered) application, it's not always obvious when the unit is in mboot mode (our user leds are via i2c driver so not as easily used in mboot). As such we can have a user thinking the unit is powered down, but the unit doesn't respond as expected due to it actually still running mboot.

When the unit automatically resets itself after being unplugged from USB these concerns disappear.

Keyboard

j / / n
next pair
k / / p
previous pair
1 / / h
show query pane
2 / / l
show candidate pane
c
copy suggested comment
r
toggle reasoning
g i
go to index
?
show this help
esc
close overlays

press ? or esc to close

copied