[RSHELL on nucleo L476rg ] Unable to copy py files to flash

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
Post Reply
akushva
Posts: 19
Joined: Fri May 03, 2019 10:08 am

[RSHELL on nucleo L476rg ] Unable to copy py files to flash

Post by akushva » Sat Jul 31, 2021 6:13 pm

Hello,

I'm currently using a nucleo L476rg board. I've been successfully able to connect the board via rshell-

Code: Select all

D:\nw\upython\stm32\nucleo_l46rg\code> connect serial com11 115200
Connecting to com11 (buffer-size 512)...
Trying to connect to REPL  connected
Retrieving sysname ... pyboard
Testing if sys.stdin.buffer exists ... Y
Retrieving root directories ... /flash/
Setting time ... Jul 31, 2021 23:33:23
Evaluating board_name ... pyboard
Retrieving time epoch ... Jan 01, 2000


But when I use the command to put any file into flash the prompt just hangs and nothing happens

Code: Select all

D:\nw\upython\stm32\nucleo_l46rg\code> cp main.py /flash
Copying 'D:\nw\upython\stm32\nucleo_l46rg\code/main.py' to '/flash/main.py' ...
Also, I've noticed that I'm unable to write any new file using REPL. When ever I use file.write line the REPL just hangs.

FYI -I have connected the selectable jumpers to access UART2 via CN9 and I'm using a TTL-USB converter to access the device.

I would appreciate any help in this matter

Thanks

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: [RSHELL] Unable to copy py files to flash

Post by pythoncoder » Sun Aug 01, 2021 3:44 pm

I'm not familiar with your board but it sounds as if you have no filesystem. I would try, at the REPL,

Code: Select all

import os
os.listdir('/')
If it throws an exception I would strongly suspect that somehow your filesystem is missing. If you report the outcome, hopefully someone with knowledge of the board will respond. I'll change the title of your OP to reference the board.
Peter Hinch
Index to my micropython libraries.

akushva
Posts: 19
Joined: Fri May 03, 2019 10:08 am

Re: [RSHELL on nucleo L476rg ] Unable to copy py files to flash

Post by akushva » Mon Aug 02, 2021 6:31 am

Thanks for your prompt reply @pythoncoder.
I tried the commands as per your suggestion.
I got ['Flash'] after running the commands and then I again tried putting a .py file into flash and nothing happened. I waited for whole 5 minutes and the screen was stuck at the last line in the code mentioned below-

Code: Select all

D:\nw\upython\stm32\nucleo_l46rg\code> connect serial COM11
Connecting to COM11 (buffer-size 512)...
Trying to connect to REPL  connected
Retrieving sysname ... pyboard
Testing if sys.stdin.buffer exists ... Y
Retrieving root directories ... /flash/
Setting time ... Aug 02, 2021 11:46:25
Evaluating board_name ... pyboard
Retrieving time epoch ... Jan 01, 2000
D:\nw\upython\stm32\nucleo_l46rg\code> repl
Entering REPL. Use Control-X to exit.
>
MicroPython v1.14 on 2021-02-02; NUCLEO-L476RG with STM32L476RG
Type "help()" for more information.
>>>
>>> import os
>>> os.listdir('/')
['flash']
>>>
D:\nw\upython\stm32\nucleo_l46rg\code> cp main.py /flash
Copying 'D:\nw\upython\stm32\nucleo_l46rg\code/main.py' to '/flash/main.py' ...

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: [RSHELL on nucleo L476rg ] Unable to copy py files to flash

Post by pythoncoder » Mon Aug 02, 2021 7:10 am

Try

Code: Select all

import os
os.listdir('/flash')
I still think your filesystem is very fishy. I do hope someone who knows Zephyr rocks up...
Peter Hinch
Index to my micropython libraries.

akushva
Posts: 19
Joined: Fri May 03, 2019 10:08 am

Re: [RSHELL on nucleo L476rg ] Unable to copy py files to flash

Post by akushva » Mon Aug 02, 2021 7:15 am

@Pythoncoder I tried the commands and this is what I got

Code: Select all

D:\nw\upython\stm32\nucleo_l46rg\code> repl
Entering REPL. Use Control-X to exit.
>
MicroPython v1.14 on 2021-02-02; NUCLEO-L476RG with STM32L476RG
Type "help()" for more information.
>>>
>>>
>>> import os
>>> os.listdir('/flash')
['boot.py']

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: [RSHELL on nucleo L476rg ] Unable to copy py files to flash

Post by pythoncoder » Mon Aug 02, 2021 7:24 am

OK, so there is something there. Now see if you can write to it in Python:

Code: Select all

with open('/flash/test', 'w') as f:
    f.write('hello\n')
import os
os.listdir('/flash')  # should see "test". If so, can we read it back?
with open('flash/test', 'r') as f:
    print(f.readlines())
If all this works your filesystem seems OK so maybe there is a communication issue.
Peter Hinch
Index to my micropython libraries.

akushva
Posts: 19
Joined: Fri May 03, 2019 10:08 am

Re: [RSHELL on nucleo L476rg ] Unable to copy py files to flash

Post by akushva » Mon Aug 02, 2021 7:32 am

I think the problem lies here.
The command line got stuck again when I entered those commands

Code: Select all

>>> MicroPython v1.14 on 2021-02-02; NUCLEO-L476RG with STM32L476RG
Type "help()" for more information.
>>> with open('/flash/test', 'w') as f:
...         f.write('hello\n')
...    ←[KK
Also, I'm getting '←[K' when I press 'Backspace' I hope that's not a problem.

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: [RSHELL on nucleo L476rg ] Unable to copy py files to flash

Post by pythoncoder » Mon Aug 02, 2021 7:45 am

OK, it seems like your filesystem is broken. I'm afraid we need a Zephyr expert now.
Peter Hinch
Index to my micropython libraries.

Post Reply