Help needed please, with SX1262 tranceivers not receiving any data!

Started by top204, Mar 20, 2025, 03:32 PM

Previous topic - Next topic

Fanie

Here is some Arduino code as well
https://github.com/thekakester/Arduino-LoRa-Sx1262

I asked both my brothers if they used this Lora before but they haven't answered.
My younger brother is a fitter and turner, working for an agriculture (don't want to say) farm where he implemented a complete water purifying system controlled remotely which he implemented and programmed himself.
As you can see, I'm the dumb one in the family.

top204

I've seen multitudes of C++ codes for them, and they are all copies and pastes of the original company firmware. With loading a small array buffer with items, then calling a function to use the values in the buffer to control the op-codes and registers of the SX device. I must now have about 20, apparently, different C++ library source codes for the SX devices, all doing the same thing with the same function mechanisms, and most still using the original variable and function names!! :-)

The library I have created, should work perfectly. But for some inexplicable reason, it doesn't on the SX (LLCC) boards I have.

But thanks for replying Fanie.

Fanie

Any chance yours are faulty ?  I once made a FET driver, I couldn't get it to fail.  Even abused it.  Then when I made more, none of them would work.  Seems the batch I got was something wrong with.
Most of these modules should work without any problems, many use them.

JonW


JonW

It's been a while since I last worked on the breadboard... :P

RFS LORA.png

Good news, Les: your code works perfectly with the SX1262 on the RFS modules  ;D .  Nice Job!  I have just updated the Procedure as mentioned and added some formatting to my serial tool.

Since its all up and running I may as well have a play with it.

I extended the LED delays a bit


You can change the header now to :

'
'   /\\\\\\\\\
'  /\\\///////\\\
'  \/\\\     \/\\\                                                 /\\\          /\\\
'   \/\\\\\\\\\\\/        /\\\\\     /\\\\\\\\\\     /\\\\\\\\   /\\\\\\\\\\\  /\\\\\\\\\\\  /\\\\\\\\\
'    \/\\\//////\\\      /\\\///\\\  \/\\\//////    /\\\/////\\\ \////\\\////  \////\\\////  \////////\\\
'     \/\\\    \//\\\    /\\\  \//\\\ \/\\\\\\\\\\  /\\\\\\\\\\\     \/\\\         \/\\\        /\\\\\\\\\\
'      \/\\\     \//\\\  \//\\\  /\\\  \////////\\\ \//\\///////      \/\\\ /\\     \/\\\ /\\   /\\\/////\\\
'       \/\\\      \//\\\  \///\\\\\/    /\\\\\\\\\\  \//\\\\\\\\\\    \//\\\\\      \//\\\\\   \//\\\\\\\\/\\
'        \///        \///     \/////     \//////////    \//////////      \/////        \/////     \////////\//
'                                  Let's find out together what makes a PIC Tick!
'
' Receiver code for an SX1262 transceiver, using a LAMBDA62 board, operating with a 32MHz oscillator driving the SX1262 device. "That is working!".
'
'
' Written by Les Johnson for the Positron8 BASIC compiler.
'
 

Fanie

Quote from: JonW on Apr 05, 2025, 01:51 PMOne of his modules has a different IC on it. 

It's been a while since I last worked on the breadboard...

tsk tsk...

top204

Thanks to Dyanko's fresh eyes in the code and datasheet for the LLCC68 device, the problem has been found and I now have transmit and receive. :-)

I could not see the wood for the trees, because I was going around and around trying to find a big problem. Yet the problem, believe it or not, was a single value placed into an LLCC68 register!

As Dyanko pointed out, the LLCC68 device is a thinned down SX device, and it has less Spread Factor settings for particular Bandwidths, and I was using an incorrect Spread Factor setting for the 125KHz Bandwidth. I had tried, 10, 11, 12 etc, but never thought of decreasing it, and the correct setting is a Spread Factor of 9. i.e. The cSX_VAL_SF9 constant I created.

Who would have thought that a single incorrect setting in the multitude of registers they have, would cause such a catastrophic failure. I thought it may limit range, or miss some values, but not totally fail to transmit correctly and receive correctly!

Many thanks Dyanko, and I am relieved that my SX126x/LLCC6x library code is working nicely. Also, many thanks JonW.

I'm busy tidying the library up for both speed and size and will upload it to the forum ASAP.

I now need to get the Deep Sleep working as it should, because I have tried it and it fails to receive correctly. Sometimes it does, and other times it doesn't. Mostly, it doesn't. :-(

Regards
Les

evoortman

I'm trying to get an ebyte E22-900M22S LoRa module working using the code from "SX1262_TX_RX_Code_Mk2_03-04-2025.zip."
This E22 module has an SX1262 chip (not the LLCC chip, verified ;) ).
However, on a logic analyzer, during initialization, I see that the module only responds back with 0xAA or 0xA2 over the SPI.
The module is not transmitting and the IRQ on DIO1 always remains low.
@Les, have you seen this also? Do you know what the 0xAA and 0xA2 mean?

Regards, Erik

evoortman

LoRa module is working now.
The ebyte E22-900M22S uses DIO3 for TCXO control. This wasn't enabled in the code yet.
Probably this wasn't necessary for the LAMBDA62 module?

top204

I gave up on them, because their documentation is dreadful, and their operation is far too complex. One slightly incorrect setup value that does not match the "stricly dedicated" sequence, and they fail.

I also could not get them to go into low power mode at all, and in RX standby mode, the current draw was far too high.

It can be accomplished, but because of the poor documentation and dreadful manufacturer firmware for them, I simply could not get it to work as I needed, i.e. Very Low Power when listening, even after weeks of trying.

evoortman

Hi Les, if you ever want to give it another try, this is what the init procedure looks like with the TCXO and standby settings:

Proc SX1262_Init(pFrequency As Float, pPreambleLength As Byte, pSyncWord As Word, pPacketLen As SX_bPacketLen)
    SX_Reset()                                                                      ' Reset the SX chip
    DelayMS 10                                                                      ' \
    SX_WaitFor_NotBusy()                                                            ' / Wait for the SX device to be ready

    ' Power TCXO via DIO3 (1.8V) with 10ms warmup before using XOSC
    SX_SendCommand5(cSX_CMD_SET_DIO3_AS_TCXO_CTRL, cSX_VAL_DIO3_OUTPUT_1_8, $00, $00, cSX_VAL_TCXO_DELAY_10.Byte1, cSX_VAL_TCXO_DELAY_10.Byte0)

    SX_SendCommand1(cSX_CMD_SET_STANDBY, cSX_VAL_STANDBY_XOSC)                      ' Go to Standby - STDBY_XOSC mode
    SX_RegMode(cSX_VAL_REGULATOR_LDO)                                              ' Set regulator power mode to LDO
    SX_SendCommand1(cSX_CMD_SET_PACKET_TYPE, cSX_VAL_cLORA_MODEM)                  ' Define the protocol as LoRa
    SX_SetTxClamp($DE)                                                              ' Modify the TxClampConfig register
    SX_Calibrate(%01111111)                                                        ' Start calibration of RC64k, RC13M, PLL and ADC
    SX_CalibrateImage(pFrequency)                                                  ' Start image calibration over the frequency band
    SX_SetRfFrequency(pFrequency)                                                  ' Define the RF frequency as RFfrequency = (RFFreq * FXTAL) / (2 ^ 25)
'
' Setup the LoRa modulation parameters
' Mod Param1 --> pSpreadingFctr 10
' Mod Param2 --> Bandwidth 125 KHz
' Mod Param3 --> CR = 4/8
' Mod Param4 --> LowDataRateOptimise = On
'
    SX_SetModPrmsLoRa(cSX_VAL_SF10, cSX_VAL_BW_125000, cSX_VAL_CR_4_8, True)
'
' Setup the LoRa packet format
' Pack Param1 --> Preamble Length
' Pack Param2 --> Header Type = Fixed length packet (implicit header)
' Pack Param3 --> pPacketLen
' Pack Param4 --> CRC = Off
' Pack Param5 --> InvertIQ = Standard IQ setup
'
    SX_SetPktPrmsLoRa(pPreambleLength, cSX_VAL_HEADER_IMPLICIT, pPacketLen, cSX_VAL_CRC_OFF, cSX_VAL_IQ_STANDARD)

    SX_SetSyncWord(pSyncWord)                                                      ' Setup Sync Word value
'
' Setup where the data payload will be stored in the buffer
' For maximum capacity, TX and RX will use the same address of $0000 and will have 256 bytes space
'
    SX_SetPayloadAddr($0000)
    SX_SetPaConfig($04, $07, $00)                                                  ' Setup the Power Amplifier configuration for +22 dBm
    SX_SetTxPrms(22, cSX_VAL_PA_RAMP_80U)                                          ' Setup output power +22 dBm and ramping time 80uS
    SX_SetOverCurrent(140)                                                          ' Set Over Current Protection to 140mA
    SX_SetRX_Gain(cSX_VAL_BOOSTED_GAIN)                                            ' Rx Gain Configuration to Rx Boosted gain

    [b]SX_SetFallbackMode(cSX_VAL_FALLBACK_STDBY_XOSC)                                ' After Rx/Tx, fall back to Standby with XOSC[/b]
    SX_bPacketLen = pPacketLen                                                      ' Ensure RX/TX use the configured payload length

    SX_IRQ_Clear()                                                                  ' Clear the IRQ
'
' Configure DIO and IRQ --> RxDone IRQ mapped to SX_DIO1_Pin
'
    SX_IRQ_Config(cSX_VAL_IRQ_RX_DONE, cSX_VAL_IRQ_RX_DONE, cSX_VAL_IRQ_NONE, cSX_VAL_IRQ_NONE)
    SX_IRQ_Clear()
EndProc