-
Notifications
You must be signed in to change notification settings - Fork 152
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
Migrate code to the nRF Connect SDK #76
Conversation
SHTC3 comm via i2c works
Moves ble sample to code/nrf-connect/samples
@jhbruhn I think I found a nice way to do it. I added board revisions for For building from the command line, we can just append
|
I had started on the same effort, but this is much nicer than what I have. Kudos for the reusable lib part and the board revisions. Awesome addition to an awesome project. |
Thanks for the kind words @kzyapkov. I will finish writing the updated docs and merge this in. |
code/nrf-connect/prstlib/boards/arm/bparasite_nrf52833/bparasite_nrf52833.dts
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm finally testing this on the nrf52833. Unfortunately I'm having a couple of issues. I already commented on one incorrect pin definition, but more seems wrong:
- I cannot get a battery measurement, the adc channel definitions seem to be different compared to the nrf52840
- Same for the illuminance measurement
I tested BTHome V1 and V2 and am successfully receiving packets on my smartphone/computer, but HomeAssistant does not seem to recognize them. But I think the problem is on my end.
I have some logs here, maybe they can help?
Transfer rate: 0 Bytes/s Data written: 1.88 KB *** Booting Zephyr OS build db187bb94af5 ***
[00:00:00.000,274] <inf> sdc_hci_driver: SoftDevice Controller build revision:
37 22 e7 c6 07 57 fd bf ad df cd 17 8d 10 8a d6 |7"...W.. ........
ae ca 94 e1 |....
[00:00:00.003,723] <inf> ble: MAC Address: d7:b5:1c:48:fd:69
Transfer rate: 0 Bytes/s Data written: 2.30 KB [00:00:00.834,289] <dbg> adc: get_soil_moisture_percent: Read soil moisture: 33.20 | Raw 210 | Batt: -0.01 | Dry: 304.89 | Wet: 19.06
[00:00:00.834,350] <dbg> adc: get_soil_moisture_percent: Read soil moisture: 33.20 | Raw 210 | Batt: -0.01 | Dry: 304.89 | Wet: 19.06
[00:00:00.834,411] <dbg> adc: get_soil_moisture_percent: Read soil moisture: 33.20 | Raw 210 | Batt: -0.01 | Dry: 304.89 | Wet: 19.06
[00:00:00.834,472] <dbg> adc: get_soil_moisture_percent: Read soil moisture: 33.20 | Raw 210 | Batt: -0.01 | Dry: 304.89 | Wet: 19.06
[00:00:00.844,604] <dbg> adc: prst_adc_photo_read: Read phototransistor: 0 lx | -0.00 V
[00:00:00.862,548] <dbg> shtc3: prst_shtc3_read: Read temp: 18.211060 oC (18)
[00:00:00.862,579] <dbg> shtc3: prst_shtc3_read: Read humi: 60 %
[00:00:00.862,579] <dbg> sensors: prst_sensors_read_all: Batt: -11 mV
[00:00:00.862,609] <dbg> sensors: prst_sensors_read_all: Soil: 33 % (0.000 mV)
[00:00:00.862,609] <dbg> sensors: prst_sensors_read_all: Photo: 0 lx (0.000 mV)
[00:00:00.862,640] <dbg> sensors: prst_sensors_read_all: Temp: 18.211060 oC
[00:00:00.862,640] <dbg> sensors: prst_sensors_read_all: Humi: 60 %
[00:00:00.862,670] <dbg> sensors: prst_sensors_read_all: --------------------------------------------------
compatible = "gpio-keys"; | ||
fast_disch: fast_disch { | ||
// P0.25. | ||
gpios = <&gpio1 10 GPIO_ACTIVE_HIGH>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for chiming in so late, but it seems that the wrong pin is used here (despite the comment).
Tks for trying this out @jhbruhn. I will take a closer look today. From the logs it looks like the ADC channels are not set up properly (in addition too the wrong fast discharge pin). Did you build the firmware with VSCode or Docker? For the 1.1.0 revision, right? |
This PR rewrites all the code from the legacy nRF SDK to the nRF Connect SDK. I will keep pushing updates to this PR and merge it when all tasks are finished and tested. I am only going for feature parity with this rewrite, but I'm factoring out a common core that can be reused in different applications/samples.
All help is welcome in testing the parts that are already implemented.
Tasks
code/nrf-connect/prstlib/boards/arm/bparasite_nrf52840/
)code/nrf-connect/prstlib/boards/arm/bparasite_nrf52833/
)code/nrf-connect/prstlib
)code/nrf-connect/samples/blinky
)code/nrf-connect/samples/soil_read_loop
)code/nrf-connect/samples/ble
) (this is the rewrite of the old firmware)code/b-parasite/
Notes
Building the Samples
With nRF Connect for Desktop + Visual Studio Code
This is the usual way of building the nRF Connect SDK samples. The only caveat is that, for each sample here, you also need to add the
code/nrf-connect/prstlib
directory to your workspace in addition to the sample directory itself. Theprstlib/
contains common source code for reading sensors and also common board definitions. There is a.code-workspace
file inside each sample that does this automatically.With Docker
To build the
ble
sample for thenRF52840
, revision1.2.0
,cd
intocode/nrf-connect/
and run:The output will be in
code/nrf-connect/samples/ble/build/zephyr/zephyr.hex
.[Experimental but super cool] With GitHub Codespaces
GitHub Codespaces let you run an instance of VS Code directly in your browser. More importantly, it also supports plugins, including nRF Connect for VS Code! This PR introduces
.devcontainer/devcontainer.json
, which configures a Codespace with both the nRF VS Code plugin, as well as the whole nRF Connect SDK + toolchain. This lets you edit code and build the sample straight in your browser.rbaron/b-parasite
, branchnrf-connect
code/nrf-connect/samples/ble
, selectble.code-workspace
and click on "Open workspace". This makes sure both theble
sample and theprstlib
are present in the workspaceble/build/zephyr/zephyr.hex
Prebuilt Binaries
The GitHub workflow in this PR clang-format-checks, builds and store the built binaries for all sample as artifacts. You can download them here (example). These are built with the default settings, but we may extend this machinery to build a few variants with different configs for each sample.