NUCLEO_F446RE

Discussion and questions about boards that can run MicroPython but don't have a dedicated forum.
Target audience: Everyone interested in running MicroPython on other hardware.
User avatar
Guenther78
Posts: 25
Joined: Fri May 19, 2017 11:48 am

NUCLEO_F446RE

Post by Guenther78 » Tue May 30, 2017 9:19 am

Hello Forum!

I am new to micropython. But I want to start with it. I have two boards:
A stm32f4-discovery and a NUCLEO_F446RE.

stm32f4-discovery:
From http://micropython.org/download I got the dfu-file, which I converted with the DFU file manager to a hex file. With ST-Link I flashed the stm32 and it worked. The board appears as a usb flash device in the explorer and i could make a connection with hyper term.

NUCLEO_F446RE:
Here the things are a bit more complicated. I did not find a hex file for it. So I will start to genarate it. How to adapt micropython to another stm32/nucleo board is explained here: http://www.carminenoviello.com/2015/06/ ... nucleo-f4/
So I create a new folder named "NUCLEO_F446RE", dowmloaded the compiler arm-none-eabi-gcc and added the compiler to the path variable of the cmd. And I downloaded micropython-master.zip, unzipped it and copied it to the home folder in cygwin.
With cygwin I tried to build micropython for the the board.

The build-process:
I followed the instructions from the Readme file in the stmhal subfolder. First I made the cross-compiler mpy-coss (with gcc?) and then I tried to create micropython with "make BOARD=NUCLEO_F446RE". The process failed, the error mesage was:

MPY modules/lcd160cr.py
Traceback (most recent call last):
File "modules/lcd160cr.py", line 1
SyntaxError: invalid syntax
make: *** [../py/mkrules.mk:117: build-PYBV10/frozen_mpy/lcd160cr.mpy] Fehler 1

So I tried it again with the default board PYBV10. The same error appears.

My questions:
- is it right that mpy-cross is build with gcc?
- what does mpy-cross do?
- is there a way to eliminate the module lcd160cr.py?

Best regards and thanks in advance,
Guenther

Damien
Site Admin
Posts: 647
Joined: Mon Dec 09, 2013 5:02 pm

Re: NUCLEO_F446RE

Post by Damien » Wed May 31, 2017 4:13 am

Building with cygwin has some difficulties, like: 1) symlinks don't work in cygwin; 2) command-line lengths can overflow; 3) any "strange" characters (eg parenthesis) in path/filenames might break the build. The lcd160cr.py error is related to symlinks not working. The best option is to install a Linux VM and build the code within that. Otherwise, if you want to try and get cygwin working, see https://github.com/micropython/micropython/issues/2961 and https://github.com/micropython/micropython/issues/3116

User avatar
Guenther78
Posts: 25
Joined: Fri May 19, 2017 11:48 am

Re: NUCLEO_F446RE

Post by Guenther78 » Wed May 31, 2017 7:03 am

Hello Damien!

Thanks a lot for Your reply. In th e first link a user had the same problem with lcd160cr.py, the user dpgeorge suggested to copy all the files from drivers/display/ to stmhal/modules/.
And that works! Now a dfu-file and a hex-file is build. I wiill make some tests now...

Best Regards,
Guenther

User avatar
Guenther78
Posts: 25
Joined: Fri May 19, 2017 11:48 am

Re: NUCLEO_F446RE

Post by Guenther78 » Thu Jun 01, 2017 11:15 am

Hello Forum!

I flashed the STM32F446 with ST-Link. Flashing and Verifying was succesful. But my new problem is the working with micropython.
The Nucleo board appears as a USB flash device in the explorer. It contains two files, DETAILS.TXT and MBED.HTM.

My STM32F4 discovery board also appeared as a flash device, but with the fiiles boot.py and main.py. But only, when I plugged in the mico USB cable. I think, that after flashing wiith the micropython firmware, the only task of the mini USB is the 5V power supply. Is that right?

But now back to the problem:
I tried to connect with Hyperterminal. The connection was succesful. After each press of the reset button, some characters are send to the terminal, but no REPL started.
I also tried to connect with putty, but there were no connection possible.
The user shaoziyang showed in viewtopic.php?f=12&t=2343&p=14529&hilit=nucleo#p14529 how to connect Nucleo to a PC via USB. I tried it also. Because I did it with a USB A instead of a micro, I only connect 4 wires, I did'nt contact the ricght one. This is AGND and sbhould be shortened to GND. It should work, the pinout of the connector CN10 should be the same for every NUCLEO board. But it does'nt.

