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

xiao-new: add initial support for the Xiao BLE + Ebyte E22-900M30S #2633

Merged
merged 2 commits into from
Jul 22, 2023

Conversation

andrew-moroz
Copy link
Contributor

@andrew-moroz andrew-moroz commented Jul 20, 2023

This adds initial support for the Xiao BLE + Ebyte E22-900M30S.

In variants/xiao_ble, I have included some additional resources in hopes that everything needed could be found under one roof:

  • README.md is a short how-to guide.
  • xiao_ble.sh is a script that pulls in some needed dependencies from Seed Studio's Arduino core. (Guessing there may be a better way to do this?)
  • xiao_nrf52840_ble_bootloader-0.7.0-22-g277a0c8_s140_7.3.0.zip is the Adafruit UF2 bootloader compiled for the Xiao BLE. I included it here since the compiled version is not included with Adafruit's releases (but rather here) and the compilation process is somewhat arcane.
  • xiao-ble-internal-format.uf2 is identical to Meshtastic_nRF52_factory_erase.uf2 included in Meshtastic releases, but compiled for softdevice 7.3.0.

Not sure if all of this really belongs in the variant folder. I like the idea of making it easy for first-time DIYers by keeping it all in one place, but happy to move stuff if the feeling is that this is too much bloat 😀

Beyond the files in the variants/xiao_ble folder, I also made some small changes to SX126xInterface.cpp to support using the E22 in 'automatic antenna switching' mode, which is nice since it frees up an additional GPIO. These should not affect any existing variants, but a careful review here is definitely in order since the logic is common to all SX1262 builds, most of which I don't have on hand to test.

Thanks in advance for giving this a look!

** EDIT: Working on those trunk checks. I'm a bit behind the times and didn't have the VS Code extension installed until just now.

@github-actions
Copy link
Contributor

github-actions bot commented Jul 20, 2023

🤖 Pull request artifacts

file commit
pr2633-firmware-2.1.20.3d3ccd7.zip 3d3ccd7

thebentern added a commit to meshtastic/artifacts that referenced this pull request Jul 20, 2023
@andrew-moroz andrew-moroz force-pushed the xiao-ble branch 2 times, most recently from dacc7d4 to e11559a Compare July 21, 2023 00:50
variants/xiao_ble/eagle-project/xiao-ble-e22-schematic.png Outdated Show resolved Hide resolved
src/mesh/SX126xInterface.cpp Show resolved Hide resolved
.vscode/extensions.json Outdated Show resolved Hide resolved
.trunk/trunk.yaml Outdated Show resolved Hide resolved
thebentern added a commit to meshtastic/artifacts that referenced this pull request Jul 21, 2023
@andrew-moroz andrew-moroz force-pushed the xiao-ble branch 3 times, most recently from 47bef9d to e333fb5 Compare July 21, 2023 01:26
@andrew-moroz
Copy link
Contributor Author

All requested changes made. Looks like gather-artifacts failed, not sure what that's about.

@markbirss
Copy link
Contributor

  • xiao-ble-internal-format.uf2 is identical to Meshtastic_nRF52_factory_erase.uf2 included in Meshtastic releases, but compiled for softdevice 7.3.0.

Can you confirm "Meshtastic_nRF52_factory_erase.uf2" wont work for softdevice 7.3.0?
as it is just erasing the internal littlefs region and should be softdevice version independent

https://github.com/markbirss/nRF52_Internal_Format/blob/main/Meshtastic_nRF52_factory_erase/Meshtastic_nRF52_factory_erase.ino

I am in the process of adding Adafruit UF2 support for Makerdiary nRF82540 Connect Kit also, as it comes with out-of-the-box features and a desktop app but with SoftDevice S132 5.1.0

https://wiki.makerdiary.com/nrf52840-connectkit/out-of-box-experience/#installing-the-nrf-connect-bluetooth-low-energy
https://github.com/NordicPlayground/pc-nrfconnect-ble-standalone

Im also aware RAK Wireless still maintain their own fork UF2 bootloader

thebentern added a commit to meshtastic/artifacts that referenced this pull request Jul 22, 2023
@thebentern thebentern merged commit 1c74479 into meshtastic:master Jul 22, 2023
@andrew-moroz
Copy link
Contributor Author

Can you confirm "Meshtastic_nRF52_factory_erase.uf2" wont work for softdevice 7.3.0? as it is just erasing the internal littlefs region and should be softdevice version independent

Just circled back to test this again and can confirm Meshtastic_nRF52_factory_erase.uf2 doesn't work. But the same exact Arduino sketch (Meshtastic_nRF52_factory_erase.ino) does work when compiled for the Xiao BLE. I do see differences in the sizes of the binaries exported by Arduino IDE, and their offsets when converted to UF2... when compiled for the Adafruit Feather nRF52840 Express, the start address is 0x26000:

~/meshtastic/firmware/bin/uf2conv.py Meshtastic_nRF52_factory_erase.ino.hex -c -o Meshtastic_nRF52_factory_erase.ino.uf2 -f 0xADA52840
Converting to uf2, output size: 123904, start address: 0x26000
Wrote 123904 bytes to Meshtastic_nRF52_factory_erase.ino.uf2

But when compiled for the Xiao BLE, it's 0x27000:

~/meshtastic/firmware/bin/uf2conv.py Meshtastic_nRF52_factory_erase.ino.hex -c -o Meshtastic_nRF52_factory_erase.ino.uf2 -f 0xADA52840
Converting to uf2, output size: 122880, start address: 0x27000
Wrote 122880 bytes to Meshtastic_nRF52_factory_erase.ino.uf2

I think SoftDevice 7.x is bigger than 6.x, which may explain the difference in offset? (Can't remember where I first read that, but searching just now I found this thread which mentions it.) So my thinking was that if Meshtastic_nRF52_factor_erase.uf2 were compiled for the Adafruit board and SD 6.x, flashing it to the Xiao was probably overwriting the tail end of its SD 7.x and causing it not to boot at all.

@markbirss
Copy link
Contributor

@andrew-moroz thank you for confirmation

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

Successfully merging this pull request may close these issues.

3 participants