RL78G13 - Wake on UART from stop mode

Hello,

I want to enter STOP mode on the RL78/G13 and be able to wake up from STOP mode via UART.

Per my understanding, there is no way to directly wake up from STOP to NORMAL operation mode?

However, you can wake up to snooze mode. Per my understanding, in snooze mode, UART is only able to communicate with a baudrate of 4800 bps.
My UART device is not able to communicate below 9600 bps. In snooze mode i am not interested in actually deciphering the UART communication i just want to wake up.
I seems like triggering the INTSREq is the way to go. No matter what, i need to hold RxDq high for some time, to be able to trigger the snooze mode. The RL78/G13 User's Manual states that the RxDq needs to be held low for sufficient time.

So my questions are:
How long does my start bit need to be, to be able to trigger snooze mode?
Is it possible to wake up from a device that communicates with a baudrate 9600 bps? or 38400 bps?
Is this the best way to wake up on UART?
Can you provide some timing diagrams that have a time-axis?

Thanks you in advance and best regards,
\Mads

  • Hello Mads,

    Thanks for reaching out Renesas Community.

    Please, take a look at the app note below ( sample code is included), that describes a similar application example and it sets tranfer rate to 9600bps.

    Low-power Consumption Operation (UART in SNOOZE Mode).zip

    Hope it helps!

    Regards,

    AL_Renesas

  • Hello,

    Thank you for Your quick feedback. I have been looking at the app note earlier, though there is something i do not understand. The app note states that the transfer rate can be set at 9600, although the RL78/G13 User Manuel states "Transfer rate in the SNOOZE mode is 4800 bps only" on page 956, note 1. What am i missing?

    Furthermore, the app note still does not clearly define the minimum requirement for a start bit to be detected?

    Regards,
    Mads

  • Hello dear Mads, sorry for the delay. 

    To evaluate the situation, let's first dig deeper into the SNOOZE mode and STOP mode and how they deal with serial array units. 

    As you already know, when we're in STOP mode, an unmasked interrupt will result in a transition to RUN mode.

    Also in the SNOOZE mode, the HOCO oscillator is on, just some special peripherals are fed by the main high-speed clock, and the CPU is off. Also, a transition from STOP mode to SNOOZE entails some delay due to oscillation accuracy stabilization time. In the worst case, it takes about 65uS to run.  

    When we configure the UART for working in SNOOZE mode, (As you observe in the provided example by AL_RENESAS) here's what happens after going to STOP mode:

    upon a transition in the RXD pin, a transition from STOP mode to Snooze mode will happen, next the HOCO Oscillator will be enabled after clock accuracy stabilization time (18 μs to 65 μs) and the UART peripheral clock will be provided, the UART will process the RXD pin as usual, and if a serial frame is evaluated correctly, the receive end interrupt will be issued and causes a transition from snooze mode to Normal mode, now the code starts to run after STOP instruction and the receiving end interrupt ISR code will be executed as usual.


    -Why in UART snooze mode we cannot exceed more than 4800bps?
    +As the baud rate implies, a start bit in UARTframe for example in 9600bps is about '100uS' on the other hand a transition from STOP mode to SNOOZE mode will take more than 65uS in the worst case, so high chances are the UART frame will not be recognized correctly by the peripheral, and it won't issue a receive end interrupt (Due interpreting corrupted frame), and will not wake up the CPU (You might get it working in 9600bps, but there's no guarantee because the timing is near the edge)!

    So, If you're not willing to use the 4800bps baud rate, you cannot utilize the SNOOZE feature, but there are some workarounds here, which come with drawbacks:


    1-The intended behavior is, to recognize a correct UART frame, then wake up the CPU and collect the data from the UART buffer, and not to omit any data. but we can enable the receive error Interrupt generation in snooze mode, so that if we receive a frame that is faster than 4800bps, the first frame will be recognized as a corrupted frame, but as the result of generating the UART error interrupt, a transition from SNOOZE to RUN will happen and wakes up the CPU! and we can receive remaining data normally at any baud rate.

    2-The second workaround is, that you can look at the RXD0 pin as normal INPUT GPIO, then enable the external interrupt on this pin, before going to STOP mode.
    Then if a transition happens, the CPU will operate and you can reconfigure the GPIO for the UART peripheral.


    By the way in both methods, you'll lose some frames or at least the first frame of the data.

    I hope you find that information helpful, don't hesitate to ask for clarification if needed. 

    Best regards, Hossein.

    If this response or any other user's response answers your concern, kindly verify the answer. Thank you!

    Renesas Engineering Community Moderator
    https://community.renesas.com/
    https://academy.renesas.com/
    https://en-support.renesas.com/knowledgeBase/

  • Hello Hossein,

    That was a really adequate answer :) Thank you for taking the time to explain in detail how the whole thing works, especially the confusion about 9600 and 4800 bps baud rate. I very much appreciate it!


    Best regards, Mads

  • That's great to hear! We're always here to help. Have a fantastic time!