Skip to content

Improvements to JAWBONE firmware#17

Open
The-Bootloader wants to merge 3 commits into
EngineerGuy314:mainfrom
The-Bootloader:main
Open

Improvements to JAWBONE firmware#17
The-Bootloader wants to merge 3 commits into
EngineerGuy314:mainfrom
The-Bootloader:main

Conversation

@The-Bootloader

Copy link
Copy Markdown

Hi,

I made improvements to the JAWBONE firmware that I would like to submit for your consideration.

Several improvements:

  • Support of geofence to not transmit over "forbidden" countries
  • Data log mode reintroduced and fixed, including sleep mode
  • Capability to support more GPS models with auto 9600/115200 baud detection and multi-constellation support
  • Support of crashdumps for debugging
  • Enabled watchdog timer for more reliability
  • GPS power supply "soft start" to help with marginal power supply situations
  • And more!

I have done limited testing. It works well for me, but I did not test WSPR transmission although I did not change it.
I would appreciate if you could test on your end too, to verify.

The-Bootloader added 3 commits July 11, 2026 23:14
…tracking

- GPStimeInitAutobaud(): tries 9600 baud then 115200, alternating every 5 s,
  locks when a valid '$'-prefixed NMEA sentence is received
- Enable UART1 hardware FIFO (was disabled) so bytes don't drop during ISR
- ISR: read full DR register to detect framing errors (wrong baud indicator);
  guard against buffer overflow on over-long sentences
- ISR: buffer debug-print sentences and flush from main loop (safe to printf)
- parse_GPS_data: add GPGGA/NGGA fallback prefixes alongside GNGGA; likewise
  GPRMC/NRMC fallbacks for GNRMC
- Parse UTC date (DD/MM/YY) from RMC field 10 into GPStimeData.day/month/year
- Parse GSV sentences for all constellations (GPS/GLONASS/Galileo/BeiDou/QZSS)
  and maintain per-constellation and total sats-in-view counters
- get_nmea_field_str() helper for safe NMEA field extraction
- Switch to GPStimeInitAutobaud() in the WSPR flow
GPS soft-start power-on:
- gps_power_on(): uses internal ~50kΩ pull-down for 10 ms to limit MOSFET gate
  inrush before fully asserting the output — mitigates brownout resets on GPS
  power-on that can be caused by inrush current dragging the 3.3 V rail
- All three GPS turn-on sites (WSPRbeaconInit, scheduler SEQ==10, datalog) now
  call gps_power_on() instead of bare gpio_put

Watchdog coverage:
- watchdog_update() in get_user_input() so long string entry doesn't trigger reset
- 5-second watchdog enabled before the main loop; watchdog_update() each iteration
- Menu prompt replaced with a 1-second-chunk loop feeding the watchdog
- Frequency tuning "press any key" wait feeds the watchdog

Geofencing:
- is_position_geofenced(): checks 4-char Maidenhead against a table of restricted
  grids (Yemen and North Korea for now); WSPR TX suppressed when position matches

WSPRbeaconGetTxStatus():
- Returns a human-readable string describing current TX/GPS state (no-comms,
  GPS acquiring, waiting for slot, TX progress, next-TX countdown)
- Used in the periodic telemetry StampPrintf to show lat/lon/grid/sats/TX status
… HardFault

Binary GPS flash datalog (gpslog module):
- New gpslog.h/gpslog.c: 32-byte packed binary records in flash sectors 66-320
  (255 sectors × 128 records = 32 640 slots); metadata sector at 65
- Modes: 1=circular (evict oldest sector when full), 2=stop-when-full
- gpslog_append(), gpslog_dump_csv(), gpslog_wipe(), gpslog_stats() API
- Altitude stored with +1000 m offset to support negative altitudes
- GPS stability check: waits up to 30 s for position to settle (<100 m delta,
  no rising sat count) before logging
- datalog_loop() fully rewritten; GPS turned on via gps_power_on(); uses
  GPStimeInitAutobaud(); logs date/time from RMC, all constellation sats

RTC dormant sleep:
- go_to_sleep(uint32_t minutes): switches clk_sys to XOSC, sets RTC alarm,
  enters deep sleep (WFI with SLEEPDEEP set), then watchdog-reboots on wake
- CMakeLists: add hardware_rtc link library; add gpslog.c source

Menu improvements:
- 'D' menu option: active data-log mode selector (0/1/2/W/D), prompts for
  sleep interval in minutes, stores in NVRAM at offset 31
- show_values(): shows GPS log fill stats and datalog sleep interval
- NVRAM: remove obsolete _custom_PCB, _battery_mode, _band_hop; add
  _Datalog_sleep_minutes; offsets 13, 18, 26 marked unused (preserved for
  backward NVRAM compatibility)

HardFault handler:
- isr_hardfault (naked): saves MSP/PSP stack pointer and calls C handler
- hardfault_handler_c: stores PC + LR in watchdog scratch[1]/[2], triggers
  100 ms watchdog reset
- On boot: checks scratch[0] == 0xDEADBEEF, saves crash_pc/crash_lr
- 'Z' menu command recalls last crash address pair
- Printable-only ASCII filter on startup keypress detection to suppress
  spurious CDC control bytes sent by terminal emulators on USB connect
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