rust-iot / rust-radio-sx128x

Rust driver for the Semtec SX128x series of 2.4GHz LoRa/ISM radio transceivers
Mozilla Public License 2.0
13 stars 6 forks source link

`sx128x-util rx` data appears invalid #2

Closed ryankurte closed 4 years ago

ryankurte commented 5 years ago

sender:

sx128x-util --log-level debug gfsk tx --data "abcd"
22:43:30 [DEBUG] sx128x_util: Connecting to SPI device
22:43:30 [DEBUG] sx128x_util: Configuring I/O pins
22:43:30 [DEBUG] sx128x_util: Creating radio instance
22:43:30 [DEBUG] sx128x_util: Settings: Settings { xtal_freq: 52000000 }
22:43:30 [DEBUG] sx128x_util: Config: Config { regulator_mode: Dcdc, pa_config: PaConfig { power: 10, ramp_time: Ramp20Us }, packet_type: None, modem: LoRa(LoRaConfig { preamble_length: 8, header_type: Explicit, payload_length: 64, crc_mode: Enabled, invert_iq: Inverted }), channel: LoRa(LoRaChannel { freq: 2400000000, sf: Sf8, bw: Bw200kHz, cr: Cr4_5 }), timeout: Single }
22:43:30 [DEBUG] radio_sx128x: Set regulator mode Dcdc
22:43:30 [DEBUG] radio_sx128x: Setting channel config: LoRa(LoRaChannel { freq: 2400000000, sf: Sf8, bw: Bw200kHz, cr: Cr4_5 })
22:43:30 [DEBUG] radio_sx128x: Setting frequency (2400 MHz, 12121212 index)
22:43:30 [DEBUG] radio_sx128x: Setting modem config: LoRa(LoRaConfig { preamble_length: 8, header_type: Explicit, payload_length: 64, crc_mode: Enabled, invert_iq: Inverted })
22:43:30 [DEBUG] radio_sx128x: Setting TX power to 10 dBm Ramp20Us ramp (28, 224)
22:43:30 [DEBUG] sx128x_util: Executing command
22:43:30 [DEBUG] radio_sx128x: Set regulator mode Dcdc
22:43:30 [DEBUG] radio_sx128x: Setting channel config: Gfsk(GfskChannel { freq: 2400000000, br_bw: BR_0_250_BW_0_3, mi: MOD_IND_0_35, ms: Off })
22:43:30 [DEBUG] radio_sx128x: Setting frequency (2400 MHz, 12121212 index)
22:43:30 [DEBUG] radio_sx128x: Setting modem config: Gfsk(GfskConfig { preamble_length: PreambleLength16, sync_word_length: GFSK_SYNCWORD_LENGTH_2_BYTE, sync_word_match: RADIO_RX_MATCH_SYNCWORD_2, header_type: Variable, payload_length: 64, crc_type: RADIO_CRC_2_BYTES, whitening: RADIO_WHITENING_ON })
22:43:30 [DEBUG] radio_sx128x: Setting TX power to 10 dBm Ramp20Us ramp (28, 224)
22:43:30 [DEBUG] radio_sx128x: TX start
22:43:30 [DEBUG] radio_sx128x: Setting modem config: Gfsk(GfskConfig { preamble_length: PreambleLength16, sync_word_length: GFSK_SYNCWORD_LENGTH_2_BYTE, sync_word_match: RADIO_RX_MATCH_SYNCWORD_2, header_type: Variable, payload_length: 4, crc_type: RADIO_CRC_2_BYTES, whitening: RADIO_WHITENING_ON })
22:43:30 [DEBUG] radio_sx128x: Set buff base address (tx: 0, rx: 0)
22:43:30 [DEBUG] radio_sx128x: Setting IRQ mask TX_DONE | CRC_ERROR | RX_TX_TIMEOUT
22:43:30 [DEBUG] radio_sx128x: TX complete
22:43:30 [DEBUG] sx128x_util::operations: Send complete

receiver:

