-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Getting files onto NRF52 #912
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I think the WebREPL had a file upload functionality? |
@deshipu I'm an idiot. I was using the Espruino webREPL - just googled micropython WebREPL - and yes it has that functionality. The documentation on the NRF52 could use some editing - a few steps were missing/unexplained. Thanks. |
https://micropython.org/webrepl/? does not allow me to use WebBluetooth :( |
There are instructions for adding support for the WebBluetooth here. |
I have done so, and I can access the REPL with this: (https://glennrub.github.io/webbluetooth/micropython/repl/), but unlike (https://micropython.org/webrepl/), there is no option to upload a file so I can get my code running. |
Ah - sorry -- I just reread your earlier posts and see that. |
@jerryneedell Apologies for my ignorance - but how do I create a frozen module? |
It's been awhile since I played with this, but there is an example here: |
see: https://github.com/adafruit/circuitpython/blob/master/ports/nrf/Makefile#L360 |
Here is an example executing the freeze/test.py build into the current master
|
better example- I copied thhese files to the freeze folder"
rebuilt and uploaded then executed them:
|
building code into "freeze" is certainly not ideal for testing but it does work if you have no other way to get code uploaded. It would be great to have upload capability added to the BLE REPL Good luck! |
@jerryneedell Fantastic! Thank you. And thank you for the examples. I just had a chance to test and it is working perfectly! Now at least I can get going, I don't mind that it takes a while currently. |
Next question - how do I get a file in frozen to run on boot? As Main.py in root does? |
This is a bit hacky, but you could create a with open("main.py", "w") as f:
f.write("import yourfile") |
but how can you get the main.py file loaded :-( |
never mind - I see what you did there ;-) |
@deshipu suggestion works great! |
then to remove it:
nice! |
Really sorry for my ignorance here, but @deshipu - I created a main.py with the code you posted and I am just getting an error when I try to run it. I'm assuming I should be doing something different. Could you perhaps post an example as you did previously @jerryneedell ? I typed the command in directly, but no luck. |
Assuming you have blinky.py in the freeze folder and have loaded the version of CP with it so you can run
ok
then reboot and it should run on boot. Demo in a few minutes. |
here is a demo:
LED is blinking Note: you need to keep hitting "ENTER" 3 tines after typing the 2nd line to get it to execute |
When the ... appears, do I just wait or press enter? |
hit enter 3 times to execute the write -- looks like you did that and got OSError 5 -- that is an I/O error. |
Tried it with a different board just now - Feather52 instead of the RuuviTag - same problem (OSError: 5). Heading home and will check again. Thanks for the help so far. |
FYI - I am using a feather52 as well. Good luck! |
One difference - I am not using the BLE REPL -- using USB for the feather52. Not sure if or why it may matter. |
Well, you put it on the filesystem. |
I just confirmed that when using BLE REPL - attempting to write fails with OSError 5 |
It looks like there is some difference in the FS initialization when BLE REPL is enabled. I noticed that at some point in my testing, it recreated the FS leaving only a lib folder. This done in supervisor/filesystem.h if no FS is found.
the is a lot going on with the FS at startup. Still trying to understand what is different under BLE REPL |
Closing this in favor of #1010 |
Hi,
I finally received my J-link and programmed three different NRF52 boards, but on the one I want to use it most (Ruuvi tag), I am not sure how to load the code. It does not have a serial connection that is enabled(and I have no idea how to get it running), nor a USB port. The WebREPL via webBluetooth is working, but none of the REPL file transfer programs (or Ampy) supports that. I do have a Bluefruit LE Friend (UART) but for that I first need the NRF52 to connect etc.
Is it possible to use SWD to upload the code, instead of transferring the files?
The text was updated successfully, but these errors were encountered: