So the E22 presents two options for control of Tx/Rx switching:
-
“Manual” mode: in this configuration, both the E22’s
TXEN
and itsRXEN
pins are connected to the MCU, and the MCU controls Tx/Rx switching. The E22’sDIO2
pin is unconnected. -
“Automatic” mode: in this configuration, the E22’s
TXEN
andDIO2
pins are connected to each other, and nothing else; the E22 controls them itself. However, the firmware must still defineSX126X_RXEN
, and the E22’sRXEN
pin must still be connected to that MCU pin.
There are probably use cases for manual Tx/Rx switching, but in my experience the two modes perform identically. Since the XIAO has such limited GPIO to begin with, I have been using automatic mode exclusively.
Your schematic is essentially correct for that setup, except that you do not need the SX126X_TXEN
signal coming off the E22’s TXEN
and DIO2
pins on the right – that can be omitted, since neither pin will be connected to the XIAO.
My builds of this setup have for the most part all worked very well. The XIAO’s built-in charger is too slow (100 mA max) to be practical given the battery sizes you will probably want to use (500+ mAh), so adding an external charger is a good idea. I like this one from Adafruit since it’s small and cheap, and it includes a JST for the battery and two pins which can be used to add a physical on/off switch.
In order to build the firmware, one small change is needed in light of recent updates to the repo – variants/xiao_ble/variant.h
should have the following line added:
#define BATTERY_SENSE_RESOLUTION_BITS 10
Without this change, the build will fail with an error like this:
src/Power.cpp:192:79: error: 'BATTERY_SENSE_RESOLUTION_BITS' was not declared in this scope
(One of these days I will get around to PRing this )
Good luck with the project, and let us know how it goes!