Skip to content

Fix for T114#38

Open
nilu96 wants to merge 11 commits into
attermann:masterfrom
nilu96:master
Open

Fix for T114#38
nilu96 wants to merge 11 commits into
attermann:masterfrom
nilu96:master

Conversation

@nilu96
Copy link
Copy Markdown

@nilu96 nilu96 commented May 8, 2026

Fixed errors for Heltec T114:

  • Build Error: SPI1 was not defined because the base board nrf52840_dk_adafruit only defines one SPI interface
  • Crash at boot: memory allocation failed for heap pool buffer

This pull request introduces a new board variant for the Heltec T114 (nRF52840) and refactors pin assignments throughout the codebase to use named constants from the new variant. This defines missing SPI1, improves maintainability and clarity by centralizing pin definitions and making the code less error-prone. Additionally, the pull request updates build configuration for the new variant, adjusts memory allocation settings, and makes minor logic improvements.

Board Variant Addition and Pin Refactoring:

  • Added a new board variant for the Heltec T114 in variants/heltec_t114/variant.h and variant.cpp, defining all pin mappings, peripherals, and board-specific constants. [1] [2]
  • Refactored pin assignments in Boards.h to use the new named constants (e.g., PIN_BAT_ADC_CTL, PIN_SPI_MOSI, PIN_TFT_CS, etc.) instead of hardcoded numbers, avoiding duplicate definitions and improving maintainability. [1] [2]

Build System and Configuration Updates:

  • Updated platformio.ini to use the new heltec_t114 variant, set the variants directory, and adjusted build flags for memory allocation (e.g., reduced RNS_HEAP_POOL_BUFFER_SIZE and added RNS_CONTAINER_ALLOCATOR). [1] [2]

Logic and Feature Improvements:

  • Wrapped SRAM usage print statements in setup() with #ifdef HAS_RNS to avoid errors if the RNS library is not present.
  • Updated BLE battery reporting to only occur if BLE is enabled (HAS_BLE) and the MCU is nRF52, preventing unnecessary BLE operations.

nilu96 added 11 commits May 8, 2026 12:06
Because the base board nrf52840_dk_adafruit only defines one SPI, I added a variant that defines all pins according to pin map of hardware rev 2.1 and specifies SPI_INTERFACES_COUNT (2)
memory allocation at startup led to crash at boot
Problem: If a packet is added to queue for TX early after startup before the first call of update_noise_floor().

Then, medium_free() calls update_modem_status() which updates last_status_update. This leads to check_modem_status() always returning without any action (especially without updating noise floor). Because medium_free() is called periodically (because of stuck TX queue), check_modem_status() will never call update_noise_floor(). Because there is no valid noise floor, medium_free() will always return false --> stuck TX queue.

Easy fix: never update modem status without updating noise floor as well.

This bug only appears in TNC mode, when interference avoidance is active.
Unfortunately, I did not find a way to set airtime limits at runtime with rnodeconf, when in TNC mode. I added the option to add build flags to set airtime limits at compile-time. Airtime limits are essential for respecting duty cycles on most EU frequency bands.
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