Skip to content

feat(cardputer-adv): add CC1101 nRF24 LoRa 3-in-1 expansion support - #2827

Open
leandrofleury wants to merge 1 commit into
BruceDevices:devfrom
leandrofleury:pr/cardputer-adv-3in1-support
Open

feat(cardputer-adv): add CC1101 nRF24 LoRa 3-in-1 expansion support#2827
leandrofleury wants to merge 1 commit into
BruceDevices:devfrom
leandrofleury:pr/cardputer-adv-3in1-support

Conversation

@leandrofleury

@leandrofleury leandrofleury commented Aug 24, 2026

Copy link
Copy Markdown

Proposed Changes

Add support for the JosephCGS CC1101/NRF24/LoRa 3-in-1 expansion board on the M5Stack Cardputer ADV.

This introduces a dedicated PlatformIO environment:

m5stack-cardputer-adv-3in1

The standard m5stack-cardputer environment remains unchanged.

The expansion shares the Cardputer ADV SPI bus and multiplexes GPIO8/9 between the TCA8418 keyboard controller and NRF24 CE/CS.

The implementation:

  • adds the dedicated Cardputer ADV 3-in-1 build environment;
  • configures CC1101 GDO0=13 / CS=15;
  • configures NRF24 CE=8 / CS=9;
  • keeps inactive SPI devices deselected;
  • arbitrates GPIO8/9 between the TCA8418 keyboard and NRF24;
  • prevents generic I2C recovery from misinterpreting NRF24 CE LOW as a stuck SDA line;
  • keeps the NRF24 spectrum handling changes scoped to this hardware configuration.

This PR is rebased onto dev (fe07bd7). The only conflict was src/modules/NRF24/nrf_spectrum.cpp, rewritten by #2758 (SpectrumPlot, continuous trace, frequency ruler). The 3-in-1 changes were reapplied on the new structure:

  • scanChannels() — the mux critical section wraps the sweep; the tolerant RPD detection stays scoped to #if defined(CARDPUTER_ADV_3IN1_MUX), and the #else path is the current upstream scanner (NRF_FULL_SCALE);
  • nrf_spectrum()dev early-returns when nrf_start() fails, so adv3in1Nrf24CriticalEnd() runs before that return; otherwise the mutex would leak and leave the TCA8418 keyboard stuck when the radio fails to start.

nrf_common.cpp, bus_HAL.cpp and the board files rebased cleanly.

Types of Changes

New Feature / Hardware Support

Verification

Both environments build successfully:

  • pio run -e m5stack-cardputer
  • pio run -e m5stack-cardputer-adv-3in1

The standard Cardputer environment was also verified to retain its original compile-time pin configuration.

Hardware testing on M5Stack Cardputer ADV with the JosephCGS 3-in-1 expansion validated:

  • Cardputer ADV boot
  • microSD
  • TCA8418 keyboard
  • CC1101 receive
  • LoRa
  • NRF24 SPI initialization
  • NRF24 spectrum reception
  • keyboard operation after leaving NRF24 Spectrum

Testing

Both environments build successfully against dev (fe07bd7):

Standard environment:

  • RAM: 130596 / 327680 bytes (39.9%)
  • Flash: 4146136 / 8388608 bytes (49.4%)

3-in-1 environment:

  • RAM: 130604 / 327680 bytes (39.9%)
  • Flash: 4146276 / 8388608 bytes (49.4%)

The hardware checklist above was validated on the functional implementation prior to the rebase. The final rebased commit was build-tested on both environments against dev; a hardware retest is pending.

Linked Issues

None.

User-Facing Change

Add optional M5Stack Cardputer ADV support for the JosephCGS CC1101/NRF24/LoRa 3-in-1 expansion board.

@leandrofleury

leandrofleury commented Aug 24, 2026

Copy link
Copy Markdown
Author

Compatibility scope:

  • m5stack-cardputer → upstream behavior remains unchanged
  • m5stack-cardputer-adv-3in1 → hardware-specific support for the JosephCGS 3-in-1 expansion

@leandrofleury
leandrofleury force-pushed the pr/cardputer-adv-3in1-support branch from 28d09a6 to 7263fcb Compare September 8, 2026 18:33
@leandrofleury
leandrofleury changed the base branch from main to dev September 8, 2026 18:35
@leandrofleury

Copy link
Copy Markdown
Author

Rebased onto dev (fe07bd7) and changed the PR base from main to dev.

The only conflict was in src/modules/NRF24/nrf_spectrum.cpp, which was rewritten by #2758 (SpectrumPlot, continuous trace, frequency ruler). The 3-in-1 changes were reapplied on top of the new structure:

scanChannels() — the mux critical section now wraps the sweep, and the tolerant RPD detection stays scoped to #if defined(CARDPUTER_ADV_3IN1_MUX). The #else path is the current upstream scanner, including NRF_FULL_SCALE.
nrf_spectrum() — dev early-returns when nrf_start() fails, so adv3in1Nrf24CriticalEnd() is called before that return; otherwise the mutex would leak and leave the TCA8418 keyboard stuck whenever the radio fails to come up.
Teardown wraps stopListening()/powerDown() and the CE LOW / CS HIGH sequence before freeing the plot buffers.

nrf_common.cpp, bus_HAL.cpp and the board files rebased cleanly.

Both environments build against dev.

@bmorcelli bmorcelli added enhancement New feature or request New Board and removed enhancement New feature or request labels Sep 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants