Difference between revisions of "User:JF/JF's note on PineDio devices"

Jump to navigation Jump to search
no edit summary
(Created page with "== USB LoRa adapter == 500px The Pine64 USB LoRa adapter is based on the Semtech SX1262 LoRa module and the CH341 USB bus converter chip....")
Tags: Mobile web edit Mobile edit
Line 244: Line 244:
* CH341 datasheet : [[File:CH341DS1.pdf]]
* CH341 datasheet : [[File:CH341DS1.pdf]]
* Semtech SX1262 datasheet : [https://semtech.my.salesforce.com/sfc/p/#E0000000JelG/a/2R000000HT76/7Nka9W5WgugoZe.xwIHJy6ebj1hW8UJ.USO_Pt2CLLo File on Semtech website (file is too big for the wiki)]
* Semtech SX1262 datasheet : [https://semtech.my.salesforce.com/sfc/p/#E0000000JelG/a/2R000000HT76/7Nka9W5WgugoZe.xwIHJy6ebj1hW8UJ.USO_Pt2CLLo File on Semtech website (file is too big for the wiki)]
== RAW LoRa communication between USB LoRa adapter and PineDio STACK ==
=== Test setup ===
* One Pine64 USB LoRa adapter (SX1262 + CH341)
* One PineDio STACK (BL604 + SX1262)
* One PyCom Lopy board (dev board based on ESP32 + LoRa module, MicroPython)
* One NooElec SDR adapter and GQRX running on my PC
The goal is to implement RAW LoRa communication between Pine64 LoRa devices (USB adapter + PineDio STACK at first, pinephone adapter later on).
The Lopy board allows me to debug my setup easily, as I know it's working correctly in both RX and TX.
I'm writing this section to share my experiments with RAW LoRa on those devices and maybe get some help on some issues. I'm a noob in RF and LoRa technologies !
=== RX on Pine64 devices ===
Setup : The Lopy board emits 16 Bytes every 5s
Using default TX settings on the Lopy (868Mhz, BW 125Khz, SF7, 8 preamble symbols, CR 4/5, IQ not inverted), the reception on both Pine64 devices was really poor : they would detect the preamble most of the time, but fail to check the CRC of the header or of the payload.
Then I change those settings : 868Mhz, BW 500Khz, SF12, 8 preamble symbols, CR 4/5, IQ inverted. Magically, the reception on both device was perfect!
Question : why the RX was not working with original settings and would work with the new ones?
=== TX from Pine64 devices ===
Using the same TX parameters as the previous test : 868Mhz, BW 500Khz, SF12, 8 preamble symbols, CR 4/5, IQ inverted
==== TX from the USB LoRa Adapter ====
On the SDR acquisition, the TX power seems lower than the Lopy board, even with TX power set to +22dB
The Lopy does not receive anything.
The STACK detects the message but detects a bad CRC. Indeed, the messages is scrambled...
The RSSI and SNR are displayed. I notice that the RSSI is much lower for messages coming from the USB adapter than for messages coming from the Lopy
Questions :
- Is it normal that the power of the TX from the USB adapter looks much lower than the power from the lopy?
- What about the RSSI that is much lower on messages comng from the USB adapter?
- Why are the messages and CRC corrupted ?
==== TX from the PineDio STACK ====
On the SDR acquisition, the signal power looks similar than the Lopy.
The Pine64 USB adapter receives the message but detects a bad CRC.
The Lopy board does not receive anything (probably because of messages with bad CRC that are dropped in lower level layers).
Questions :
- Why are the messages corrupted?
=== Code ===
==== PineDio STACK ====
Based on this driver: https://github.com/lupyuen/bl_iot_sdk/blob/pinedio/components/3rdparty/lora-sx1262/src/radio.c
  RadioEvents_t RadioEvents;
  RadioEvents.RxDone = OnRadioRxDone;
  RadioEvents.RxError = OnRadioRxError;
  RadioEvents.TxDone = OnRadioTxDone;
          2, //500khz
          12, //SF12
          1, // CR 4/5
          0, // N/A
          8, // preamble
          7, // symbol timeout
          0, // dynamic length
          0, // payload length
          1, // crc enabled
          0, // freq hoping disabled
          0, // hop period
          1, // no iq inversion
          1// continous receive
          0, // power
          0, //N/A
          2, // 500 khz
          12, // SF12
          1, // CR4/5
          8, // preamble
          false, // dynamic length
          true, // CRC ON
          false, // hop
          0, // hop period
          true, // invert iq
          0xffffffff // timeout
  // RX
  while(1) {
  // OR TX
  const char msg[] = {"Hello, I'm a PineDio STACK!"};
  int i = 0;
  while(1) {
    if((i % 30) ==0){
      Radio.Send((uint8_t *) msg, strlen(msg));
==== USB adapter ====
Based on this driver: https://github.com/YukiWorkshop/sx126x_driver
  radio.SetBufferBaseAddresses(0, 0);
  SX126x::ModulationParams_t modulationParams;
  modulationParams.PacketType = SX126x::RadioPacketTypes_t::PACKET_TYPE_LORA;
  modulationParams.Params.LoRa.SpreadingFactor = SX126x::RadioLoRaSpreadingFactors_t::LORA_SF12;
  modulationParams.Params.LoRa.CodingRate = SX126x::RadioLoRaCodingRates_t::LORA_CR_4_5;
  modulationParams.Params.LoRa.Bandwidth = SX126x::RadioLoRaBandwidths_t::LORA_BW_500;
  modulationParams.Params.LoRa.LowDatarateOptimize = false;
  SX126x::PacketParams_t packetParams;
  packetParams.PacketType = SX126x::RadioPacketTypes_t::PACKET_TYPE_LORA;
  packetParams.Params.LoRa.PreambleLength = 8;
  packetParams.Params.LoRa.HeaderType = SX126x::RadioLoRaPacketLengthsMode_t::LORA_PACKET_VARIABLE_LENGTH;
  packetParams.Params.LoRa.PayloadLength = 27;
  packetParams.Params.LoRa.CrcMode = SX126x::RadioLoRaCrcModes_t::LORA_CRC_ON;
  packetParams.Params.LoRa.InvertIQ = SX126x::RadioLoRaIQModes_t::LORA_IQ_INVERTED;
  radio.SetTxParams(22, SX126x::RADIO_RAMP_3400_US);
  radio.SetDioIrqParams(0xffff, 0x0001, 0, 0);
// RX
  while (1) {
// OR TX
  while (1) {
    radio.SetPayload(data, 27);


Navigation menu