Hi, I need a real code example to use RAK4631 on a RAK19007 with RAK12002
on the provided 3 examples there is no info whether it needs the SLOT to be powered on before, after and in between. Nor explains how to.
then when trying to wake up from RTC the definitions are not clear too.
carlrowan
(Carl Rowan)
2
Hi @richonguzman ,
RAK12002 is always powered. It is directly tied to 3.3V supply of WisBlock Baseboard.
If you will use it’s interrupt for wake up, the IO pins to use depend on what sensor SLOT it is connected.
Many examples how to setup alarm, etc. is on the library - GitHub - melopero/Melopero_RV-3028_Arduino_Library
Hi @carlrowan,
so I start the board (arduino code in vscode + platformio)
#include <Melopero_RV3028.h>
Melopero_RV3028 rtc;
setup() {
// definition of led green and blue
pinMode(both_leds, OUTPUT);
Wire.setPins(BOARD_SDA, BOARD_SCL);
Wire.begin();
rtc.initI2C();
rtc.enablePeriodicTimer(WAKEUP_INTERVAL, Hz1_60, true, true);
delay(1000);
processBlinkingLedsFor5secs();
// WB_IO2 = Pin 34 = P1.02
uint32_t physicalPin = g_ADigitalPinMap[RTC_INT_PIN]; // Debería ser 34
Serial.print("Configuring wakeup on physical pin: ");
Serial.println(physicalPin);
if (physicalPin >= 32) {
// Pin está en P1 (32-47)
uint32_t p1_pin = physicalPin - 32; // P1.02
Serial.print("Configuring P1.");
Serial.println(p1_pin);
// Configurar P1.02 con SENSE_LOW
NRF_P1->PIN_CNF[p1_pin] =
(GPIO_PIN_CNF_DIR_Input << GPIO_PIN_CNF_DIR_Pos) |
(GPIO_PIN_CNF_INPUT_Connect << GPIO_PIN_CNF_INPUT_Pos) |
(GPIO_PIN_CNF_PULL_Pullup << GPIO_PIN_CNF_PULL_Pos) |
(GPIO_PIN_CNF_SENSE_Low << GPIO_PIN_CNF_SENSE_Pos);
// CRÍTICO: Limpiar LATCH del puerto P1
NRF_P1->LATCH = (1UL << p1_pin);
} else {
// Pin en P0
NRF_P0->PIN_CNF[physicalPin] =
(GPIO_PIN_CNF_DIR_Input << GPIO_PIN_CNF_DIR_Pos) |
(GPIO_PIN_CNF_INPUT_Connect << GPIO_PIN_CNF_INPUT_Pos) |
(GPIO_PIN_CNF_PULL_Pullup << GPIO_PIN_CNF_PULL_Pos) |
(GPIO_PIN_CNF_SENSE_Low << GPIO_PIN_CNF_SENSE_Pos);
NRF_P0->LATCH = (1UL << physicalPin);
}
rtc.clearInterruptFlags(false, true, false);
delay(1000);
bothLedsOFF();
NRF_POWER->SYSTEMOFF = 1;
}
Expected behavior, wake up from deep sleep with the RTC RAK12002 connected to SLOT_A, but no success