Skip to content

Fix incorrect TARGET_NAME/TARGET_SEEED_XIAO_NRF52840_SENSE_PLUS define - #23

Open
jgastonraoul wants to merge 1 commit into
Seeed-Studio:masterfrom
jgastonraoul:fix/xiao-sense-plus-target-name
Open

jgastonraoul wants to merge 1 commit into
Seeed-Studio:masterfrom
jgastonraoul:fix/xiao-sense-plus-target-name

Conversation

@jgastonraoul

Copy link
Copy Markdown

Summary

Fixes an incorrect TARGET_NAME / TARGET_SEEED_XIAO_NRF52840_SENSE_PLUS define in the SEEED_XIAO_NRF52840_SENSE_PLUS variant. The variant's defines.txt still carries the target name of the plain SEEED_XIAO_NRF52840_PLUS variant (no "Sense"), which appears to be a leftover from copying that variant's generated files when the Sense Plus variant was added.

Problem

Third-party libraries commonly guard board-specific behavior behind the TARGET_SEEED_XIAO_NRF52840_SENSE_PLUS define — for example, Seeed_Arduino_LSM6DS3 uses it to redirect the onboard IMU to the internal Wire1 bus and to enable PIN_LSM6DS3TR_C_POWER, both required for the onboard LSM6DS3TR-C to respond on this board.

Because the variant's defines.txt defines TARGET_SEEED_XIAO_NRF52840_PLUS instead, that #ifdef never triggers, and the onboard IMU is silently undetectable on this variant when using this core — with no compile-time warning, since the code compiles fine either way.

Root cause

variants/SEEED_XIAO_NRF52840_SENSE_PLUS/defines.txt
-DTARGET_NAME=SEEED_XIAO_NRF52840_PLUS <- should be SEEED_XIAO_NRF52840_SENSE_PLUS
-DTARGET_SEEED_XIAO_NRF52840_PLUS <- should be SEEED_XIAO_NRF52840_SENSE_PLUS

Both defines match the SEEED_XIAO_NRF52840_PLUS (no Sense) variant's defines.txt exactly, which strongly suggests these files were copied from that variant when SEEED_XIAO_NRF52840_SENSE_PLUS was created, without regenerating the target-specific defines.

Scope of the fix

This PR only touches defines.txt. I checked whether includes.txt (which references TARGET_SEEED_XIAO_NRF52840_PLUS in an mbed-os include path) needed the same treatment, but confirmed there is no dedicated cores/arduino/mbed/targets/.../TARGET_SEEED_XIAO_NRF52840_SENSE_PLUS directory in this core — only TARGET_SEEED_XIAO_NRF52840_PLUS and TARGET_SEEED_XIAO_NRF52840_SENSE exist. The Sense Plus variant genuinely borrows the Plus variant's mbed-os target tree (which makes sense, since the underlying SoC/SDK support is identical — only the PCB differs, adding the onboard IMU/mic). So includes.txt is correct as-is and should not be changed; the preprocessor-level TARGET_NAME/TARGET_SEEED_XIAO_NRF52840_SENSE_PLUS defines are what's actually broken and consumed by userland code.

Testing

Verified on physical hardware (Seeed XIAO nRF52840 Sense Plus, this core installed via Boards Manager, v2.9.3): before this fix, Seeed_Arduino_LSM6DS3's imu.begin() fails to detect the onboard LSM6DS3TR-C. After applying this fix, TARGET_SEEED_XIAO_NRF52840_SENSE_PLUS is correctly defined, the library's existing #if defined(TARGET_SEEED_XIAO_NRF52840_SENSE_PLUS) branch triggers as intended, and the onboard IMU is detected and reads correctly with no changes needed on the library or sketch side.

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.

1 participant