sx128x-util --log-level debug gfsk rx
02:41:16 [DEBUG] sx128x_util: Connecting to SPI device
02:41:16 [DEBUG] sx128x_util: Configuring I/O pins
02:41:16 [DEBUG] sx128x_util: Creating radio instance
02:41:16 [DEBUG] sx128x_util: Settings: Settings { xtal_freq: 52000000 }
02:41:16 [DEBUG] sx128x_util: Config: Config { regulator_mode: Dcdc, pa_config: PaConfig { power: 10, ramp_time: Ramp20Us }, packet_type: None, modem: LoRa(LoRaConfig { preamble_length: 8, header_type: Explicit, payload_length: 64, crc_mode: Enabled, invert_iq: Inverted }), channel: LoRa(LoRaChannel { freq: 2400000000, sf: Sf8, bw: Bw200kHz, cr: Cr4_5 }), timeout: Single }
02:41:16 [DEBUG] radio_sx128x: Set regulator mode Dcdc
02:41:16 [DEBUG] radio_sx128x: Setting channel config: LoRa(LoRaChannel { freq: 2400000000, sf: Sf8, bw: Bw200kHz, cr: Cr4_5 })
02:41:16 [DEBUG] radio_sx128x: Setting frequency (2400 MHz, 12121212 index)
02:41:16 [DEBUG] radio_sx128x: Setting modem config: LoRa(LoRaConfig { preamble_length: 8, header_type: Explicit, payload_length: 64, crc_mode: Enabled, invert_iq: Inverted })
02:41:16 [DEBUG] radio_sx128x: Setting TX power to 10 dBm Ramp20Us ramp (28, 224)
02:41:16 [DEBUG] sx128x_util: Executing command
02:41:16 [DEBUG] radio_sx128x: Set regulator mode Dcdc
02:41:16 [DEBUG] radio_sx128x: Setting channel config: Gfsk(GfskChannel { freq: 2400000000, br_bw: BR_0_250_BW_0_3, mi: MOD_IND_0_35, ms: Off })
02:41:16 [DEBUG] radio_sx128x: Setting frequency (2400 MHz, 12121212 index)
02:41:16 [DEBUG] radio_sx128x: Setting modem config: Gfsk(GfskConfig { preamble_length: PreambleLength16, sync_word_length: GFSK_SYNCWORD_LENGTH_2_BYTE, sync_word_match: RADIO_RX_MATCH_SYNCWORD_2, header_type: Variable, payload_length: 64, crc_type: RADIO_CRC_2_BYTES, whitening: RADIO_WHITENING_ON })
02:41:16 [DEBUG] radio_sx128x: Setting TX power to 10 dBm Ramp20Us ramp (28, 224)
02:41:16 [DEBUG] radio_sx128x: RX start
02:41:16 [DEBUG] radio_sx128x: Set buff base address (tx: 0, rx: 0)
02:41:16 [DEBUG] radio_sx128x: Setting modem config: Gfsk(GfskConfig { preamble_length: PreambleLength16, sync_word_length: GFSK_SYNCWORD_LENGTH_2_BYTE, sync_word_match: RADIO_RX_MATCH_SYNCWORD_2, header_type: Variable, payload_length: 64, crc_type: RADIO_CRC_2_BYTES, whitening: RADIO_WHITENING_ON })
02:41:16 [DEBUG] radio_sx128x: Setting IRQ mask RX_DONE | CRC_ERROR | RX_TX_TIMEOUT
02:41:23 [DEBUG] radio_sx128x: RX complete
02:41:23 [DEBUG] radio_sx128x: RX buffer ptr: 0 len: 87
02:41:23 [DEBUG] radio_sx128x: RX get received, ptr: 0 len: 87
02:41:23 [DEBUG] radio_sx128x: RX packet info PacketInfo { rssi: -105, rssi_sync: Some(-89), snr: None, packet_status: LENGTH_ERROR | CRC_ERROR | HEADER_RECEIVED | PACKET_RECEIVED, tx_rx_status: (empty), sync_addr_status: 0 }
02:41:23 [DEBUG] radio_sx128x: RX info: PacketInfo { rssi: -105, rssi_sync: Some(-89), snr: None, packet_status: LENGTH_ERROR | CRC_ERROR | HEADER_RECEIVED | PACKET_RECEIVED, tx_rx_status: (empty), sync_addr_status: 0 }
02:41:23 [INFO] Received: '[50, 72, 107, 150, 74, 240, 183, 218, 222, 114, 20, 137, 155, 159, 11, 147, 220, 153, 7, 207, 146, 54, 219, 95, 15, 6, 119, 99, 15, 183, 96, 142, 6, 58, 103, 184, 227, 83, 226, 241, 218, 52, 172, 212, 171, 225, 110, 167, 135, 60, 67, 60, 103, 178, 207, 203, 110, 42, 198, 209, 59, 52, 179, 138, 64, 64, 145, 230, 148, 72, 153, 170, 192, 222, 112, 248, 75, 219, 139, 92, 0, 156, 213, 72, 19, 183, 40]' info: PacketInfo { rssi: -105, rssi_sync: Some(-89), snr: None, packet_status: LENGTH_ERROR | CRC_ERROR | HEADER_RECEIVED | PACKET_RECEIVED, tx_rx_status: (empty), sync_addr_status: 0 }
ryankurte commented 4 years ago

GFSK mode now receiving packets, however not writing any data / radio reports 0 packet length.