tx: lowest documented PA table, test_burst, tx payload logging; 200ms delay improves SDR repeat decode 3%->30%

This commit is contained in:
Lars Nolden
2026-09-01 08:18:17 +02:00
parent 50e8ee2fb8
commit 0df784525a
9 changed files with 211 additions and 63 deletions
+11 -2
View File
@@ -56,6 +56,7 @@ static sx126x_irq_cb_t s_irq_cb;
static uint8_t s_rx_payload_len = 255;
static int8_t s_tx_dbm = -9;
static SemaphoreHandle_t s_lock; // serializes SPI access across tasks
static bool s_pa_low = true; // true = +10 dBm-optimal PA row (lowest output)
// ---------------------------------------------------------------- low level
@@ -303,8 +304,14 @@ bool sx126x_config_wmbus_c1(uint32_t freq_hz, uint8_t rx_payload_len)
uint8_t f[4] = {frf >> 24, frf >> 16, frf >> 8, frf};
ok &= cmd(OP_SET_RF_FREQUENCY, f, 4);
// PA config for SX1262, +14 dBm optimal table (we run far below that)
ok &= cmd(OP_SET_PA_CONFIG, (uint8_t[]){0x02, 0x02, 0x00, 0x01}, 4);
// PA config. SX1262 datasheet table 13-21 documents optimal settings
// per target power; we deliberately use the +10 dBm-optimal row
// (paDutyCycle=0x01, hpMax=0x00) because it yields the lowest output
// this chip supports, and the external KCT8103L PA adds gain after it.
// s_pa_low=false selects the +14 dBm row for comparison experiments.
ok &= s_pa_low
? cmd(OP_SET_PA_CONFIG, (uint8_t[]){0x01, 0x00, 0x00, 0x01}, 4)
: cmd(OP_SET_PA_CONFIG, (uint8_t[]){0x02, 0x02, 0x00, 0x01}, 4);
ok &= sx126x_set_tx_power(s_tx_dbm);
// OCP
@@ -488,3 +495,5 @@ uint8_t sx126x_get_status(void)
if (!xfer(tx, rx, 2)) return 0;
return rx[1];
}
void sx126x_set_pa_low(bool low) { s_pa_low = low; }