fix(gfsk): improve fixed-packet receive reliability

Use a longer preamble and 32-bit detector for the 100 kbps fixed 6-byte GMSK profile.

Read RX payloads from the RxStartBufferPointer returned by GetRxBufferStatus. The previous subtract-by-length adjustment could read the previous FIFO slot once the continuous RX buffer advanced, causing duplicate and missing packet IDs on the gateway.
This commit is contained in:
2026-05-19 18:38:59 +08:00
parent 2ab5617cf0
commit f8836dd1b1
2 changed files with 1882 additions and 1891 deletions
+3 -4
View File
@@ -490,8 +490,8 @@ struct gfsk_parameters_t {
},
.packet_params =
{
.preamble_bits = 32,
.detector_length = GfskPreambleDetector::Bits16,
.preamble_bits = 64,
.detector_length = GfskPreambleDetector::Bits32,
.sync_length_bits = 32,
.address_filtering = GfskAddressFiltering::Disabled,
.packet_length_mode = GfskPacketLengthMode::Fixed,
@@ -1057,8 +1057,7 @@ namespace llcc68 = app::driver::llcc68;
}
namespace std {
template <>
struct is_error_code_enum<app::driver::llcc68::Errc> : true_type {};
template <> struct is_error_code_enum<app::driver::llcc68::Errc> : true_type {};
} // namespace std
#endif /* ECC594CF_EDF0_42B5_8518_0EB3B3583727 */
+10 -18
View File
@@ -108,10 +108,10 @@ error_code LLCC68::init() {
// Internal helpers (TU-local)
namespace {
// Max payload the radio supports and buffer sizing helpers
constexpr size_t kMaxPayload = 32;
// Max payload the radio supports and buffer sizing helpers
constexpr size_t kMaxPayload = 32;
error_code command_status_to_error(status_t st) {
error_code command_status_to_error(status_t st) {
switch (st.command_status) {
case CommandStatus::FAILURE_TO_EXECUTE_COMMAND:
return make_error_code(Errc::FailureToExecuteCommand);
@@ -122,9 +122,9 @@ namespace {
default:
return {};
}
}
}
int wait_for_not_busy(const gpio_dt_spec &busy_gpio, uint16_t timeout_ms) {
int wait_for_not_busy(const gpio_dt_spec &busy_gpio, uint16_t timeout_ms) {
if (not device_is_ready(busy_gpio.port)) {
return -ENODEV;
}
@@ -136,7 +136,7 @@ namespace {
k_busy_wait(50); // ~50 us poll interval
}
return 0;
}
}
} // namespace
void LLCC68::tx_rx_en_pin_set(TxRxPinState state) {
@@ -430,10 +430,7 @@ LLCC68::read_rx_buffer_ref(timeout_ms_t busy_timeout) {
auto r = get_rx_buffer_status(busy_timeout);
APP_RADIO_RETURN_ERR_IGNORE_PROC_ERR(r);
const auto [sz, ptr] = r.value();
// the rx pointer would become 0x80 at first, so we need to adapt that
// behavior
const auto r_ptr = ptr - sz < DEFAULT_RX_BUFFER_ADDRESS ? ptr : ptr - sz;
return read_buffer_ref(r_ptr, sz, busy_timeout);
return read_buffer_ref(ptr, sz, busy_timeout);
}
expected<unit, error_code>
@@ -631,14 +628,9 @@ expected<ChipType, error_code> LLCC68::hal_get_chip_type() {
expected<unit, error_code> LLCC68::set_dio_irq_params(irq_params_t params) {
const uint8_t data[8] = {
params.irqMask.msb(),
params.irqMask.lsb(),
params.dio1Mask.msb(),
params.dio1Mask.lsb(),
params.dio2Mask.msb(),
params.dio2Mask.lsb(),
params.dio3Mask.msb(),
params.dio3Mask.lsb(),
params.irqMask.msb(), params.irqMask.lsb(), params.dio1Mask.msb(),
params.dio1Mask.lsb(), params.dio2Mask.msb(), params.dio2Mask.lsb(),
params.dio3Mask.msb(), params.dio3Mask.lsb(),
};
return write_stream(RADIOLIB_SX126X_CMD_SET_DIO_IRQ_PARAMS, data);
}