Q: Nucleo F401 with UART bootloader
Re: Q: Nucleo F401 with UART bootloader
I found a blog about booting and compiling by cnoviello and his fork cnoviello/micropython which probably
was pulled into micropython/micropython in august 2015. Is there a good reference for loading micropython to Nucleo-F401RE,
or do I need to find it in forum posts?
was pulled into micropython/micropython in august 2015. Is there a good reference for loading micropython to Nucleo-F401RE,
or do I need to find it in forum posts?
John Griessen blog.kitmatic.com
Re: Q: Nucleo F401 with UART bootloader
I use the included stlink programmer to load code.
You can build using: and program using: You should then get a UART REPL using the USB cable (/dev/ttyACM0 for me). The filesystem that you see is from the stlink processor and not the '401. You'll need to use something like rshell to copy files into the filesystem on the '401.
You can build using:
Code: Select all
make BOARD=NUCLEO_F401RE
Code: Select all
make BOARD=NUCLEO_F401RE deploy-stlink
Code: Select all
MicroPython v1.8.1-90-gab8a5d5-dirty on 2016-06-26; NUCLEO-F401RE with STM32F401xE
Type "help()" for more information.
>>>
Re: Q: Nucleo F401 with UART bootloader
I tried installing rshell and not sure it's working right. First it could not connect as user john, since the /dev/ttyACM0You'll need to use something like rshell to copy files into the filesystem on the '401.
did not have permissions for it: crw-rw---- 1 root dialout 166, 0 Jun 27 18:04 /dev/ttyACM0
It runs fine as root, and when I do
ls -l /flash shows wrong thing relative to /root,
so I change perms:
sudo chown john /dev/ttyACM0
and it runs as you say.
What to do about permissions of /dev/ttyACM0 that pops in and out of existence? Does this need udev rules?
Thanks, John
John Griessen blog.kitmatic.com
Re: Q: Nucleo F401 with UART bootloader
I'm close, but not quite there yet:
john@ecolab3 [stmhal]make BOARD=NUCLEO_F401RE deploy-stlink
Use make V=1 or set BUILD_VERBOSE in your environment to increase build verbosity.
Writing build-NUCLEO_F401RE/firmware0.bin to the board via ST-LINK
make: st-flash: Command not found
Makefile:316: recipe for target 'deploy-stlink' failed
make: *** [deploy-stlink] Error 127
make: st-flash: Command not found --> Now how would I fix that? Hmmm?
https://github.com/texane/stlink looks like it, and there is a mention of udev rules even
john@ecolab3 [stmhal]make BOARD=NUCLEO_F401RE deploy-stlink
Use make V=1 or set BUILD_VERBOSE in your environment to increase build verbosity.
Writing build-NUCLEO_F401RE/firmware0.bin to the board via ST-LINK
make: st-flash: Command not found
Makefile:316: recipe for target 'deploy-stlink' failed
make: *** [deploy-stlink] Error 127
make: st-flash: Command not found --> Now how would I fix that? Hmmm?
https://github.com/texane/stlink looks like it, and there is a mention of udev rules even
John Griessen blog.kitmatic.com
Re: Q: Nucleo F401 with UART bootloader
Ahh right.
You need to install the st-flash utility.
https://startingelectronics.org/tutoria ... -in-Linux/
In order to build the stlink stuff I had to do:
You need to install the st-flash utility.
https://startingelectronics.org/tutoria ... -in-Linux/
In order to build the stlink stuff I had to do:
Code: Select all
sudo apt-get install automake
cd stlink.git
./autogen.sh
./configure
make
Re: Q: Nucleo F401 with UART bootloader
I've hit a wall finding out how to compile stlink from https://github.com/texane/stlink.
The environment variables LIBUSB_LIBRARY= and LIBUSB_INCLUDE_DIR="/usr/include"
are not intuitive and changing them seems to have no effect on error message output, so debugging
grinds to a halt.
in my debian jessie installation,
there is:
/usr/local/src/stlink/include/stlink/usb.h
and there is debian package installed:
ii libusb-0.1-4:amd64 2:0.1.12-25 amd64 userspace USB programming library
ii libusb-1.0-0:amd64 2:1.0.19-1 amd64 userspace USB programming library
ii libusb-dev 2:0.1.12-25 amd64 userspace USB programming library development files
and the system is aware of:
john@ecolab3 [stlink]locate usb.h
/home/john/micropython/stmhal/usb.h
/home/john/micropython/stmhal/hal/f2/inc/stm32f2xx_ll_usb.h
/home/john/micropython/stmhal/hal/f4/inc/stm32f4xx_ll_usb.h
/home/john/micropython/stmhal/hal/f7/inc/stm32f7xx_ll_usb.h
/home/john/micropython/stmhal/hal/l4/inc/stm32l4xx_ll_usb.h
/home/john/micropython/teensy/usb.h
Any help compiling stlink appreciated.
JG
The environment variables LIBUSB_LIBRARY= and LIBUSB_INCLUDE_DIR="/usr/include"
are not intuitive and changing them seems to have no effect on error message output, so debugging
grinds to a halt.
in my debian jessie installation,
there is:
/usr/local/src/stlink/include/stlink/usb.h
and there is debian package installed:
ii libusb-0.1-4:amd64 2:0.1.12-25 amd64 userspace USB programming library
ii libusb-1.0-0:amd64 2:1.0.19-1 amd64 userspace USB programming library
ii libusb-dev 2:0.1.12-25 amd64 userspace USB programming library development files
and the system is aware of:
john@ecolab3 [stlink]locate usb.h
/home/john/micropython/stmhal/usb.h
/home/john/micropython/stmhal/hal/f2/inc/stm32f2xx_ll_usb.h
/home/john/micropython/stmhal/hal/f4/inc/stm32f4xx_ll_usb.h
/home/john/micropython/stmhal/hal/f7/inc/stm32f7xx_ll_usb.h
/home/john/micropython/stmhal/hal/l4/inc/stm32l4xx_ll_usb.h
/home/john/micropython/teensy/usb.h
Any help compiling stlink appreciated.
JG
John Griessen blog.kitmatic.com
Re: Q: Nucleo F401 with UART bootloader
Did you install libusb-dev ?
It may also be called libusb-1.0-0-dev
I usually figure out the correct name by doing something like:
I've never had to touch LIBUSB_LIBRARY (or anything else in the Makefile). If I get a build error, it almost always means that I'm missing some dependency.
It may also be called libusb-1.0-0-dev
I usually figure out the correct name by doing something like:
Code: Select all
apt-cache search libusb | grep libusb | grep dev
Re: Q: Nucleo F401 with UART bootloader
I had libusb-dev, but not libusb-1.0-0-dev as shown by the apt-cache search.
Will do that. That did it.
Now getting gtk3 installed.
Thanks, JG
Will do that. That did it.
Now getting gtk3 installed.
Thanks, JG
John Griessen blog.kitmatic.com
Re: Q: Nucleo F401 with UART bootloader
I am able to rshell to my pyboard, but don't have the right settings for the nucleo-F401RE.
The serial port changed from /dev/ttyACM0 to /dev/ttyACM2 somehow.
rshell gives a message: No MicroPython boards connected - use the connect command to add one
Oh wait --- the prompt changed.
/home/john/micropython/stmhal>
It's not a remote machine though, just the current dir I ran the command in.
I figured it out:
john@ecolab3 [stmhal]export RSHELL_PORT=/dev/ttyACM2
john@ecolab3 [stmhal]rshell
Connecting to /dev/ttyACM2 ...
Welcome to rshell. Use Control-D to exit.
/home/john/micropython/stmhal> ls -l /flash
528 Jan 1 2015 README.txt
302 Jan 1 2015 boot.py
34 Jan 1 2015 main.py
2721 Jan 1 2015 pybcdc.inf
/home/john/micropython/stmhal>
The serial port changed from /dev/ttyACM0 to /dev/ttyACM2 somehow.
rshell gives a message: No MicroPython boards connected - use the connect command to add one
Oh wait --- the prompt changed.
/home/john/micropython/stmhal>
It's not a remote machine though, just the current dir I ran the command in.
I figured it out:
john@ecolab3 [stmhal]export RSHELL_PORT=/dev/ttyACM2
john@ecolab3 [stmhal]rshell
Connecting to /dev/ttyACM2 ...
Welcome to rshell. Use Control-D to exit.
/home/john/micropython/stmhal> ls -l /flash
528 Jan 1 2015 README.txt
302 Jan 1 2015 boot.py
34 Jan 1 2015 main.py
2721 Jan 1 2015 pybcdc.inf
/home/john/micropython/stmhal>
John Griessen blog.kitmatic.com
Re: Q: Nucleo F401 with UART bootloader
rshell only auto detects boards with a USB repl, so you'll need to use the connect serial command.
With the nucleo boards you're using a uart repl and the stink board is acting like a usb-to-serial adapter.
I also found that I had to drop the buffer size with rshell down to about 32 in order to transfer files. (Use --buffer-size=32 on the rshell command line).
With the nucleo boards you're using a uart repl and the stink board is acting like a usb-to-serial adapter.
I also found that I had to drop the buffer size with rshell down to about 32 in order to transfer files. (Use --buffer-size=32 on the rshell command line).