Page 1 of 1

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

Posted: Sat Jul 31, 2021 6:13 pm
by akushva
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

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

Posted: Sun Aug 01, 2021 3:44 pm
by pythoncoder
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.

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

Posted: Mon Aug 02, 2021 6:31 am
by akushva
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' ...

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

Posted: Mon Aug 02, 2021 7:10 am
by pythoncoder
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...

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

Posted: Mon Aug 02, 2021 7:15 am
by akushva
@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']

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

Posted: Mon Aug 02, 2021 7:24 am
by pythoncoder
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.

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

Posted: Mon Aug 02, 2021 7:32 am
by akushva
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.

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

Posted: Mon Aug 02, 2021 7:45 am
by pythoncoder
OK, it seems like your filesystem is broken. I'm afraid we need a Zephyr expert now.