Configuring CodeRate for region (ism2400)

Dear Friends!

Tinkering with 2.4GHz device (prototype, yet provided by manufacturer) we found that it sends join-requests with CodeRate “4/8LI” but chirpstack answers (sends accept) with coderate “4/5”.

Quickly glancing at code I suspected it is hardcoded to “4/5” in chirpstack V3 - is this correct, or there is some way to modify it?

As for chirpstack V4 we have currently testing the same on it with seemingly similar failure to send accept - but yet need to retrieve packet forwarder logs and debug a bit to know for sure.

So could it be configured in either V3 or V4?

Dear @brocaar , I support this question. Is there some way to configure coderate in chirpstack v3/v4?

Dear @brocaar, I see in chirpstack v4 chirpstack/chirpstack/src/downlink/helpers.rs, here only chirpstack_api::gw::CodeRate::Cr45.into() is used for all devices despite their requested coderate:

pub fn set_tx_info_data_rate(
    tx_info: &mut chirpstack_api::gw::DownlinkTxInfo,
    dr: &DataRateModulation,
) -> Result<()> {
    match dr {
        DataRateModulation::Lora(v) => {
            tx_info.modulation = Some(gw::Modulation {
                parameters: Some(gw::modulation::Parameters::Lora(gw::LoraModulationInfo {
                    bandwidth: v.bandwidth,
                    spreading_factor: v.spreading_factor as u32,
                    code_rate: chirpstack_api::gw::CodeRate::Cr45.into(),
                    polarization_inversion: true,
                    code_rate_legacy: "".into(),
                })),
            });
        }
        DataRateModulation::Fsk(v) => {
            tx_info.modulation = Some(gw::Modulation {
                parameters: Some(gw::modulation::Parameters::Fsk(gw::FskModulationInfo {
                    datarate: v.bitrate,
                    frequency_deviation: v.bitrate / 2, // see: https://github.com/brocaar/chirpstack-gateway-bridge/issues/16
                })),
            });
        }
        DataRateModulation::LrFhss(_) => {
            return Err(anyhow!("LR-FHSS is not supported for downlink"));
        }
    }

    Ok(())
}

I believe that’s why I face this warning in my packet-forwarder:

and I believe that’s why I face infinite loop of Join Request from my device ISM2400.

1 Like

Could you create a GitHub issue for this, then I’ll look into this ASAP :slight_smile: (Issues · chirpstack/chirpstack · GitHub)