3 years, 8 months ago.

mdot wakeup after deep sleep not reading PA_0

i did some measurements on this with the code below. put a volt meter on the port pa_0, nothing else. also: bare board, not in the programmer, just connected: gnd, 5volt, pa_2 connected to usb-serial-device and pa_0 to voltmeter.

what i see is after power-up pa_0 has 3.00 volt till sleep where it drops to 0 volt. that all seems nice. but after wake-up/restart the pin stays at 0 volt. looks like the internal pull up is not engaged. output and code below

any ideas why this does not work?

thanks frank


Build: May 25 2016, 08:58:47
changes 0 1
changes 0 1
changes 0 1
changes 0 1
changes 0 1
changes 0 1
changes 0 1
changes 0 1
changes 0 1
changes 0 1
Build: May 25 2016, 08:58:47
changes 0 0
changes 0 0
changes 0 0
changes 0 0
changes 0 0
changes 0 0
changes 0 0
changes 0 0
changes 0 0

pa_0 problem

#include "mbed.h"
#include "rtos.h"
#include "mDot.h"
#include "MTSLog.h"
#include "MTSText.h"

using namespace mts;

#define REED_PORT   PA_0

RawSerial pc(PA_2,NC);

volatile int reed_has_changed = 0;

void isr_reed_sensor_change(void) {

main() {
    pc.printf("Build: " __DATE__ ", " __TIME__"\r\n");
    mDot* dot = mDot::getInstance();

    DigitalIn reed_sensor(REED_PORT);

    InterruptIn reed_sensor_change(REED_PORT);
    while(1) {
         for(int i=0;i<10;i++) {
            pc.printf("changes %d %d\r\n",reed_has_changed,reed_sensor.read());
         dot->sleep((int)5, mDot::RTC_ALARM_OR_INTERRUPT, true);

hi all

i want to wakeup the multitech mdot with gpio or rtc before sleep i can read PA_0 and the values are correct after deepsleep i always read 0 even if it read 1 before sleep it also does not wakeup from the gpio, only rtc any idea what is going on?

thanks, frank

gpio init

void isr_ my_gpio_change(void) {
    my_gpio_has_changed = 1;

DigitalIn my_gpio(PA_0);
InterruptIn * my_gpio_change;
my_gpio_change = new InterruptIn(PA_0);

gpio read

// pc is RawSerial
pc.printf("gpio %d\r\n",my_gpio.read());


dot->sleep(sleep_time, mDot::RTC_ALARM_OR_INTERRUPT, true);

Hi Frank,

Here is a solution: mDot* dot = mDot::getInstance(); dot->setLogLevel(MTSLog::TRACE_LEVEL); if(dot->getStandbyFlag()){ PWR->CSR &= PWR_CSR_EWUP; }

Explanation: When the mdot is placed in deep sleep with wake on INTERRUPT or RTC_ALARM_OR_INTERRUPT, the only pin that can be used as the interrupt to wake it is PA_0. In that case, the bit below is set to one. So upon reset/power up, we need to clear that bit if we are coming out of standby(deep sleep) mode.

From the ST Micro reference guide... "Bit 8 EWUP: Enable WKUP pin This bit is set and cleared by software. 0: WKUP pin is used for general purpose I/O. An event on the WKUP pin does not wakeup the device from Standby mode. 1: WKUP pin is used for wakeup from Standby mode and forced in input pull down configuration (rising edge on WKUP pin wakes-up the system from Standby mode). Note: This bit is reset by a system reset."

I will enter a ticket in our tracking system to provide a fix that will not require the user's application to mess with it. Let me know if the above solution is reasonable fix for you in the mean time.

Kind regards, Leon

posted by frank boddeke 25 May 2016
Be the first to answer this question.