-
-
Notifications
You must be signed in to change notification settings - Fork 8.2k
ports/nrf: Add support for Arduino Nano 33 BLE board. #8577
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
Conversation
0f68dab
to
c7686c1
Compare
c7686c1
to
3ad1cc3
Compare
3ad1cc3
to
2767333
Compare
We need to think of a way to manage the device drivers. They are generic so better to place them in |
2767333
to
43375a8
Compare
I agree, but I think that's beyond the scope of this PR, and should be discussed further as part of the larger MicroPython drivers/modules/repo discussion. That said, I can move the sensor drivers to |
Yes it is out of scope to solve the problem of drivers here. But I think it would be good to put them in |
Done! |
43375a8
to
71caea9
Compare
71caea9
to
542b992
Compare
@dpgeorge I think I made a small typo here after removing lambda, should have removed the call here: self._go_idle = machine.idle() To
|
Yes, that will need to be fixed. But, maybe it's better to implement |
There's a |
FYI, |
Yes, sorry I forgot, you need to make |
That wasn't my topic. usb_cdc_loop() only exists for devices which have MICROPY_HW_USB_CDC set. For all other devices, this fuction does not exist. So I extended mpconfigport.h a little bit. Like Makefile, this file tends to grow in an ugly way. |
@robert-hh I see now what you mean. I think it's best if you follow
EDIT There's no |
That's what I did, and it compiles for both board types. You can run a test now with the actual nrf_ctrl_c branch. I wonder if the changes to mpconfigport.h are actually required. |
Tested, seems to be working fine.
Yes they are, for example when call |
Thank. I want to make the minimal change. So I changed it to call tud_task(). The branch is updated. |
I think it's good, you should send a PR, at least it's working now. |
Thanks for testing and helping. |
Just a quick question, when you flashed the Nano 33 BLE SENSE, did you use BOSSA? I'm following the guide on the micropython site and it only gives me the error SAM-BA operation failed. I'm sorry if this is irrelevant, might be a hardware bug or something, but the firmware should be updated to allow flashing python, I managed to get the openMV port working, but without the ability to save the python scripts to device. |
I used with a Linux machine bossac, just the command given in the update documentation. But I had to install the new bootloader first, just as documented. |
Thanks for the quick reply, Hmm, I reflashed the new bootloader via the Nano33_updateBLandSoftDevice example, but am still getting the error after running this command. `bossac -e -w --offset=0x16000 --port=ttyACM0 -i -d -U -R arduino_nano_33_ble_sense-20220718-unstable-v1.19.1-169-g1d23c01dd.bin SAM-BA operation failed` Feels like I'm doing something wrong, or that my nano is faulty somehow. Bossa is on a raspberry pi, arduino ide is on a mac. |
Did you set the board to bootloader mode by pushing reset twice? The yellow led next to the USB board will pulse. |
yes, otherwise it will say that there is no device at that port, it's really odd. must be something wrong with my device. As I am getting the same error via 4 different computers there almost has to be something wrong with the nano, or the bootloader version that I have flashed, tried flashing using bossa via 2 raspberry pi models, one windows 10 computer and a macbook. Always the same error SAM-BA operation failed, and I have tried using the gui version of bossa on windows. flashed the bootloader via arduino ide 1 and 2 from mac and windows as well. LOL, only wanted to be able to share the same code as my new raspberry pico with micropython. |
Maybe it's that particular |
Bossac -V doesn't work, however seems to be version 1.9.1-1 in the debian/raspbian repos. I'll try your link thanks. |
That worked!, Big thanks man, you made my day haha. |
Right. I was lazy and use the pre-built version as well. Thanks for providing it @iabdalkader. |
Updated docs here: #8930 |
So another question, is there a quick way to erase the saved files from the arduino? I saved a main.py file to the device, which works great, a bit too great, now I am locked out. reflashing the bootloader and softdevice and erasing via bossac doesn't seem to work, or it works until i flash micropython again. |
It should be possible to upload a sketch from Arduino IDE, even if the board is running micropython. |
Yes, I saved a python blink example file into the arduino via micropython, which is autorunning at startup (main.py). So I tried to flash an arduino blink example to "clean" the flash, this works. I then flashed the softdevice again, and used bossac to flash micropython once again as well, the blink python example persists. I have also tried running bossac with the -e (erase option) -u (unlock) and -a (arduino-erase option), still the python script persists. This is a bit confusing haha, not the expected behaviour at all. |
If you can find out which sector is used for filesystem and erase it, that should do it, or you could just simply recreate the filesystem in boot.py. Note you could easily brick this board in the process. |
If you get a REPL prompt, you can delete main.py: import os.remove("main.py") Or you recreate the file system with: import _mkfs |
That's the issue, it doens't appear in /dev/usbmodem or /dev/ttyACM0 when it's running the code. so REPL is out of the equation sadly. |
That's indeed the case. A look into the source code shows, that usb_cdc_init() is called after running main.py (line 262-267, main.c). That's a problem. If you are able to build firmware, you could move the call to usb_cdc_init() up before executing boot.py. That seems anyhow to be the better place for code exchanging data over USB. |
There is a firmware here with moved usb_cdc_init(). https://github.com/robert-hh/Shared-Stuff/blob/master/firmware_arduino_nano_33_ble.bin |
Wow, thanks for fixing it. REPL works now. I know just enough about programming to make stuff break, but I recon someone else would have the same problem sooner or later. Greatly appreciated the help, now to learn some python and hopefully not break it again. |
You're welcome. Glad that it works for you. Meanwhile the fix is in the main code line, and will be part of the daily builds from tomorrow on. |
…11-10 update frozen libraries
Depends on the following PRs:
Note the apds9960 driver was Not added, because it's GPL.