Confused about PIN definition in variant.h / power management


I’m a little confused about the pins and the definition of those in the variant.h file.

I’m using the RAK4631 and in the variant.h, the WB_IO2 is pointing to pin 34.

I’m using RAK4631 with the RAK19007 base board. On the baseboards datasheet, the IO2 is actually defined as pin 30 for the J1 connector.
The RAK4631’s connector diagram also shows pin 30 to point to IO2.

So - what am i not getting right about the variant.h file?

Which PIN should i set to LOW to disable the 3V3_S output for the various slots available? (i’d like to turn of some sensors completely)

You are mixing up pins numbers and GPIO numbers.

In the RAK4631 the nRF52 GPIO1.02 (translates to 34) is connected to WB_IO2, so for the nRF52 to toggle the right GPIO, the variant.h says WB_IO2 34.

The pin number on the connectors has nothing to do with the GPIO numbers of the nRF52

Thanks @beegee

I must be daft or stupid, but how does GPIO1.02 translate to 34?
Like, is there a translation table, or some special calculation?

Anyway, do i understand correctly that if i have a module on slot A and slot D, that i can turn on/off the 3v3_s by setting WB_IO2 to LOW/HIGH?
Is there a way to do that /per/ slot?

I’m currently using the RAK12014 on Slot A and RAK12500 on Slot D.
The device is meant to take a measurement and GPS fix and then send it out over Lora. The logic works, but i was optimizing this a little bit, by waking up the RAK12500 and then doing a distance measurement (while the RAK12500 was busy getting a fix).
The procedure for the RAK12014 uses the sensor.VL53L0X_Off() and sensor.end() when it’s done measuring. These two methods turn set WB_IO2 to LOW and change the WB_IO2 to INPUT.

This influences the GPS because i think the WB_IO2 also controls the power to Slot D.
This is not terribly clear on the datasheets of the RAK19007:

So - based on all of this, is there a way to turn of the power to specific slots?

The GPIO’s in the nRF52 are numbered P0.00 to 0.31 and 1.00 to 1.31

As Arduino cannot work with 0.01 or 1.12, the GPIO’s are just numbered like
0.00 => 0
0.01 => 1

0.31 => 31
1.00 => 32
1.01 => 33
1.02 => 34

Each sensor slot has two supply pins called 3V3 (sometimes called Vdd) and 3V3_S.

WB_IO2 controls the supply voltage called 3V3_S.
WB_IO2 = high ==> 3V3_S is on
WB_IO2 = low ==> 3V3_S is off

Now it depends on the module if it uses 3V3 (Vdd) or 3V3_S as supply voltage. Modules that use 3V3_S can be switched off, modules that use 3V3 cannot be switched off.

The RAK12500 is using 3V3_S and can therefor complete powered down, controlled by WB_IO2.

You cannot turn off power of specific slots, you can only turn off 3V3_S and all modules that use it will be shut down.


Sorry to follow up on this message. I’m just not sure about some stuff.

I’m trying some power modes on the RAK12500 and i’d like to do the PowerOffWithInterrupt().

The UBlox manual, as well as the sparksfun library states that the interrupt needs to be either of these pins:

const uint32_t VAL_RXM_PMREQ_WAKEUPSOURCE_UARTRX = 0x00000008;  // uartrx
const uint32_t VAL_RXM_PMREQ_WAKEUPSOURCE_EXTINT0 = 0x00000020; // extint0
const uint32_t VAL_RXM_PMREQ_WAKEUPSOURCE_EXTINT1 = 0x00000040; // extint1
const uint32_t VAL_RXM_PMREQ_WAKEUPSOURCE_SPICS = 0x00000080;   // spics

I’m having trouble reading all the technical diagrams, that’s clearly due to my lack of knowledge… but - how would i be able to tell which pin is connected to what so that i know what i can set low/high? Do i have to trace the pins from the RAK4630 to the RAK4631 to the base board and then to the RAK12500?

From what i understand, only the UART_RX can be used.

Why i get to that conclusion is this:
On the RAK12500 connector, we have these connections:

This would mean that only the following connections are connected:

  • I2C_SCL
  • I2C_SSDA
  • IO6
  • 1PPS
  • 3V3_S
  • VDD

As i’m using I2C to communicate, it means i can’t use VAL_RXM_PMREQ_WAKEUPSOURCE_SPICS.
The VAL_RXM_PMREQ_WAKEUPSOURCE_EXTINT0 and VAL_RXM_PMREQ_WAKEUPSOURCE_EXTINT1 don’t seem to be connected, which leaves only the UART_RX to use.

Is this all correct?

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.