Q: Nucleo F401 with UART bootloader

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
dhylands
Posts: 3300
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: Q: Nucleo F401 with UART bootloader

Post by dhylands » Tue Jul 12, 2016 12:19 am

jgriessen wrote:Dang! If you're doing a board def., I need one of those boards too, just for the following along speedup it will give in making a board def for my version with pulsers, ADCs looking at voltage dividers down from high volts, and a USB connector just like the G30TH.
My preliminary, untested board definition files can be found here:
https://github.com/dhylands/G30TH

I'll test them as soon as I get my board.

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

Re: Q: Nucleo F401 with UART bootloader

Post by dhylands » Fri Jul 15, 2016 2:23 am

dhylands wrote:I've ordered one - it should be here by the end of the week.

I'll put together a G30TH board definition. It looks like the pins for the G30HDR are totally different from the G30TH.
The G30TH board definition can be found here: https://github.com/dhylands/G30TH

The G30TH doesn't have an onboard regulator, so you'll need to provide an external one. The USB power is available on V+ which can be used to power the regulator and provide 3.3v on the 3V3 signal.

I was able to get a MicroPython REPL (as much testing as I've done so far).

nmz787
Posts: 29
Joined: Sun Jul 10, 2016 7:57 am

Re: Q: Nucleo F401 with UART bootloader

Post by nmz787 » Fri Jul 15, 2016 5:41 am

dhylands wrote: The G30TH board definition can be found here: https://github.com/dhylands/G30TH
Thanks, I got mine yesterday... if I can get off the phone I might be able to get this going tonight (but maybe not)
dhylands wrote: The G30TH doesn't have an onboard regulator, so you'll need to provide an external one. The USB power is available on V+ which can be used to power the regulator and provide 3.3v on the 3V3 signal.
Regulator for what? If I'm plugging in the USB, it has got to have a regulator, I'd hope not a resistor divider!

*edit* hmm, is the LED dropping down to the 3.6V max spec in the datasheet for the part, from nominal 5V on USB?

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

Re: Q: Nucleo F401 with UART bootloader

Post by dhylands » Fri Jul 15, 2016 5:46 am

I put a more complete blog post up here: http://blog.davehylands.com/2016/07/bri ... n-ghi.html
nmz787 wrote:
dhylands wrote: The G30TH doesn't have an onboard regulator, so you'll need to provide an external one. The USB power is available on V+ which can be used to power the regulator and provide 3.3v on the 3V3 signal.
Regulator for what? If I'm plugging in the USB, it has got to have a regulator, I'd hope not a resistor divider!
The board doesn't include a regulator. If you plug the board into USB with no regulator, then the USB light will light up, and nothing else will happen (since the MCU needs 3.3v). For this board, the user has to supply the 3.3v. That's the purpose of the regulator.

nmz787
Posts: 29
Joined: Sun Jul 10, 2016 7:57 am

Re: Q: Nucleo F401 with UART bootloader

Post by nmz787 » Fri Jul 15, 2016 7:55 am

dhylands wrote:I put a more complete blog post up here: http://blog.davehylands.com/2016/07/bri ... n-ghi.html

The board doesn't include a regulator. If you plug the board into USB with no regulator, then the USB light will light up, and nothing else will happen (since the MCU needs 3.3v). For this board, the user has to supply the 3.3v. That's the purpose of the regulator.
I checked the G30TH schematic https://www.ghielectronics.com/download ... TH_SCH.pdf and indeed see what you're talking about. Ok, well good thing I had about 9 or so LM317T sitting in front of me on the desk as I read your comment and blog post.

Nothing too pretty, but it does the job
http://imgur.com/VuaqKEv

Got a REPL, but not after realizing the make command needed one extra touch for me:

Code: Select all

sudo make BOARD=G30TH deploy PYTHON=python3
I also first tried:

Code: Select all

pip install pyusb
pip3 install pyusb
sudo apt-get install binutils-arm-none-eabi gcc-arm-none-eabi
sudo apt-get install cmake libusb-1.0-0-dev libgtk-3-dev

Without the

Code: Select all

PYTHON=python3
python2 was getting used which has a different pyusb interface/API (apparently)

Well enough for tonight, thanks for the help. I see a file-system folder auto-open with the boot.py and main.py... so I will play with this tomorrow. Maybe I'll even take it into work (though I can't do a demo of the cap-sense LED program I made without an LED first I guess!)

nmz787
Posts: 29
Joined: Sun Jul 10, 2016 7:57 am

Re: Q: Nucleo F401 with UART bootloader

Post by nmz787 » Fri Jul 15, 2016 8:23 am

nmz787 wrote: Well enough for tonight, thanks for the help. I see a file-system folder auto-open with the boot.py and main.py... so I will play with this tomorrow. Maybe I'll even take it into work (though I can't do a demo of the cap-sense LED program I made without an LED first I guess!)
Yeah couldn't hold back...
Just went ahead and soldered an LED with a 220 Ohm resistor inline with the GPIO pin marked PB8, because in the ST datasheet it also had an associated alternate PWM/TIM (TIMer) function.
Code is slightly different for pins and timers, cap-sense LED code works, and it appears as a filesystem/drive... I can just edit with my GUI text editor of choice (sublime) and hit CTRL-S to save and my board seems to auto-update (or I just alt-tab into the console hooked to the virtual serial port, and hit CTRL-D or CTRL-C)
https://gist.github.com/nmz787/afc7fea4 ... ff=unified

See page 43 for the pin function map:
http://www.st.com/content/ccc/resource/ ... 102166.pdf

I will grep the source files (I am guessing in your G30TH repo) for how to customize the pin names and such like: pyb.Pin.board.JP32

Thanks Dave! Definitely less buggy and feels like Python should!!!
Last edited by nmz787 on Thu Jul 28, 2016 9:25 am, edited 1 time in total.

nmz787
Posts: 29
Joined: Sun Jul 10, 2016 7:57 am

Re: Q: Nucleo F401 with UART bootloader

Post by nmz787 » Fri Jul 15, 2016 8:28 am

Hmm, strangest thing I am seeing now is that main.py is running even though I don't import it in boot.py (it is commented out)... oh well, not such a big deal as not being able to upload files or make edits easily.

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

Re: Q: Nucleo F401 with UART bootloader

Post by dhylands » Fri Jul 15, 2016 3:42 pm

boot.py isn't supposed to import main.py.

You can call pyb.man('foo.py') to tell MicroPython the name of 'main'. If you don't call it, then it defaults to 'main.py'.

The C code ALWAYS does an execfile on the function named by pyb.main(), and if pyb.main was never called then the name defaults to "main.py", so if you import it in boot.py then it will get called twice.

The only reason boot.py and main.py exist as 2 seperate entities is that boot.py is called BEFORE USB is initialized and main.py is called AFTER USB is initialized.

The board pins are defined in pins.csv. You can also provide your own names in your python source (see: http://docs.micropython.org/en/latest/p ... b.Pin.html)

Post Reply