Skip to content

Fix rssi timeout - #95

Closed
kaklik wants to merge 53 commits into
ArduPilot:masterfrom
ThunderFly-aerospace:fix-rssi-timeout
Closed

Fix rssi timeout#95
kaklik wants to merge 53 commits into
ArduPilot:masterfrom
ThunderFly-aerospace:fix-rssi-timeout

Conversation

@kaklik

@kaklik kaklik commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Fix intermittent timeout and doubled echo in rssi.py

Problem

Firmware/tools/rssi.py would occasionally fail on timeout at startup, while a subsequent run would succeed.

Root cause

The +++ sequence switches the modem into command mode, which makes it print OK. The first expect(['OK', 'SiK .*']) matched that OK — not the response to ATI. This shifted the whole flow by one
response: AT&F was sent while the modem was still emitting the banner, arrived corrupted (&F), and the modem never replied OK → timeout. Re-running masked the bug because the modem was already in a clean state.

Fix

  • Flush the input buffer after +++ (flush()), discarding the OK from +++ and any line noise.
  • Synchronize on the SiK .* banner instead of OK, which guarantees that ATI actually completed.
  • Let the banner finish and drain the buffer before sending AT&F, so the command isn't received corrupted.

Verification

Tested against a real modem (/dev/ttyUSB0, TFSIK01 30MHz, 57600 Bd). The output is now clean and reliably repeatable:

Putting /dev/ttyUSB0 into rssi test mode
+++
ATI
SiK tf250927-2-4-g7a56934 on TFSIK01 30MHz
AT&F
OK
AT&T=RSSI
L/R RSSI: 118/110 L/R noise: 72/51 pkts: 4424 txe=0 rxe=2 stx=0 srx=0 ecc=0/0 temp=0 dco=0
...

povik and others added 30 commits July 26, 2023 11:50
Fixes: 09d7993 ("fixed power level mappings on Si1060 radios")
Add missing control pin definitions for ISM01A and missing pin
initialization for both ISM01A and HB1060.
On ISM01A unconditionally enable the antenna diversity circuit. It
should then automatically pick the better antenna (out of two options)
for reception of each packet.

In addition, use the signal strength evaluation obtained at packet
reception to switch antennas for transmission. (This latter behavior
is implemented solely in software.)
Add a new TFSIK01A board similar to ISM01A but differing in some of the
wiring.
Change the trigger for building of release binaries from 'published'
to 'created'. Hopefully this means binaries will be built for drafted
releases also, before releases are published.
This reverts commit 888d0bb. The 'created' trigger is not what we are
looking for.
Add link to the TFSIK modem.
See if this makes more information show up in the version string.
Add GitHub actions badge 
Repair links 
Add example of parameter readout
Add an example of a parameter set.
Enable Antenna selection from AT commands.
Example of antenna RF switch.
Improve doc string for antenna diversity setup.
Explain ATO command.
kaklik and others added 23 commits March 29, 2025 22:31
Update versions of GitHub actions scripts.
Add a description of how the SiK firmware works.
Cleanup and update links.
* Modify base crystal frequency.

* Add Silicon Labs  Wireless Development Suite configuration file.

* Normalize EOL to LF
Regenerate 868 MHz configuration with newly installed WDS.

* Remove unecessary payload configuration data.

* Regenerate 868MHz RF config parameters for 26 MHz crystal.

* Regenerate RF configurations for 433 MHz with 26 MHz crystal.

* Regenerate RF configurations for 915 MHz and 26 MHz crystal.

* fix wrong crystal frequency in power-up command.

* Renaming datafolder to allow different crystal frequency configurations.

* Restore 30MHz Si1060 configuration headers

* Add TFSIK01 crystal-specific build targets

* Ensure radio config header builds for all boards

* Update copyright strings.

* Isolate Si446x radio configuration per board
Remove python2 installation.
…-functionality-and-documentation

Add CW AT test mode for RF testing
Improve documentation.
`.gitattributes` declares all `*.c`/`*.h` files as LF, but several
files in Firmware/radio/AES/, Firmware/include/Si1020_defs.h and
data/WDS_si1060_project_file.xml were still committed with CRLF.
`git add --renormalize .` converts them in the index. No source
changes.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
SDCC 4.5.0 (Debian trixie) enforces stricter C99 and refuses the
pre-prototype K&R form `foo()` as well as enum constants outside
the range of `int`. Two kinds of fix:

- Add `(void)` to zero-argument functions that were declared with
  empty parentheses, in both the definition and the header
  prototype (check_code.py checks they match). Covers
  `at_parse_number`, `calibration_lock/get/force_get`,
  `param_get_encryption_key`, `print_encryption_key`,
  `pins_user_check`, `encrypt_buffer_getting_full/empty`,
  `encrypt_buffer_write_space`, `radio_set_output_clock_freq`,
  `radio_get_oscillator_capacitance`, `flash_transfer_calibration`,
  `reply_open`, `reply_close`, `wait_for_cts`,
  `aes_get_encryption_level`.
- Drop the unused `PIN_MIRROR_NULL=0xFFFFFFFF` member of
  `enum pin_state` in `pins_user.h`; with the stricter checks
  the value no longer fits a signed `int` without C23.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@kaklik kaklik closed this Jun 16, 2026
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.

4 participants