Can’t use WB_IO1 and WB IO2 pins on RAK4631 with RAK19007

Hi, I’m trying to configure WB_IO1 and WB_IO2 as digital inputs with pull-up to read buttons, but it’s not working as I expected :frowning:

I’m using platformio and in my code I initialize both pins as:

pinMode(WB_IO1, INPUT_PULLUP);
pinMode(WB_IO2, INPUT_PULLUP);

However when reading with digitalRead I only get 0 (expecting to read 1).:

Serial.print("WB_IO1: ");
Serial.println(digitalRead(WB_IO1)); -> 0
Serial.print("WB_IO2: ");
Serial.println(digitalRead(WB_IO2)); ->0

I checked with multimeter the voltage values on both pins and they aren’t at 3.3V as I expected. Then I tried to set them as input_pulldown but measuring again I don’t get the equivalent of 0V, comparing with AIN1 which works perfect. I understand that these pins are used to configure another part of the hardware, but I don’t know if I have to make any previous settings to be able to use them?

Thank you very much for your help!

Welcome to the forum @loky32 .

On WB_IO2, a low reading is possible due to the fact that some Base Board versions have a pulldown resistor. It depends on what variant of load switch is controlled by WB_IO2.
WB_IO1 works as expected with this code:

#include <Arduino.h>
#include<Adafruit_TinyUSB.h>

void setup()
{
	Serial.begin(115200);
	delay(5000);
}

void loop()
{
	Serial.println("Setting IO's with pull-down");
	pinMode(WB_IO1, INPUT_PULLDOWN);
	pinMode(WB_IO2, INPUT_PULLDOWN);
	delay(500);
	Serial.println("Reading IO's");
	Serial.printf("WB_IO1: %s\r\n", digitalRead(WB_IO1) == HIGH ? "HIGH" : "LOW");
	Serial.printf("WB_IO2: %s\r\n", digitalRead(WB_IO2) == HIGH ? "HIGH" : "LOW");
	delay(500);
	Serial.println("Setting IO's with pull-up");
	pinMode(WB_IO1, INPUT_PULLUP);
	pinMode(WB_IO2, INPUT_PULLUP);
	delay(500);
	Serial.println("Reading IO's");
	Serial.printf("WB_IO1: %s\r\n", digitalRead(WB_IO1) == HIGH ? "HIGH" : "LOW");
	Serial.printf("WB_IO2: %s\r\n", digitalRead(WB_IO2) == HIGH ? "HIGH" : "LOW");
	delay(5000);
}

Result on a RAK19007 VB:
image

Result on a RAK19007 VC:
image

Result on a RAK19003 VE:
image

Thanks for your reply @beegee , i tested the example code posted and this is my terminal output:

Setting IO's with pull-down
Reading IO's
WB_IO1: LOW
WB_IO2: LOW
Setting IO's with pull-up
Reading IO's
WB_IO1: LOW
WB_IO2: LOW
Setting IO's with pull-down
Reading IO's
WB_IO1: LOW
WB_IO2: LOW
Setting IO's with pull-up
Reading IO's
WB_IO1: LOW
WB_IO2: LOW
Setting IO's with pull-down
Reading IO's
WB_IO1: LOW
WB_IO2: LOW

It seems that it is not possible to enable pull-up, my board model is RAK19007 Rev B and I’m using 3-axis sensor (1904) and enviroment sensor (1905) in slot A and B.

RAK1904 has two interrupt outputs, when you use it in Slot A it uses WB_IO1 and WB_IO2.
Put the RAK1904 into Slot C or Slot D.

Thanks for the information @beegee , finally used TX1 and RX1 pins as digital inputs with pull-up and works perfect (still using slot A and B).