Skip to content

SPI clock not configured — RadioLib default is 2 MHz #2508

@carsten-walther

Description

@carsten-walther

File: variants/**/target.cpp

RADIO_CLASS radio = new Module(P_LORA_NSS, P_LORA_DIO_1, P_LORA_RESET, P_LORA_BUSY, spi);

Without explicit SPISettings, RadioLib uses the platform default—which is 2 MHz. According to the Semtech datasheet, the SX1262 supports SPI up to 16 MHz. All radio-internal operations run via SPI: getIrqFlags(), getCurrentRSSI(), startReceive(), startTransmit(), readData(), getPacketLength(). At 2 MHz, a single 16-bit IRQ read (including SPI overhead) takes ~10–15 µs. At 8 MHz, this drops to ~3–4 µs.

Impact: isReceivingPacket() is called on every checkSend() call in the main loop and reads the IRQ flags via SPI. Likewise, getCurrentRSSI() is used for noise floor calibration (64 samples × SPI read). Any reduction in SPI latency directly improves the loop frequency.

Suggestion: Module constructor with an explicit SPISettings parameter (RadioLib ≥ 6.x).

File: variants/**/target.cpp

RADIO_CLASS radio = new Module(P_LORA_NSS, P_LORA_DIO_1, P_LORA_RESET, P_LORA_BUSY, spi, SPISettings(8000000, MSBFIRST, SPI_MODE0));

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions