i use an RX5808 5.8GHz video receiver to read the RSSI for the corresponding channel i set with SPI. Thats working great. The retrieving data is send via RA-01 (SX1278) to the server. The Problem is that i cant set the RX5808 channel after LoRa.begin() is called.
At the beginning of my setup() i set the slave select pins to OUTPUT and HIGH. Both devices getting initialized. Then the slave select for the RX5808 is LOW and the LoRa SS is HIGH right before changing the video channel. But its just not working. If LoRa.begin() is removed i can set the RX5808 channel without problems.
What is LoRa.begin() doing that communication with another SPI device fails? And what is a possible solution?
main.ino
#include <LoRa.h>
const int VRX_SPI_SELECT = 3;
const int VRX_SPI_DATA = 10;
const int VRX_SPI_CLOCK = 12;
const int VRX_RSSI = 7;
const int LORA_SELECT = 9;
const int LORA_RESET = 8;
const int LORA_DATA = 2;
#include "lora.h";
#include "vrx.h";
using namespace lora;
using namespace vrx;
void setup() {
Serial.begin(9600);
pinMode(VRX_SPI_SELECT,OUTPUT);
digitalWrite(VRX_SPI_SELECT,HIGH);
pinMode(LORA_SELECT,OUTPUT);
digitalWrite(LORA_SELECT,HIGH);
vrx::init();
lora::init();
}
void loop() {
lora::receive();
AutoTune();
delay(1);
}
int highValue=0;
int highChannel=0;
void AutoTune()
{
String txt="";
int val=0;
Serial.println("AutoTune");
int count = 0;
for(count=0;count<40;count++)
{
vrx::setChannel(count);
delay(50);
val = analogRead(A7); // read the input pin
if(val > highValue)
{
highValue=val;
highChannel=count;
}
txt += String(val) + " ";
if(count == 7 || count == 15 || count == 23 || count == 31 || count == 39) {
txt += "\n";
}
}
count=highChannel;
vrx::setChannel(count);
Serial.println(txt);
Serial.println("------");
}
Hi,
i use an RX5808 5.8GHz video receiver to read the RSSI for the corresponding channel i set with SPI. Thats working great. The retrieving data is send via RA-01 (SX1278) to the server. The Problem is that i cant set the RX5808 channel after LoRa.begin() is called.
At the beginning of my setup() i set the slave select pins to OUTPUT and HIGH. Both devices getting initialized. Then the slave select for the RX5808 is LOW and the LoRa SS is HIGH right before changing the video channel. But its just not working. If LoRa.begin() is removed i can set the RX5808 channel without problems.
What is LoRa.begin() doing that communication with another SPI device fails? And what is a possible solution?
main.ino
lora.h
vrx.h (original: https://github.com/simonchambers/fs-5.8g-vrx/blob/master/Firmware/fs_skyrf_58g-main.c)