Skip to content
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

[Feature] Support PlatformIO #6

Open
soburi opened this issue Nov 12, 2019 · 4 comments
Open

[Feature] Support PlatformIO #6

soburi opened this issue Nov 12, 2019 · 4 comments

Comments

@soburi
Copy link
Owner

soburi commented Nov 12, 2019

It maybe need to create new repository.

Even if so, this package's build system are complex to support PlatformIO.
Simplify the build system (#4) to help to creating PlatformIO package.

@geeksville
Copy link
Contributor

Hi @soburi I might be able to help with this - I have ported a different arduino emulation lib (for linux) to build and work properly in platformio as a 'first class - standard arduino' target. If I use your project I would be willing to do the glue needed and send in a PR.

Am I correct that this project isn't just a "openthread" project but also a "port of arduino to run on top of a nrf52 with soft device"? It seems like your soft device is already 7.0.2 which is new enough to work with new processor needs (nrf52833). Previously we were using ESP32s and NRF52840. For the nrf52 I've been using the adafruit-nrf52-arduino project, but that project is still using soft device 6.1.1 - so I either need to update that project or switch to a different arduino port. Would you recommend using your project in this application?

@soburi
Copy link
Owner Author

soburi commented Nov 3, 2020

HI @geeksville

Sorry for the delayed response. (I was a bit busy recently week.)

If I use your project I would be willing to do the glue needed and send in a PR.

Ok. Any PR is welcoming!

Am I correct that this project isn't just a "openthread" project but also a "port of arduino to run on top of a nrf52 with soft device"?

Yes. This project depends on Thread and Zigbee SDK and The SDK use SoftDevice.
Thus, this project is worked on SoftDevice.

Would you recommend using your project in this application?

I think this project is not even matured.

There are a few things to keep in mind when using this project.

It basically uses code base original 'Adafruit_nRF52_Arduino'.
The significant change is this project is using SoftDevice.
It is make modifing to 'bluefruit.cpp' and 'Adafruit_TinyUSB_nRF.cpp'.
And 'IPAddress' class is modified and depends on openthread's IPaddress representation. It may cause some problems. I think it is better to revert to original source if not use openthread.

@geeksville
Copy link
Contributor

Thanks for your reply . alas - since I opened this I went and fixed my immediate root problem (updating nrf52 arduino to run with soft device 7.2) So I think I'll be staying with adafruit nrf52 for now (and I'll send them a PR)

@leojrfs
Copy link

leojrfs commented Feb 17, 2022

Hello all!

Ive made some hacky changes so this project can be built with platformio:

So in theory should be easy to integrate with platformio.

I managed to build but after flashing it doesnt seem to go past the bootloader.

take the following example in src/main.app:

#include <Arduino.h>
// seems to need this header or else it errors out with undefined references
#include "Adafruit_TinyUSB.h"


void setup()
{
    pinMode(LED_BUILTIN, OUTPUT);
    pinMode(PIN_LED2, OUTPUT);
}

void loop()
{
    digitalWrite(LED_BUILTIN, HIGH);
    digitalWrite(PIN_LED2, LOW);
    delay(250);
    digitalWrite(LED_BUILTIN, LOW); 
    digitalWrite(PIN_LED2, HIGH);
    delay(250);
}

If one uses the original adafruit arduino core, this example works correctly:

  • content in platformio.ini:
[env:nrf52840_dk_adafruit]
platform = nordicnrf52
board = nrf52840_dk_adafruit
framework = arduino
upload_protocol = jlink
monitor_speed = 115200
monitor_port = /dev/tty.usbmodem32201
  • flash the bootloader from adafruit :
wget https://raw.githubusercontent.com/adafruit/Adafruit_nRF52_Arduino/master/bootloader/pca10056/pca10056_bootloader-0.6.2_s140_6.1.1.hex
nrfjprog --program pca10056_bootloader-0.6.2_s140_6.1.1.hex -f nrf52 --chiperase --reset
  • build and upload the example app from platformio:
platformio run -t upload

The same procedure for this core doesn't work, it seems to get stuck in the bootloader (with LED1 flashing):

  • content in platformio.ini:
[env:nrf52840_dk_adafruit]
platform = https://github.com/leojrfs/platform-nordicnrf52.git
board = nrf52840_dk_adafruit
framework = arduino
platform_packages =
  framework-arduinoadafruitnrf52 @ https://github.com/leojrfs/openthread_nrf52_arduino.git#master
upload_protocol = jlink
monitor_speed = 115200
monitor_port = /dev/tty.usbmodem32201
  • flash the bootloader from this repo :
wget https://raw.githubusercontent.com/soburi/openthread_nrf52_arduino/master/bootloader/pca10056/pca10056_bootloader-0.6.1_s140_7.0.1.hex
nrfjprog --program pca10056_bootloader-0.6.1_s140_7.0.1.hex -f nrf52 --chiperase --reset
  • build and upload the example app from platformio:
platformio run -t upload

any hints?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants