cancel
Showing results for 
Search instead for 
Did you mean: 

Hi, I am using a STM32H7 microcontroller. I want to implement a waking up from sleep mode as a result of receiving a pulse that his width is bigger than a predefined value.

yhak.1
Associate II

No other details.

8 REPLIES 8

Run some low power clock (LPTIM, RTC). Wake up on the leading edge of pulse, store time to memory and go back to sleep. Wake up on the trailing edge of the pulse, from current and stored time determine the pulse width, if it's long enough, keep doing whatever you wanted to do after the wakeup, otherwise go back to sleep.

JW

yhak.1
Associate II

The problem is that if my line is noisy, the microcontroller will wake up a lot of unnecessary times.

TDK
Guru

There's no way to do this without waking up the CPU.

If you want to change hardware, you could implement an RC charging circuit and wake up when the threshold is passed.

Some timers have glitch filters which could be used, but only for a very limited selection of pulse values.

If you feel a post has answered your question, please click "Accept as Solution".
yhak.1
Associate II
Hi, I got your suggestion, and I am trying to implement MCU COMP to detect a voltage threshold cross. The threshold should be any value. For that, I used "COMP_Interrupt" example while configuring the inverting input as "COMP_INPUT_MINUS_DAC1_CH1". I also configured DAC1 CH1 as same as presented in "DAC_SimpleConversion" example. However, I saw that despite the noninverted input (PB0) crosses inverted input (PA4), no comparator interrupt is created. The code is attached. Please rename the file extension from rar1 to rar. Could you kindly help me with it? Regards, Yair Hakak FW engineer, Pointer A PowerFleet(r) Brand www.pointer.com<> [O] +972 35723112 [M] +972 544992614

Are you sure analog peripherals such as DAC and comparator are available in sleep? Check in PWR chapter of RM.

It should be possible to upload zipped projects directly here, by clicking on the "paperclip" icon below the editor window.

JW

Hi, [Are you sure analog peripherals such as DAC and comparator are available in sleep?] I think so, pleaes see the bellow quote from the reference manual: [cid:image002.png@01D76DBF.387BD660] [It should be possible to upload zipped projects directly here, by clicking on the "paperclip" icon below the editor window.] I do see any paperclip here. However, I tried to re-attach the project. I also can not enter "My support request" on your site. I got an error message. If you have some other option, it will be very helpful. However, do you have some other option for how my CPU could wake up from hibernation due to voltage change? Regards, Yair Hakak FW engineer, Pointer A PowerFleet(r) Brand www.pointer.com<> [O] +972 35723112 [M] +972 544992614
https://pointer2-my.sharepoint.com/personal/yairh_pointer_com/Documents/Share/My%20COMP_Interrupt.rar1 If u did not receive the project file, please try to download it from the above link. Regards, Yair Hakak FW engineer, Pointer A PowerFleet(r) Brand www.pointer.com<> [O] +972 35723112 [M] +972 544992614
Hi, I manage to solve the problem. The main change is above marked line. /*##-2- Configure DAC channel1 #############################################*/ sConfig.DAC_Trigger = DAC_TRIGGER_NONE; sConfig.DAC_OutputBuffer = DAC_OUTPUTBUFFER_ENABLE; sConfig.DAC_ConnectOnChipPeripheral = DAC_CHIPCONNECT_ENABLE; sConfig.DAC_UserTrimming = DAC_TRIMMING_FACTORY; if (HAL_DAC_ConfigChannel(&DacHandle, &sConfig, DACx_CHANNEL) != HAL_OK) { /* Channel configuration Error */ Error_Handler(); } Thanks for all your help! Regards, Yair Hakak FW engineer, Pointer A PowerFleet(r) Brand www.pointer.com<> [O] +972 35723112 [M] +972 544992614