协处理器重启两次才能唤醒主CPU一次??

swi_xlc
Posts: 1
Joined: Wed Oct 30, 2019 3:30 am

协处理器重启两次才能唤醒主CPU一次??

Postby swi_xlc » Wed Oct 30, 2019 3:49 am

原本设想是ulp执行一次唤醒主mcu一次,然后mcu打印完之后在进入深度睡眠。然后这样不断的循环。
实际测试出来的结果是ulp执行2次才唤醒主mcu一次,这是为什么。


下面虚线之后的这段代码是协处理器ulp执行完任务后,会执行的唤醒主CPU操作,但每次都会先执行一次exit分支,然后ulp重启后在执行完一次任务之后,才在跳转到wake_up分支。


想看看RTC_CNTL_STATE0_REG寄存器是干什么的:
#define DR_REG_RTCCNTL_BASE 0x3ff48000
#define RTC_CNTL_LOW_POWER_ST_REG (DR_REG_RTCCNTL_BASE + 0xc0)
#define RTC_CNTL_DIAG0_REG RTC_CNTL_LOW_POWER_ST_REG

READ_RTC_REG(RTC_CNTL_DIAG0_REG, 19, 1)

也就是说,实际是判断0x3ff480C0这个寄存器的第19位是否为1,如果为1才能重启主MCU,否则则重启ulp。

在数据手册里查看0x3ff480C0这个寄存器,他是RTC_CNTL_STOREn_REG系统保留的寄存器,也不知道它是干什么的,手册没有说明。


------------------------------------------------------------

jump wake_up

/* Get ULP back to sleep */
.global exit
exit:
/* Stop the wakeup timer so it does not restart ULP */
WRITE_RTC_FIELD(RTC_CNTL_STATE0_REG, RTC_CNTL_ULP_CP_SLP_TIMER_EN, 0)
halt

.global wake_up
wake_up:
/* Check if the SoC can be woken up */
READ_RTC_REG(RTC_CNTL_DIAG0_REG, 19, 1)
and r0, r0, 1
jump exit, eq

/* Wake up the SoC and stop ULP program */
wake
/* Stop the wakeup timer so it does not restart ULP */
WRITE_RTC_FIELD(RTC_CNTL_STATE0_REG, RTC_CNTL_ULP_CP_SLP_TIMER_EN, 0)
halt

ESP_igrr
Posts: 1521
Joined: Tue Dec 01, 2015 8:37 am

Re: 协处理器重启两次才能唤醒主CPU一次??

Postby ESP_igrr » Fri Nov 01, 2019 10:26 am

This register is used to check if the RTC state machine is ready for a wakeup instruction from the ULP. If it is not ready yet, we can stop the ULP program and then try again on the next sleep cycle.

Code: Select all

#define RTC_CNTL_LOW_POWER_ST_REG          (DR_REG_RTCCNTL_BASE + 0xc0)
/* RTC_CNTL_RDY_FOR_WAKEUP : R/0; bitpos:[19]; default: 0 */
/*description: 1 if RTC controller is ready to execute WAKE instruction, 0 otherwise */
#define RTC_CNTL_RDY_FOR_WAKEUP  (BIT(19))
#define RTC_CNTL_RDY_FOR_WAKEUP_M  (BIT(19))
#define RTC_CNTL_RDY_FOR_WAKEUP_V  0x1
#define RTC_CNTL_RDY_FOR_WAKEUP_S  19

/* Compatibility definition */
#define RTC_CNTL_DIAG0_REG RTC_CNTL_LOW_POWER_ST_REG

Who is online

Users browsing this forum: No registered users and 1 guest