hi,everyone!could you help me?
there is low power requirement in automotive electronic technology.I meet such a problem.
Functional requirement:Light a led when signal A from BCM is detected as high level more than 50ms.
I have done the following:
there are two modes:normal mode and low power mode.
1:In normal mode,Light a led when signal A from BCM is detected as high level more than 50ms.it is easy to make.
2:In low power mode(stop mode in mcu),awaken the mcu when the rising edge of the signal A is detected and Light the led when signal A is high level more than 50ms.it is easy to make it too.
the problem is when the signal A turns high level at the 40th ms before the MCU goes into stop mode,the ECU looks like missed the A signal because the software filter.
what i have try:
As long as the acquisition signal A pin of the MCU is high level, MCU will not enter into low-power mode.
Customers do not accept, worried that it is difficult to enter low-power mode.the customer thinks software filter is essential.
Can you help me ?
Hi,
what MCU do you use?
I have one idea...using API for all cases...it could be comon for all MCUs with API.
... not tested....written directly and immediately as answer.... :
1) Set API period, for example, for 52ms and let it disabled.
static void API_Init(unsigned int period, unsigned char clk)
{
CPMUAPICTL_APIFE = 0; // disable API
//---------------------------
CPMUAPICTL_APIF = 1; // clear interrupt flag
CPMUAPIR = period; // change period
CPMUAPICTL_APICLK = clk; // Autonomous Clock (ACLK)/BUSLK = 0/1
CPMUAPICTL_APIE = 1; // interrutp enable
//---------------------------
CPMUAPICTL_APIFE = 0; // let API disabled and prepared to go
}
2a) Everytime, when rising edge of the input signal (switch LED on) is received, start API period.
static inline void API_Go(void)
{
CPMUAPICTL_APIFE = 1; // enable API
}
2b) Everytime, when falling edge of the input signal (switch LED on) is received before API overflows, stop API period.
static inline void API_Stop(void)
{
CPMUAPICTL_APIFE = 0; // disable API
}
3) Results
Case a)
If the end of the input signal (switch LED on) is received within API period (without being affected by STOP mode ) then just switch LED on and disable API.
Case b)
If the STOP is generated sooner than input signal ((switch LED on) ) is is finished (falling edge) then you can go to STOP because API is still running on background.
In this case: MCU is in STOP, API is already running because rising of the edge was received before STOP, end of the input signal (switch LED on) is received within API period => API wakes the MCU up, we switch LEDs on, disable API and enter or leave STOP mode following application requirements.
Case c)
We are in the STOP mode as in the case b) but consider the input signal is longer than API period. In this case MCU is woken up by API, input signal is invalid (longer than 50ms) so we do nothing (LEDs are ignored), only disable API.
I hope it is clear and I have not made mistake...
Probably, there could be better, faster, easier,.....solution but this is what just came to my mind.
Best regards,
Ladislav
Only if necessaty:
//==============================================================================
static void API_ChangePeriod(unsigned int period)
{
API_Stop();
//---------------------------
CPMUAPICTL_APIF = 1; // clear interrupt flag
CPMUAPIR = period; // change period
//---------------------------
API_Go();
}