Unable to wake up UNO R4 / XIAO RA4M1 from software standby

Hi,
I cannot wake up UNO R4 and the XIAO MA4R1 from software standby. AttachInterrupt() only works in sleep mode with current consumption of several mA. In software standby I measure ~40 uA! I am new to this hobby and maybe a bit too old for it. At the moment I can't get any further and will otherwise forget about UNO R4 and XIAO. I would be very happy about any help.
I have read some contributions from @susan-parker. For her, this is probably child's play.

Best regards

1 Like

The Arduino IDE based setup isn't so easy to use for very low power modes. I could do it, time permitting, but that's why I stopped at the basic Wake-From-Interrupt function and clock frequency changes.

If I wanted proper low-power, I would be using e2studio as it has the background setup control that is taken care of with the Arduino bootloader, and using the RA4M1 dev board as it has an embedded Segger debugger.

Having got stuff working, I would then see about transferring over to the Arduino IDE. Don't forget to do something about the millis() timer.

Some info here from the Renesas knowledge base (will need to sign-up for access):

https://en-support.renesas.com/knowledgeBase/20203210

General note for the Minima, the Power LED takes c.8mA by itself!

1 Like

thank you very much for the answer! very disappointing! I will sacrifice a few more hours to find my mistake, otherwise I will go with attiny and throw the things in the trash, as I don't feel like familiarizing myself with a complex other IDE. As I told you, i am old, every hour counts. :grin: Have a nice weekend!

Maybe @Delta_G has a hint, what is wrong? I only want to wake up the MCU, no ISR, no other interrupt in the project, everything else works. Word watch with e-paper display and time announcement, optional radiation detector.

1 Like

Hi @armin_ius

I assume you have had a look at what I do with clock switching, etc. in:

https://github.com/TriodeGirl/Arduino-UNO-R4-Wake_from_interrupt-and-system-clock-switching

I am old too; my first programming was paper-tape and punch-cards! :slight_smile:

I assume you have had a look at what I do with clock switching, etc.

Susan, of course I know that, but it doesn't help me, I need a quiescent current in the uA range for wearables. I haven't been playing with something like this for long, but here's a project of mine, when I started programming: LED_Watch Achieves a Quasi-Analog Display with 240 LEDs and Unique Etching Technique - Hackster.io

1 Like

found my mistakes.

supply current XIAO ist ~40 uA in software standby at the moment
Interrupt pin for Arduino is P002 (A3), for XIAO P002 (D3).
I will work on further reduction of the supply current,
1-5 uA should be possible (manual page 1327).

If the XIAO is in software standby, it can be difficult to access via the IDE. Sometimes it is not possible outside boot mode. In particular if wfi is executed directly after the reset and the ssb is configured incorrectly. Sometimes it helps to press reset twice in quick succession before starting upload! It is better to program a few seconds delay before the wfi instruction when experimenting!

Best regards

Armin

#define IELSR5    *((volatile uint32_t*)0x40006314) // ICU event link setting register

void setup() {
  
  pinMode(LED_BUILTIN, OUTPUT);
  
  R_SYSTEM -> PRCR = 0xA503;                                     // Write access to SBYCR 
  R_SYSTEM -> SBYCR_b.SSBY = 1;                                 //software standby mode   
                                              
  R_DTC -> DTCST_b.DTCST = 0;  
  R_SYSTEM -> OSTDCR_b.OSTDE = 0;                                //oscillation stop detection off
  R_ICU -> WUPEN = 0x00000010;                                   //IRQ4 in WUPEN
   
}

void loop() { 

  R_PFS->PORT[4].PIN[11].PmnPFS = (1 << R_PFS_PORT_PIN_PmnPFS_PCR_Pos) | (1 << R_PFS_PORT_PIN_PmnPFS_ISEL_Pos); // enable interrupt 
  asm volatile("wfi");
  R_ICU->IELSR[5] &= ~(R_ICU_IELSR_IR_Msk);
  
   
  for(int i=0;i<3;i++){                                           
    digitalWrite(LED_BUILTIN, HIGH);  
    delay(1000);                     
    digitalWrite(LED_BUILTIN, LOW);   
  delay(1000); 
  }   
}
1 Like

Nice!
Thanks for the further info and update.
Best,
Susan.