Has anyone of You an idea?

Best regards and thanks in advance,
Guenther

User avatar
dhylands
Posts: 3821
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: NUCLEO_F446RE

Post by dhylands » Thu Jun 01, 2017 4:47 pm

The filesystem with DETAILS.TXT and MBED.HTM is from the STLINK processor on the board and not from the F446.

On the nucleo board, unless you wire in a USB connector you won't be able to see the filesystem from the F466.

In your board configuration, you'll want the REPL on UART 2 like this:
https://github.com/micropython/micropyt ... .h#L21-L22
and then, if everything is working fine, you should be able to the REPL on the usb-serial port. You'll need to make sure that you've configured your terminal program to use the same baud rate as what's set in your configuration.

User avatar
Guenther78
Posts: 25
Joined: Fri May 19, 2017 11:48 am

Re: NUCLEO_F446RE

Post by Guenther78 » Fri Jun 02, 2017 1:14 pm

Hello Dave,

thanks for the info. I looked closer to the STM32 Nucleo document and saw, that I also used the wrong pins. I have to use PA2 and PA3 from CN10. And I have to remove the solder bridges SB13 and SB14 and shorten SB62 and SB63.
Windows 7 sees an unknown device. But I will try it at home with windows 10 and Ubuntu.
Or do I need an USB/serial converter?
LED1 (the three color) is blinking with about 1 Hz in red: before USB initialization (but I think it regards to STM32F103)
And the red power LED3 is on, the supply should be ok.

Best Regards,
Guenther

User avatar
dhylands
Posts: 3821
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: NUCLEO_F446RE

Post by dhylands » Sat Jun 03, 2017 12:16 am

Yeah - by default PA2/PA3 are wired through to the STLInk processor

So you'd unsolder SB13 & SB14 (this disconnects the F103 from the F446) and make sure SB62 & 63 are soldered (this connects the F446 to D0/D1 on CN9 and pins 35/37 on CN10

I just took a look and it turns out I have a NUCLEO F446 board. It has 62 & 63 unsoldered and 13 & 14 are soldered (zero ohm resistors).

I'll see if I can get my board working.

The signals on CN10 are going to be 3.3v logic level serial. The unknown device is most likely for the USB serial on the F103 chip, and once you remove SB13/14 then the F103 basically acts like a usb-to-serial converter with Tx and Rx on the TX/RX jumper on CN3.

User avatar
Guenther78
Posts: 25
Joined: Fri May 19, 2017 11:48 am

Re: NUCLEO_F446RE

Post by Guenther78 » Sat Jun 03, 2017 11:14 am

I connected Rx and Tx from CN10 to CN3.
After plug in of the USB LD1 is red (initialization ready) and the connection to hyperterm can be done.

But after I plug out the USB and plug in, both while I'm connected to Hyperterm, LD1 is green.
But repl doesn't run...

I downloaded the file bybcdc.inf, but windows doesn't let me install it.
Now I will shutdown windows and start with my Linux partition.

Added one hour later:
But it is also possible with Windows 10, the installation of unsigned drivers had to be allowed.

User avatar
dhylands
Posts: 3821
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: NUCLEO_F446RE

Post by dhylands » Sat Jun 03, 2017 8:44 pm

I created a PR to add board definition files for the 446 here:
https://github.com/micropython/micropython/pull/3127

Using a virgin NUCLEO_F446RE, I get a REPL using the usb-serial on stilnk processor:

Code: Select all

MicroPython v1.9-22-g2c33a9c14 on 2017-06-03; NUCLEO-F446RE with STM32F446xx
Type "help()" for more information.
>>>
I set the clock up to run at 168 MHz, which allows the USB (if you add a connector) to run at 48 MHz. In order to run at 180 MHz and get a nice clock for the USB, I think that the USB would need to use the PLLSAI clock rather than the main PLL clock.

User avatar
Guenther78
Posts: 25
Joined: Fri May 19, 2017 11:48 am

Re: NUCLEO_F446RE

Post by Guenther78 » Sun Jun 04, 2017 8:05 am

Great, thanks a lot.

I haven't got a REPL yet, I will try it with your new PR this afternoon.

Post Reply