diff options
| author | Sadeep Madurange <sadeep@asciimx.com> | 2025-01-12 19:58:43 +0800 |
|---|---|---|
| committer | Sadeep Madurange <sadeep@asciimx.com> | 2025-01-12 19:58:43 +0800 |
| commit | 0aaf191767f6afa7a126c4abd632caf53593f148 (patch) | |
| tree | 97e931e872cec52e23cf608dfb1f6e4cae1eb9a7 | |
| parent | a6f4a73e2fe5d18cbfd2edbc53ae01ae0b401845 (diff) | |
| download | smart-home-0aaf191767f6afa7a126c4abd632caf53593f148.tar.gz | |
Modem config.
| -rw-r--r-- | rf_test/radio.c | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/rf_test/radio.c b/rf_test/radio.c index 4f7fc25..d9ba6df 100644 --- a/rf_test/radio.c +++ b/rf_test/radio.c @@ -66,10 +66,6 @@ static inline void set_mode(uint8_t mode) } } -static inline void set_mode_stdby(void) -{ -} - void radio_send(const char *data, uint8_t n) { uint8_t i; @@ -141,12 +137,21 @@ void radio_init(const struct radio_cfg *cfg) SPCR |= (1 << SPE) | (1 << MSTR); set_mode(STDBY); - - // LNA, AFC and RXBW settings - write_reg(0x18, 0x88); - write_reg(0x19, 0x55); - write_reg(0x1A, 0x8B); + // modem config: + // GFSK (BT=1.0), no Manchester, whitening, CRC, no address filtering + // AFC BW == RX BW == 2 x bit rate + write_reg(0x02, 0x01); + write_reg(0x03, 0x00); + write_reg(0x04, 0x80); + write_reg(0x05, 0x10); + write_reg(0x06, 0x00); + write_reg(0x19, 0xE0); + write_reg(0x1A, 0xE0); + write_reg(0x37, 0x50); + write_reg(0x38, cfg->payload_len); + // write_reg(0x39, cfg->nodeid); + // DIO mappings: IRQ on DIO0 write_reg(0x25, 0x40); write_reg(0x26, 0x07); @@ -158,10 +163,6 @@ void radio_init(const struct radio_cfg *cfg) write_reg(0x2E, 0x80); write_reg(0x2F, cfg->netid); - // packet config - write_reg(0x37, 0x10); - write_reg(0x38, cfg->payload_len); - write_reg(0x39, cfg->nodeid); // fifo config write_reg(0x3C, 0x8F); |
