[Solved]Display PYFLASH of STM32L4R9IDISC in Ubuntu/Window

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
Post Reply
ndhuy
Posts: 23
Joined: Mon Nov 04, 2019 8:01 am

[Solved]Display PYFLASH of STM32L4R9IDISC in Ubuntu/Window

Post by ndhuy » Thu Nov 28, 2019 11:10 am

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
Attachments
Screenshot (312).png
Device Manager when connecting the BOARD
Screenshot (312).png (39.25 KiB) Viewed 149 times
Last edited by ndhuy on Thu Dec 05, 2019 1:33 am, edited 1 time in total.

User avatar
Kip
Posts: 25
Joined: Sat Dec 26, 2015 7:23 am

Re: Display PYFLASH of STM32L4R9IDISC in Ubuntu/Window

Post by Kip » 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


ndhuy
Posts: 23
Joined: Mon Nov 04, 2019 8:01 am

Re: Display PYFLASH of STM32L4R9IDISC in Ubuntu/Window

Post by ndhuy » Fri Nov 29, 2019 2:38 am

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.
Attachments
2019-11-28-2.png
os.listdir()
2019-11-28-2.png (101.88 KiB) Viewed 120 times
2019-11-28.png
REPL
2019-11-28.png (26.65 KiB) Viewed 120 times

User avatar
Kip
Posts: 25
Joined: Sat Dec 26, 2015 7:23 am

Re: Display PYFLASH of STM32L4R9IDISC in Ubuntu/Window

Post by Kip » Fri Nov 29, 2019 2:50 am

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


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

Re: Display PYFLASH of STM32L4R9IDISC in Ubuntu/Window

Post by dhylands » 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.

ndhuy
Posts: 23
Joined: Mon Nov 04, 2019 8:01 am

Re: Display PYFLASH of STM32L4R9IDISC in Ubuntu/Window

Post by ndhuy » Wed Dec 04, 2019 7:35 am

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,
Attachments
Screenshot (314).png
Screenshot (314).png (24.71 KiB) Viewed 54 times
Screenshot (313).png
Screenshot (313).png (39.45 KiB) Viewed 54 times

shaoziyang
Posts: 279
Joined: Sun Apr 17, 2016 1:55 pm

Re: Display PYFLASH of STM32L4R9IDISC in Ubuntu/Window

Post by shaoziyang » Wed Dec 04, 2019 8:16 am

Delete ST device in device manager first, then search new device. ST drive may conflict with pyboard drive.

Post Reply