mike_cat_taylor@hotmail.com

Forum Replies Created

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • in reply to: Determine wakeup reason (RTC or interrupt) #26590

    Oddly, it comes back out of sleep, but it never goes through the ISR.

    [INFO] ~~woke up, fromInterrupt=0~~
    [INFO] –Back from sleep (woke_from_interrupt=0, pin=1)–

    [INFO] Going back to sleep (INTERRUPT On DIO7 Pin)
    [INFO] entering sleep (stop) mode 00000037

    The fact that the pin is still high, means I know why it exited.

    in reply to: Determine wakeup reason (RTC or interrupt) #26589

    Thanks, that’s more to try… I am just giving this guys code a whirl just in case there is something different about it https://os.mbed.com/users/janjongboom/code/mdot_two_way/file/0fd5e5e121ea/main.cpp/

    in reply to: Determine wakeup reason (RTC or interrupt) #26581

    This is my code as it stands. On opening the circuit (i.e. so it is no longer grounded), the processor comes out of sleep, but it seemingly never goes through the ISR to set the flag to true. I am a bit lost as what else to try now. Any suggestions most welcome.

    mDot* dot = NULL;
    lora::ChannelPlan* plan = NULL;
    
    Serial pc(USBTX, USBRX);
    
    static bool deep_sleep = false;
    
    // define ISR's 
    bool rise_flag = false, fall_flag = false;
    
    void rise_handler(void) {
        rise_flag = true;
    }
    
    void fall_handler(void) {
        fall_flag = true;
    }
    
    DigitalIn pa0pin(PA_0);
    
    int main() {
        // Custom event handler for automatically displaying RX data
        RadioEvent events;
       
        pc.baud(115200);
        
        mts::MTSLog::setLogLevel(mts::MTSLog::TRACE_LEVEL);
        
        plan = new lora::ChannelPlan_EU868();
        dot = mDot::getInstance(plan);
        assert(dot);
    
        // attach the custom events handler
        dot->setEvents(&events);
        logInfo("--Starting (version %f)--", VERSION);
        
        pa0pin.mode(PullUp);  //set the board to use a pullup resistor on pin PA0
            
        InterruptIn in(PA_0);
        in.rise(&rise_handler);
        in.fall(&fall_handler);
        
        while (true) {
            rise_flag = fall_flag = false;
            logInfo("--Going to sleep now, deep_sleep=%d--",deep_sleep);
            sleep_wake_rtc_or_interrupt(deep_sleep);
            //logInfo("\r\n");
            logInfo("--Back from sleep (rise_flag=%d fall_flag=%d, pin=%d)--",rise_flag,fall_flag,pa0pin.read() );
        }
        return 0;
    }

    Sample output from opening the circuit:-
    [INFO] –Back from sleep (rise_flag=0 fall_flag=0, pin=1)–
    [INFO] –Going to sleep now, deep_sleep=0–
    [INFO] sleeping 10s or until interrupt on DIO7 pin
    [INFO] application will resume after waking up

    in reply to: Determine wakeup reason (RTC or interrupt) #26572

    Tried that and no joy, but I think I’ve been starring at this for too long now. Will try again tomorrow.

    Thanks for your assistance.

    in reply to: Determine wakeup reason (RTC or interrupt) #26570

    Thanks for your assistance Ryan, I have made some progress. Here is what I have implemented.

    bool rise_flag = false;
    bool fall_flag = false;
    
    void rise_handler(void) {
        rise_flag = true;
    }
    void fall_handler(void) {
        fall_flag = true;
    }

    And just before the sleep_wake_rtc_or_interrupt() call, I set:-

    InterruptIn in(PA_0);
     in.rise(&rise_handler);
     in.fall(&fall_handler);

    I seem to get the fall flag set, but the rise_flag never gets set, even though it returns from the sleep.

    Any ideas?

Viewing 5 posts - 1 through 5 (of 5 total)