ehong-tl / micropySX126X

Semtech SX126X LoRa driver for Micropython and CircuitPython.
MIT License
106 stars 22 forks source link

setTCXO needs to be called before calibration is run #29

Open Celliwig opened 2 months ago

Celliwig commented 2 months ago

In the class SX126X, 'setTCXO' is called after 'config' for both 'begin' and 'beginFSK'. 'config' runs the calibration command. The TCXO needs to be configured before calibration is run. so currently you have:

        state = self.config(....)
        ASSERT(state)

        if tcxoVoltage > 0.0:
            state = self.setTCXO(tcxoVoltage)
            ASSERT(state)

This needs to be changed to:

        if tcxoVoltage > 0.0:
            state = self.setTCXO(tcxoVoltage)
            ASSERT(state)

        state = self.config(....)
        ASSERT(state)

This led to a loss of several decibels going by the returned RSSI.

ehong-tl commented 2 months ago

Hi @Celliwig

You probably right.

Can you help test it again from the test branch? https://github.com/ehong-tl/micropySX126X/tree/test

Currently I don't have the hardware in hand for testing.

Celliwig commented 2 months ago

Sorry, I can't test it I'm afraid. Actually using this library as a basis for a Python implementation on a RPi (I have weird requirements in regards to handling CS lines so used this, rather than some other implementations).

Sorry about that...