Tested with Raspberry Pi 4B and LoRa with chip SX1276
1.Install wiringpi, update with version 2.52
sudo make update
2.Connect LoRa with Raspberry Pi 4B
LoRa SX1276 | Raspberry Pi 4B |
3.3v | 3.3v |
GND | GND |
NSS | GPIO.21 |
DIO0 | GPIO.22 |
RESET | GPIO.23 |
MOSI | MOSI |
MISO | MISO |
SCK | SCK |
My LoRa library have this public functions -
void setPin(int ssPin, int dio0, int RST);
void setSPIFrequency(uint32_t frequency);
void selectreceiver();
void unselectreceiver();
byte readReg(byte addr);
void writeReg(byte addr, byte value);
void opmode (uint8_t mode);
void opmodeLora();
void setFrequency(uint32_t frequency);
void setSyncWord(uint8_t sw);
void setSpreadingFactor(uint8_t sf);
boolean receive(byte *payload);
int packetRssi();
int Rssi();
long int packetSnr();
void receivepacket();
void configPower(int8_t pw);
void writeBuf(byte addr, byte *value, byte len);
void txlora(byte *frame, byte datalen);
void configTransmitter();
void configReceiver();
uint8_t getSF();
uint32_t getLoRaFreq();
int ReceivedBytes();
boolean dio0State();
void dumpRegisters();
LoRa();
~LoRa();
int begin(uint32_t frequency);
3.Run
make
4.run
./main rec
or
./main sender