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:
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(
spi2,
spi::Pins {
sclk,
sdo: miso,
sdi: Some(mosi),
cs: Option::<gpio::Gpio15<gpio::Unknown>>::None,
},
config,
).unwrap();
println!("spistuff");
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:
VersionMismatch(0)
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?