Programming ESP32 + SX1276 in Rust

Hi everyone. I’m trying to set up an esp32 with my SX1276, and rust.

I have made a little drawing of my current setup:
Untitled Diagram.drawio(1)

And I have my rust code that looks like this:

fn setupsx1276() {

    let peripherals = Peripherals::take().unwrap();
    let spi2 = peripherals.spi2;

    let sclk = peripherals.pins.gpio13;
    let miso = peripherals.pins.gpio14;
    let mosi = peripherals.pins.gpio15;
    let cs = peripherals.pins.gpio12;
    let rst  = peripherals.pins.gpio32;

    println!("Starting SPI loopback test");
    let config = <spi::config::Config as Default>::default().baudrate(18.MHz().into());
    let  spi = spi::Master::<spi::SPI2, _, _, _, _>::new(
        spi::Pins {
            sdo: miso,
            sdi: Some(mosi),
            cs:  Option::<gpio::Gpio15<gpio::Unknown>>::None,
     let mut lora = sx127x_lora::LoRa::new(spi, cs.into_input_output().unwrap(), rst.into_input_output().unwrap(), FREQUENCY,FreeRtos).unwrap();

The issue is that when we create the lora object, it returns an error that looks like this:

This happens because it looks in the regversion register, which it doesnt seem to be able to connect to.

Can anyone help me in finding out if I might be passing in some wrong pins?
Or if i’m not allowed to give my spi a none cs pin?

I moved your post to a new topic because the Big ESP32 topic is mainly targeted at programming in the C++ programming language using the LMIC library as LoRaWAN stack. Your question is about programming in the Rust language.

The ESP32 in combination with LoRaWAN is normally programmed in C++ with the Arduino framework or the ESP-IDF.

While it is possible to program these devices in other languages and with other runtimes, proper LoRaWAN support in such cases is usually lacking. For instance there is some LoRaWAN support availaible for CircuitPython which is based on the TinyLora library but is uplink-only and therefore not LoRaWAN compliant and not suitable for use with The Things Network.

Your above post lacks a ton of details, please exactly describe your situation, what you are trying to achieve, what you have already tried, what technology and libraries you are using and where can we find the source.

Is your question related to LoRa or LoRaWAN?
FYI: This forum is for LoRaWAN and The Things Network only.

Which LoRaWAN stack and library are you using?

Hi, I’m sorry, this is straight LoRa, I assumed this LoRa would fall under here fine.

My lora module library is

Unfortunately it is not, sorry.
You will have to find another forum for that.

This topic was automatically closed after 24 hours. New replies are no longer allowed.