jgromes / RadioLib

Universal wireless communication library for embedded devices
https://jgromes.github.io/RadioLib/
MIT License
1.47k stars 369 forks source link

LLCC68.h TCXO wrong default value #620

Closed tripla-m closed 1 year ago

tripla-m commented 1 year ago

Describe the bug Using the default values ​​for the LLCC68 chip returns code error -707 when the radio module is booted up. This is caused by an incorrect TCXO value on LLCC68.h file. I've seen other users complain about this, for example here: #353

To Reproduce For reproduce the problem i used SX126x_Trasmit example with only one change Substitute this

SX1262 radio = new Module(10, 2, 3, 9);

with this

LLCC68 radio = new Module(10, 2, 3, 9);

When I upload the code to the board (Arduino DUE), I read this from the serial monitor: [SX1262] Initializing ... failed, code -707

Expected behavior If the default parameters are used

int state = radio.begin();

I expect everything to work correctly.

There are two ways to fix this: 1) set TCXO = 0, like this:

...

#define FREQ 434
#define BDWH 125
#define SPFC 9
#define CRTD 7
#define SCWD RADIOLIB_SX126X_SYNC_WORD_PRIVATE
#define POWR 10
#define PRLH 8
#define TCXO 0                //TCXO, default 1.6
#define RLDO false

....

int state = radio.begin(FREQ, BDWH, SPFC, CRTD, SCWD, POWR, PRLH, TCXO, RLDO);

...

2) change the default tcxoVoltage value on LLCC68.h file from this (row 46, look directly float tcxoVoltage = 1.6):

int16_t begin(float freq = 434.0, float bw = 125.0, uint8_t sf = 9, uint8_t cr = 7, uint8_t syncWord = RADIOLIB_SX126X_SYNC_WORD_PRIVATE, int8_t power = 10, uint16_t preambleLength = 8, float tcxoVoltage = 1.6, bool useRegulatorLDO = false);

to this (float tcxoVoltage = 0):

int16_t begin(float freq = 434.0, float bw = 125.0, uint8_t sf = 9, uint8_t cr = 7, uint8_t syncWord = RADIOLIB_SX126X_SYNC_WORD_PRIVATE, int8_t power = 10, uint16_t preambleLength = 8, float tcxoVoltage = 0, bool useRegulatorLDO = false);

This modification allows you to use radio.begin(); without setting TCXO = 0

Additional info:

jgromes commented 1 year ago

The presence of TCXO or XTAL is a property of your Ebyte module, not of LLCC68 chip inside it. There are other manufacturers that have an LLCC68-based module (e.g. NiceRF, RadioControlli, and maybe others)

If you can show that TCXO is not commonly used on those modules, then we can discuss changing the default.

tripla-m commented 1 year ago

Sorry, I hadn't thought that other modules might have a TCXO crystal. I have to stop working at night.

Thank you.

jgromes commented 1 year ago

No worries, I'm fine with changing the default value, but it needs to be justified. Currently it's 1.6 because it seems that most SX16x modules use TCXO. But if that stops being the case, it can be adjusted.