Search found 19 matches

by Leonardo_evaldt
Mon Sep 18, 2017 8:41 am
Forum: Maple & Maple mini etc
Topic: Timer and Interrupt used together to leave sleep mode
Replies: 27
Views: 649

Re: Timer and Interrupt used together to leave sleep mode

If you just want to test that code, you can try instead using an external pin, there is examples on the forum about getting the mcu to sleep and waking it up with the onboard button. Thanks, I will try it asap. Victor, my initial problem was about putting my maple mini on Sleep mode with a pre-exis...
by Leonardo_evaldt
Fri Sep 15, 2017 7:14 am
Forum: Maple & Maple mini etc
Topic: Timer and Interrupt used together to leave sleep mode
Replies: 27
Views: 649

Re: Timer and Interrupt used together to leave sleep mode

Thanks Pito. It clarifies a lot of things. So Roger is trying to help me to re-enumerate the serial after I lost connection. Something in the core could do it. I just need to find out how. It's understood now. But the problem of serial disconnection is not my biggest problem. I still trying to figur...
by Leonardo_evaldt
Fri Sep 15, 2017 6:07 am
Forum: Maple & Maple mini etc
Topic: Timer and Interrupt used together to leave sleep mode
Replies: 27
Views: 649

Re: Timer and Interrupt used together to leave sleep mode

The core does not have code which supports re-enumeration of USB on boards except the Maple Mini. And even on the Maple mini I've never tried to do it. I'm sure it would be possible to modify the code, but you'd need to write code to for re-enumeration just before calling Serial.begin() I'm not und...
by Leonardo_evaldt
Fri Sep 15, 2017 5:41 am
Forum: Maple & Maple mini etc
Topic: Timer and Interrupt used together to leave sleep mode
Replies: 27
Views: 649

Re: Timer and Interrupt used together to leave sleep mode

No More like You'd need to call Serial.end() before sleeping, and call Serial.begin() when you wake again. But... Its not likely to work on a BluePill Roger, I realy sorry. I'm not so used to programing like you. I'm many steps behind you. This is what I understant about your previous post: Setup()...
by Leonardo_evaldt
Fri Sep 15, 2017 5:07 am
Forum: Maple & Maple mini etc
Topic: Timer and Interrupt used together to leave sleep mode
Replies: 27
Views: 649

Re: Timer and Interrupt used together to leave sleep mode

RogerClark wrote:
Fri Sep 15, 2017 4:57 am
Looking at the existing code ...

You would need to call Serial.end() and then call Serial.begin()

just after you code wakes from sleep
Like This?

Code: Select all

loop(){
...
Serial.end();
sleepAndWakeUp(STOP, &rt, alarmDelay);
Serial.begin();
...
}
by Leonardo_evaldt
Fri Sep 15, 2017 4:43 am
Forum: Maple & Maple mini etc
Topic: Timer and Interrupt used together to leave sleep mode
Replies: 27
Views: 649

Re: Timer and Interrupt used together to leave sleep mode

Sleeping will disconnect USB. I suspected. Thank you for confirming, Roger. You could try calling Serial.begin() again when waking from sleep but there is no guarantee that this works, because when powered via USB its not normal to sleep the MCU as its pointless as power consumption would not be an...
by Leonardo_evaldt
Fri Sep 15, 2017 1:45 am
Forum: Maple & Maple mini etc
Topic: Timer and Interrupt used together to leave sleep mode
Replies: 27
Views: 649

Re: Timer and Interrupt used together to leave sleep mode

Dont worry. The ADC is not important now. I can test without it. I'm reading the function sleepAndWakeUp. It uses asm(" wfi"). So, seems to me that this function also uses interrupts to leave sleep mode. So I decided to test the "stm32_periodic_stop.ino" exemple. I added a blink test. the problem is...
by Leonardo_evaldt
Thu Sep 14, 2017 11:22 pm
Forum: Maple & Maple mini etc
Topic: Timer and Interrupt used together to leave sleep mode
Replies: 27
Views: 649

Re: Timer and Interrupt used together to leave sleep mode

The title makes more sense now, "Maple and sleep" is just extremely wide. Nice :D. Thank you for this help. I'm new here. I'm still learning. I still not understanding exactly how you want to wake up. You say you want a pin interrupt to wake the MCU, to me that means a pin toggling from high to low...
by Leonardo_evaldt
Thu Sep 14, 2017 10:35 pm
Forum: Maple & Maple mini etc
Topic: Timer and Interrupt used together to leave sleep mode
Replies: 27
Views: 649

Timer and Interrupt used together to leave sleep mode

Yes I did. Acobo used this strange function “adc_disable_all();” to disable the ADC and this one setGPIOModeToAllPins(GPIO_INPUT_ANALOG) to disable the GPIO. I didn’t understand exactly how this functions works but, in my case, I cant use the first one. My interrupt uses the ADC to wake up. After a ...
by Leonardo_evaldt
Thu Sep 14, 2017 9:19 pm
Forum: Maple & Maple mini etc
Topic: Timer and Interrupt used together to leave sleep mode
Replies: 27
Views: 649

Timer and Interrupt used together to leave sleep mode

Victor, Again, all topics I found didnt anwser my question. I need a topic who provide me a library that give me the option of put maple mini in sleep mode with two ways to leave it: By a interrupt OR by a timer. BOTH AT THE SAME CODE. Perhaps you are talking about this topic http://www.stm32duino.c...