-
Notifications
You must be signed in to change notification settings - Fork 122
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
Support for Arduino Nano 33 BLE (Sense) #53
Comments
What would be needed to add support and close this issue? We're designing a nano 33 shield, and I would love to add PlatformIO support to the library. |
Should it rely on the ArduinoCore running on MBEDos or directly on MBEDos ? |
I would prefer if priority was given to the Arduino core based on Mbed OS framework. This is likely the better solution for most users and in particular for users coming from the Arduino IDE. |
In case anyone starts to work on this: the Arduino guys managed to build the nRF52 Arduino core upon an untagged branch of the Arduino Core API, namely the arduino_namespace branch. Those sources are needed and not part of the Arduino core based on Mbed OS framework. |
This have anything to do with anything? |
Yes, that's one piece. Many more are needed... |
I would also love to see these boards supported |
We've added support for this board, but we didn't try it on real hardware, so it would be great if someone could try to compile and upload a basic example. Thanks! |
Thanks, @valeros! Please note that you will need to use development version of platform: [env:myenv]
platform = https://github.com/platformio/platform-nordicnrf52.git
framework = arduino
board = nano33ble |
I just happened to play with a NANO33BLE board this evening and ran into this thread. Using the platformio config above, it compiles for me. Uploading didn't work for me yet. The second problem is some kind of uploading problem: Building in release mode Compiling .pio/build/default/src/BatteryMonitor.ino.cpp.o Checking size .pio/build/default/firmware.elf Advanced Memory Usage is available via "PlatformIO Home > Project Inspect" DATA: [=== ] 25.1% (used 65752 bytes from 262144 bytes) PROGRAM: [=== ] 29.0% (used 285036 bytes from 983040 bytes) Configuring upload protocol... AVAILABLE: cmsis-dap, jlink, nrfjprog, nrfutil, sam-ba CURRENT: upload_protocol = sam-ba Looking for upload port... Auto-detected: /dev/ttyACM0 Uploading .pio/build/default/firmware.bin No device found on ttyACM0 *** [upload] Error 1 |
I do have the same problem as @bertrik. Importing EDIT: Added log Verbose Upload Log
|
Thanks for the work on the Arduino Nano 33. I've tested it and it looks quite good already. The project compiles and compilation times are much faster than in Arduino IDE (where it's extremly slow). There are a number of issues though: 1. Upload Same problem as @bertrik and @vaetas. The path to the USB port is correct. And upload works from the Arduino IDE. The output from
As a comparison, the Arudino IDE uses the below command:
I tried a similar command using the PlatformIO's bossac, and it worked once and then stopped to work (No device found...). But PlatformIO's upload task works if I double click the board's reset button first. The LED then goes in a fade in / fade out mode. 2. Intellisense In a simple Blink sketch,
The missing file changed over time. It was In
Possibly, directories are missing such as 3. Create a new project Creating a new project with the
More or is likely to come... I will continue to test. |
Thanks for your help @valeros. I have pulled your changed but the error persisted.
|
I have the upload working now. I uploaded the BatteryMonitor example from the ArduinoBLE library and I can see a "BatteryMonitor" device now in a BLE scanner on my Android phone. |
What have you changed @bertrik. The Arduino gets into bootloader mode when I press Upload (led starts slowly blinking) but immediately fails. |
OK, I am not sure what happened but I tried to upload it again and it worked! |
Thanks @manuelbl, good points!
|
Thanks a lot for making this work @valeros! However, I have one weird problem. When I try to upload binary, Nano will switch to bootloader mode (not sure the correct name) and upload from PIO will then fail with I have tested this on two different Nano 33 BLEs and the bug appears on both of them. It seems like a problem with Arduino because it apparently closes connection when switching modes before upload. Does this happen to anybody else or is it only my problem? I am currently on Arch Linux. |
On my system (debian bullseye/sid) I noticed that I had modemmanager installed. I don't really trust it in the sense that I'm really sure it's not messing with anything that looks like a serial port (/dev/ttyUSBx or /dev/ttyACMx), so I made sure it was not running and uninstalled it. Perhaps this is something you can try too and see if it has an effect on upload success. |
Thanks @valeros for the quick response. Regarding my issues:
In the mean time I have also tested it on Windows. It behaves the same (same things working, same open issues). I've also tested J-Link upload and debugging and it works. Upload In the Arduino IDE, it works. So what's the difference? It's not the command line arguments for bossac. It seems that the Arduino IDE first resets the board before it starts bossac. The clue is if the serial port is busy. Then you don't get an error message from bossac but from the Arduino IDE:
The exception is thrown on this line: https://github.com/arduino/Arduino/blob/master/arduino-core/src/processing/app/Serial.java#L107 It's the code for the board reset. It is run if the Arduino board definition contains:
The setting Could that be the missing piece? |
@sean-mcmanus is it possible to pass different configuration for C and C++ compilers? We have different flags for C and C++. |
@ivankravets Not currently via c_cpp_properties.json, because there is no separate cppCompilerPath and cCompilerPath setting (you could file a feature request for that...no one else has yet requested that though). However, via the custom configuration provider interface (https://github.com/Microsoft/vscode-cpptools-api/blob/master/api.ts) a custom configuration provider could provide separate compilerPath/args for .c files versus .cpp files. |
@ivankravets Another possibility is to have 2 different configurations, one for .c files and another for .cpp files, and then run the new cpptools.setActiveConfigName command (see microsoft/vscode-cpptools#4893 ) when the active file type changes, but that command hasn't shipped yet. |
Thanks, this is already fixed, but hasn't been released yet.
Indeed, it works after removing extra quotes, but how we can handle whitespace characters in path to files specified using |
Our compilerPath property doesn't actually work with However, using the compilerArgs enables the
|
We opened an issue in PIO Core platformio/platformio-core#3364 @valeros will back soon with updates. Thanks! |
@sean-mcmanus Could you please also give us a hint about I prepared a basic example that is compilable using CMake, but when you open it in VSCode you'll see an issue with undefined symbol. |
|
@sean-mcmanus Thanks for the hint, but looks like |
You've hit bug (feature request) microsoft/vscode-cpptools#2780 . I added a comment to that issue. |
@sean-mcmanus Thanks! Also a question about escaping spaces in |
On Windows, we create a command line via appending spaces between the args (e.g. |
FYI: I am able to build a deploy to Nano 33 BLE Sense. The application uses the builtin microphone and BLE and all works fine. The only issue encountered is that the default path used for the project Library Options was specified as ~/Documents/Arduino/libraries. I had to change this to ~/OneDrive/Documents/Arduino/libraries. Happy to raise this as a separate issue if it is not known. |
I see this item as open, but it seems that support is at least partially in the platform. I'm having trouble on my Arduino Nano 33 BLE, it will not execute the main loop when built with PlatformIO, but will using the Arduino tooling. My sketch is as simple as a Not sure how to go about debugging this, and would love to use CLion + PIO over using the Arduino IDE, thanks! |
This sounds like the typical problem of most Arduinos implementing the Serial-to-USB bridge in software (instead of using a dedicated Serial-to-USB chip). Such a solution depends on the MCU being responsive, in particular during USB enumeration, i.e. when the host computer discovers the USB device and needs to figure out the device configuration. In your case, the MCU is probably stopped by the debugger during enumeration and therefore the host computer gives up on the device. Later the code is stuck in The proper solution would be if the Arduino core was changed such that it forces USB enumeration when As a workaround, try one of the following:
|
I tried #4, in order to test out the Serial path. I wrong a simple blink program
This caused the board to go into an mbed os crash state (3 short blinks and 3 long blinks) Curious what you said about the USB enumeration, it does work successfully with the Arduino IDE (a simple Hello World loop). Additionally, I did not think the Arduino Nano 33 BLE was debuggable without an additional board, is it? I do not have a debug board. |
It looks as if there are more issues than I thought. If you run the program with PlatformIO's upload command (and not using the green debug arrow) and it fails, then there is indeed an issue in PlatformIO. Last December it has been working (except for IntelliSense issues). But a lot of things have changed in the mean time. I'll check it again. Regarding debugging: It can be done with a debug adapter and some soldering: https://medium.com/@manuel.bl/arduino-in-circuit-debugging-with-platformio-9f699da57ddc |
@manuelbl I am indeed using the green upload arrow (not the debug icon). I have tried this via command line as well, with the same results. Thanks for the link! Let em know if I can do anything to help the development. |
@manuelbl FWIW, I tried going back through the old versions of this released package, none of them worked, guessing it may have to do with PlatformIO itself? I did not have an easy way to test this however. |
I've just tested PlatformIO with my Arduino Nano 33 BLE again and I can report that it fully works: compiling, IntelliSense, uploading, executing, debugging. For the first test, I've used a simple blink program and uploaded the program using the USB port: platformio.ini
main.cpp
Next, I've hooked up my J-Link and added these two lines to platformio.ini:
Both uploading and debugging worked flawlessly. Finally, I've added serial output and it work again, even when debugging. And I have tested it both on macOS and Windows. If it still doesn't work for you, you should probably go to https://community.platformio.org/ and for help there (incl. a full project to reproduce your error). |
should jlink matter? what options can I use if I don't have a jlink? EDIT: what version of pio do you have? |
J-Link is only needed for debugging. Without J-Link, just omit I'm using the latest official PIO core release (5.0.1) and up-to-date platform and other package versions. |
Turns out the "Quick installer" path for PlatformIO installs the latest (5.0.2b) rather than latest stable, installing 5.0.1 fixed it! thanks for the help @manuelbl. I'm not sure if this means there will be a problem in the future with 5.0.2, or if it's just unstable. |
@manuelbl do we have an issue with the upcoming 5.0.2-dev? We didn't do any significant changes. |
@ivankravets I've tested it on both macOS and Windows and it works with 5.0.2-dev. I've used Visual Studio Code while @tylerhartwig also talked about CLion. So I doubt it's related to 5.0.2-dev. It might have been another installation problem though. Some of the symptoms would also fit if the code contained |
One additional question, is any support planned to be able to use mbed directly on this board? my understanding is this is possible via mbed command line, but having this in platformio would be awesome as well. EDIT: I should clarify, I know you can use mbed features, wondering if it will be possible to compile with mbed over arduino |
package framework-arduino-nrf52-mbedos tracks https://github.com/arduino/ArduinoCore-nRF528x-mbedos, which will continue tracking mbed 5.x series and new releases will only happen in case of security bugs. |
along the lines of what @lzq420241 said, I would be interested in some guidance on what needs to be done to update to the new 6.x library. I have some spare time I could potentially spend on this. EDIT -- this should likely be tracked against #111 I'm guessing |
Now that the Arduino Nano 33 BLE and Arduino Nano 33 BLE Sense have been released and introduce:
Are there any plans to bring them to PlatformIO? What will be needed? How can it be supported?
The text was updated successfully, but these errors were encountered: