MCU doesn't enter sleep mode.

cancel
Showing results for 
Search instead for 
Did you mean: 

MCU doesn't enter sleep mode.

282 Views
tedwu1
Contributor III

Hi friend,

I am using Q9021 with BLE SDK 1.0.0. I found that my code can't go to sleep mode sometimes. It is hard to duplicate and the current consumption is about 2mA. If it goes to sleep, the current consumption is about 2uA. I want to use watchdog to recover firmware failed. But the watchdog fails to recover the firmware fail. I can't find the root cause for the high current consumption. Does anyone know why? The code snippet is as follows.

Thank you in advance.

Ted Wu

int main(void)
{
...

#if (defined(QN_ADV_WDT))
    wdt_init(163840, WDT_RESET_MOD); // 5s
    usr_env.adv_wdt_enable = true;
#endif

...

}

void usr_sleep_restore(void)
{
#if QN_DBG_PRINT
    uart_init(QN_DEBUG_UART, USARTx_CLK(0), UART_9600);
    uart_tx_enable(QN_DEBUG_UART, MASK_ENABLE);
    uart_rx_enable(QN_DEBUG_UART, MASK_ENABLE);
#endif

#if (defined(QN_ADV_WDT))
    if(usr_env.adv_wdt_enable)
    {
        wdt_init(163840, WDT_RESET_MOD); // 5s
}
#endif
}

#if CONFIG_WDT_DEFAULT_IRQHANDLER==TRUE
void WDT_IRQHandler(void)
{
    if (reset_test == 1){ /* When testing watchdog reset, need to stay in WDT_IRQHandler until the watchdog overflows again */
        while (1) {
            // wait for reset...
        }
    }
#if def BLE_PRJ
#if (defined(QN_ADV_WDT))
    usr_env.adv_wdt_to();
#endif
#endif
    wdt_irq_clear(); /* Deassert Watchdog interrupt */

}
#endif /* CONFIG_WDT_DEFAULT_IRQHANDLER==TRUE */

0 Kudos
9 Replies

265 Views
EduardoZamora
NXP Employee
NXP Employee

Hello @tedwu1,

Just to confirm, is this your own implementation of the Sleep Driver? Could you please help us with more details about your application?

By any chance, are you using any of the BLE example projects as base for your application? Wireless examples, such as the BLE Heart Rate Sensor demo, should be optimized for low-power. Please, try any of these examples for low-power measurements.

Regards,
Eduardo.

0 Kudos

251 Views
tedwu1
Contributor III

Hello @EduardoZamora 

This project uses the prj_bass project. I use wdt.c in the SDK 1.0.0. I didn't implement my own Sleep Driver. I used Sleep Driver in the SDK. But it sometimes has high current consumption, it doesn't go into sleep mode. But it's hard to replicate. It drains the battery. Some defines as follows. Is there anything else I need to provide?

Thank you very much

Ted Wu


at app_config.h
#define QN_APP_VER "1.0.0"
...

at usr_config.h
#define CFG_9020_B2
...
/// ADV watchdog timer
//#if (defined(CFG_9020_B0)) <-- I comment it to force enable watchdog
#define CFG_ADV_WDT
//#endif

at driver_config.h
#define CONFIG_ENABLE_DRIVER_WDT TRUE /*!< Enable/Disable WDT Driver */
#define CONFIG_WDT_DEFAULT_IRQHANDLER TRUE /*!< Enable/Disable WDT Default IRQ Handler */
#define CONFIG_WDT_ENABLE_INTERRUPT TRUE /*!< Enable/Disable WDT Interrupt */

 

0 Kudos

238 Views
EduardoZamora
NXP Employee
NXP Employee

Hi,

Just to confirm, are you using a custom board or is it a QN9020DK board from NXP?

prj_bass should implement SDK Sleep Driver by default and, as mentioned, this project should be optimized for low power consumption, therefore it may be not necessary to add your own implementation of the SDK Sleep Driver. The application should enter sleep mode automatically according to the status of user program.

Also, could you please confirm that you are using the correct macros according to the version of your chip? CFG_QN9020_B2 is for D version, CFG_QN9020_B4 is for E version.

Regards,
Eduardo.

0 Kudos

230 Views
tedwu1
Contributor III

Hello @EduardoZamora 

I used our own TPMS board. The TPMS we ship has a 5% return rate. We checked the battery of the returned TPMS and it was dead. We monitor the TPMS with a DC Power Analyzer and we see a high current consumption around 2mA. This phenomenon rarely occurs. I can't find the root cause. This issue has troubled me for a long time. We sold a lot of TPMS with this chip. I think the chip is revision D. How to check?

Thank you very much

Ted Wu

0 Kudos

209 Views
EduardoZamora
NXP Employee
NXP Employee

Hi,

You can find the version in the marking number, printed on the top surface of the chip.

Regards,
Eduardo.

0 Kudos

197 Views
tedwu1
Contributor III

Hi @EduardoZamora 

No "D" or "E" printed on the top side of the chip.

Best regards

Ted Wu

qn9021.png

0 Kudos

185 Views
EduardoZamora
NXP Employee
NXP Employee

Hi,

QN9020Y corresponds to a version that is no longer manufactured. However, "#define CFG_QN9020_B2" should work for this version.

Has this behavior been present before the implementation of WDT? WDT may reset the MCU in an unfavorable situation and prevent the device from entering low power mode, causing a high current consumption.

Regards,
Eduardo.

0 Kudos

179 Views
tedwu1
Contributor III

Hi @EduardoZamora 

This behavior existed before WDT was implemented. So I implemented WDT to reset MCU in an unfavorable situation and prevent the device from causing a high current consumption. But WDT doesn't work, this behavior still existed.

Best wishes

Ted Wu

0 Kudos

168 Views
EduardoZamora
NXP Employee
NXP Employee

Hi,

Since QN9020Y related libraries could be updated, please consider implementing SDK 1.4.0

Regards,
Eduardo.

0 Kudos