Lora-net / LoRaMac-node

Reference implementation and documentation of a LoRa network node.
Other
1.88k stars 1.09k forks source link

Why are uC pins connected to SX1276 DIOx configured as inputs with pull-UP? #410

Closed pieterconradie closed 6 years ago

pieterconradie commented 6 years ago

Hi everyone,

In sx1276-board.c SX1276IoInit(), the microcontroller GPIO pins connected to DIO0 - DIO4 of the SX1276 are configured as inputs with pull-up. In SX1276IoDeInit() the pull-ups are disabled (when the microcontroller goes into STOP mode to conserve power.

I have been searching the SX1276 datasheet, but it is not stated unambiguously what the state of DIO0 - DIO4 is. Are they Hi-Z until configured with RegDioMapping1(0x40) and RegDioMapping2(0x41)? After configuration, are they push-pull outputs, or open-drain? Or are they ALWAYS push-pull (as soon as the SX1276 exit reset)?

If DIO0 - DIO4 are ALWAYS push-pull, why the need to enable internal pull-up resistors? Can I safely configure the microcontroller pins as inputs without pull-up/down? This is for the Murata ABZ module where the STM32L082 GPIO pins are always connected to SX1276 DIO0 - DIO4.

Thanks in advance, Pieter

GregCris commented 6 years ago

Hi Pieter,

DIO0 to DIO4 are always push-pull and the use of internal pull-ups is not mandatory. The DIO are always configured at boot, the register RegDioMapping is configured by default at 0x00 and thus the DIO are configured as they appear in Sleep mode in the DIO tables of the datasheet.