While discovering MicroPython I updated my stm32f4-discovery with a pre-built DFU image I found, works great. My next attempt was at building an image for the BLACK_F407VE/ZE/ZG boards I've had laying around collecting dust (Pet rocks). Installed Ubuntu 16.04 on Windows 10 and followed the guide to build/setup MicroPython, spent some time weeding my way through all the ways to install the ARM Tools and finally found the working way.
BUT:
ImportError: No module named usb.core stops everything
kevin@Gate:~/micropython/ports/stm32$ make BOARD=BLACK_F407VE deploy
Use make V=1 or set BUILD_VERBOSE in your environment to increase build verbosity.
Writing build-BLACK_F407VE/firmware.dfu to the board
Traceback (most recent call last):
File "../../tools/pydfu.py", line 20, in <module>
import usb.core
ImportError: No module named usb.core
Makefile:455: recipe for target 'deploy' failed
make: *** [deploy] Error 1
These boards are prefect for a LoRa project with the RTC+Battery+8 pin connector for a NRF24L01
ImportError: No module named usb.core
Re: ImportError: No module named usb.core
You need to install the pyusb module. and/or depending on which version of python your distro uses for 'python'. Using apt is appropriate for ubuntu 16.04 and later. For other distros you may need to use a different installer.
Code: Select all
sudo apt install python-usb
Code: Select all
sudo apt install python3-usb
Re: ImportError: No module named usb.core
Did that but another issue, my Windows 10 hosted linux has no lsusb devices!
( Found: In Windows Insider build #16176 WSL now allows access to serial devices (COM ports).)
$ make BOARD=BLACK_F407ZE deploy
Use make V=1 or set BUILD_VERBOSE in your environment to increase build verbosity.
Writing build-BLACK_F407ZE/firmware.dfu to the board
Traceback (most recent call last):
File "../../tools/pydfu.py", line 541, in <module>
main()
File "../../tools/pydfu.py", line 521, in main
init()
File "../../tools/pydfu.py", line 80, in init
raise ValueError('No DFU device found')
ValueError: No DFU device found
Makefile:455: recipe for target 'deploy' failed
make: *** [deploy] Error 1
No problem, cp firmware.dfu /mnt/e/f407ze.dfu then use the STM dfu tool
BUT:
The ZE and VE builds worked and are now loaded with MicroPython: ZG
LINK build-BLACK_F407ZG/firmware.elf
arm-none-eabi-ld: warning: cannot find entry symbol _start; defaulting to 0000000000008000
text data bss dec hex filename
0 0 0 0 0 build-BLACK_F407ZG/firmware.elf
Create build-BLACK_F407ZG/firmware.dfu
GEN build-BLACK_F407ZG/firmware.hex
The firmware.dfu is 309 bytes
The firmware.hex is 34 bytes
I did a make -B BOARD=BLACK_F407ZG and a while later I got the same results, very little code if any at all. From https://github.com/SpotlightKid/BLACK_F407ZG
FYI: After I used the STM DFU loader I disconnected the USB cable (mini-usb), removed the jumper but when I plugged the usb cable back into the units no flash drive or USB. After they sat around for 20 minutes I plugged the VE back in and it worked, same with the ZE.
( Found: In Windows Insider build #16176 WSL now allows access to serial devices (COM ports).)
$ make BOARD=BLACK_F407ZE deploy
Use make V=1 or set BUILD_VERBOSE in your environment to increase build verbosity.
Writing build-BLACK_F407ZE/firmware.dfu to the board
Traceback (most recent call last):
File "../../tools/pydfu.py", line 541, in <module>
main()
File "../../tools/pydfu.py", line 521, in main
init()
File "../../tools/pydfu.py", line 80, in init
raise ValueError('No DFU device found')
ValueError: No DFU device found
Makefile:455: recipe for target 'deploy' failed
make: *** [deploy] Error 1
No problem, cp firmware.dfu /mnt/e/f407ze.dfu then use the STM dfu tool
BUT:
The ZE and VE builds worked and are now loaded with MicroPython: ZG
LINK build-BLACK_F407ZG/firmware.elf
arm-none-eabi-ld: warning: cannot find entry symbol _start; defaulting to 0000000000008000
text data bss dec hex filename
0 0 0 0 0 build-BLACK_F407ZG/firmware.elf
Create build-BLACK_F407ZG/firmware.dfu
GEN build-BLACK_F407ZG/firmware.hex
The firmware.dfu is 309 bytes
The firmware.hex is 34 bytes
I did a make -B BOARD=BLACK_F407ZG and a while later I got the same results, very little code if any at all. From https://github.com/SpotlightKid/BLACK_F407ZG
FYI: After I used the STM DFU loader I disconnected the USB cable (mini-usb), removed the jumper but when I plugged the usb cable back into the units no flash drive or USB. After they sat around for 20 minutes I plugged the VE back in and it worked, same with the ZE.
Re: ImportError: No module named usb.core
It seems the BLACK_F4 are all using F405 linker and AF definitions except the ZG board, I change that to match the ZE board since the ZE was using the 1MB flash F405 linker code.... which includes ethernet for F405 devices, someday I'll spend the time to figure that out. D407ZG now works!