Impossible to upload, save or create program on stm32l432kc

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.
Post Reply
gbergero
Posts: 6
Joined: Fri Apr 12, 2019 11:36 am

Impossible to upload, save or create program on stm32l432kc

Post by gbergero » Fri Apr 12, 2019 12:20 pm

Hi,
Im pretty new to the micropython environment and ive managed to flash my stm32 using st-link stm32 utility and an .hex file. I can use putty and write micropython code and it seems to be working fine.
Here's the issue: I want to run a program on the device that I can save on it (like "main.py" or "boot.py" but I can't figure out how to do it. The device doesn't seem to have any file in its memory because when I write "os.listdir()" i get "[]". Ive tryed using ampy or rshell to upload a file that says "hello world" but I get an error everytime, I tryed creating a file on the stm32 using the command " os.mkdir('test.py')" or "os.open('test.py','w')" but that failed too. I read somewhere that there might be no file system on the device due to its small memory size. If that is the case, how do i upload or save a program on the board?
Thanks in advance

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

Re: Impossible to upload, save or create program on stm32l432kc

Post by dhylands » Fri Apr 12, 2019 3:16 pm

The NUCLEO_L432KC board doesn't have an internal file system. All python code needs to be included in the firmware as frozen modules.

gbergero
Posts: 6
Joined: Fri Apr 12, 2019 11:36 am

Re: Impossible to upload, save or create program on stm32l432kc

Post by gbergero » Fri Apr 12, 2019 3:39 pm

Hi Dave,
So is there anyway to edit the existing frozen module without having to re make the hex file I used to flash the device? The hex file was given to me by a co-worker so im not sure how he made it.
Thank you

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

Re: Impossible to upload, save or create program on stm32l432kc

Post by dhylands » Fri Apr 12, 2019 6:43 pm

Unfortunately - no. You'll need to rebuild the firmware with your new frozen module.

What I would probably do in a case like this is to pick a part with a larger flash and do your development on that, and then deploy on the smaller device, especially while you're learning. The NUCLEO-L476RG is also supported by micropython and it has lots of flash for an internal filesystem.

gbergero
Posts: 6
Joined: Fri Apr 12, 2019 11:36 am

Re: Impossible to upload, save or create program on stm32l432kc

Post by gbergero » Mon Apr 15, 2019 1:13 pm

Hi Dave, thanks for your previous response.
I would love to try the NUCLEO-L476RG but I would much prefer to do it straight up with the stm32l432kc because time is an issue in my situation. Do you have any tips on how to build my own firmware? I have no clue where to start as this is all pretty new to me.
Thank you

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

Re: Impossible to upload, save or create program on stm32l432kc

Post by dhylands » Mon Apr 15, 2019 2:33 pm

What platform will you be building on? Linux is probably the easiest.

gbergero
Posts: 6
Joined: Fri Apr 12, 2019 11:36 am

Re: Impossible to upload, save or create program on stm32l432kc

Post by gbergero » Mon Apr 15, 2019 2:33 pm

Windows 10 but i could use a raspberry pi with raspbian installed on it if needed.

Update : I managed to build the source code using this tutorial : http://hardytek.com/flashing-micropytho ... -nucleo/ and inserting the correct board name.

Post Reply