Page 1 of 1

[Solved]Display PYFLASH of STM32L4R9IDISC in Ubuntu/Window

Posted: Thu Nov 28, 2019 11:10 am
by ndhuy
Hi everyone,

It's me again, Huy.

Currently, our team is working on a project:writing Python on STM32L4R9I DISCOVERY (MicroPython).

The situation of our team team is: we could write MicroPython on the board ( but only command lines in terminal of ubuntu). Also, we could connect the OTG USB and as we type in "lsusb" in Ubuntu as well as in Device Manager of Window we could see the OTG. In addition, we could write MicroPython via OTG.

However, as we connect the board to Ubuntu, there is no disk appearing. (In Window also). By which i mean, there is no main.py and boot.py appearing for us to write.

As in Device Manager, the "Mass Storage Device" appears in USB Controller, but we cannot see anything in COM PORT. The computer of a friend of mine could display COM PORT (PyBoard Comm Port) but no disk.

So I need help to display the Disk (display files mentioned above).

Thank you very much,

Nguyen Duc Huy

Re: Display PYFLASH of STM32L4R9IDISC in Ubuntu/Window

Posted: Thu Nov 28, 2019 12:04 pm
by Kip
I'm not an expert at all, but I thought I'd ask.

Are you able to see the micropython interpreter (REPL) with screen or picocom or whatever you use? If so, what happens when you:

import os
os.listdir()

Sent from my Pixel 2 XL using Tapatalk


Re: Display PYFLASH of STM32L4R9IDISC in Ubuntu/Window

Posted: Fri Nov 29, 2019 2:38 am
by ndhuy
Kip wrote:
Thu Nov 28, 2019 12:04 pm
I'm not an expert at all, but I thought I'd ask.

Are you able to see the micropython interpreter (REPL) with screen or picocom or whatever you use? If so, what happens when you:

import os
os.listdir()

Sent from my Pixel 2 XL using Tapatalk
Hi Kip,

For the first question, when i type in screen /dev/ttyACM0 115200 (I learn this trick from Jimmo), i can write MicroPython. The picture below may tell you. So i would say yes for the first question.

For the second one, as I type in the "os" command. The second picture is what it displayed.

Re: Display PYFLASH of STM32L4R9IDISC in Ubuntu/Window

Posted: Fri Nov 29, 2019 2:50 am
by Kip
Weird... you are getting a list of something that's there. What happens when you:

f = open("main.py", "w")
f.close()

Then re-run:

import os
os.listdir()

Perhaps this convo will help someone with more knowledge troubleshoot.

Sent from my Pixel 2 XL using Tapatalk


Re: Display PYFLASH of STM32L4R9IDISC in Ubuntu/Window

Posted: Fri Nov 29, 2019 7:06 am
by dhylands
If you had non-micropython firmware flashed on the board before flashing micropython, then you should do a mass erase and then flash micropython.

Or factory reset the filesystem as documented here: http://docs.micropython.org/en/latest/w ... filesystem

Whwn you flash micropython, it only flashes the firmware portion of the flash and not the filesystem portion, so it's possible that whatever happens to be in the flash where the filesystem lives looks enough like a filesystem to fool micropython into using it rather than thinking its invalid and erasing it.

Re: Display PYFLASH of STM32L4R9IDISC in Ubuntu/Window

Posted: Wed Dec 04, 2019 7:35 am
by ndhuy
dhylands wrote:
Fri Nov 29, 2019 7:06 am
If you had non-micropython firmware flashed on the board before flashing micropython, then you should do a mass erase and then flash micropython.

Or factory reset the filesystem as documented here: http://docs.micropython.org/en/latest/w ... filesystem

Whwn you flash micropython, it only flashes the firmware portion of the flash and not the filesystem portion, so it's possible that whatever happens to be in the flash where the filesystem lives looks enough like a filesystem to fool micropython into using it rather than thinking its invalid and erasing it.
Hi dhylands,
my problem is quite related as I am working with STM32L4R9I-DISC. when I check in the device manager on Windows, the USB OTG FS appears as USB serial device instead of Pyboard Comm Port in FS mode (as it appears on Ubuntu). Therefore, there is no Pyflash disk appears.
And also, the connection between the board and my laptop is unstable.
Are there any problems related to USB config? what should I do to config the USB to be appear as Pyboard Port?
Thank you,

Re: Display PYFLASH of STM32L4R9IDISC in Ubuntu/Window

Posted: Wed Dec 04, 2019 8:16 am
by shaoziyang
Delete ST device in device manager first, then search new device. ST drive may conflict with pyboard drive.