Question about the WR_REG ULP instruction
Posted: Thu Nov 07, 2019 7:59 am
I would like to be able stop the ULP timer from within a ULP program just before I wake the system so as to prevent the ULP from running until I want to again start the ULP and go into deep sleep again.
I asked about this before and you referred me to ulp.c wherein is defined ulp_run(), ulp_load_binary() and ulp_set_wakeup_period(). Almost immediately after waking the system in a test program I have running, I call ulp_run() (as part of the sequence that restarts the ULP), which first disables the ULP sleep timer and then, as it's last call, re-enables the ULP sleep timer. This works great.
But as I said, I'd like to be able to disable the ULP timer after issuing the wake and halt ULP instructions so as to keep the ULP from running while doing a pile of work in system code before starting the ULP again.
I have tried using the "reg_wr 0x006, 24, 24, 0", which, according to all the docs I've read, should reset the RTC_CNTL_ULP_CP_SLE_TIMER_EN bit in the RTC_CNTL_STATE0_REG register. However, when I call that instruction, the ULP never causes the system to wake. It never goes through the system reset cycle as it should after the wake instruction.
Does "reg_wr 0x006, 24, 24, 0" target the that timer enable bit? If so, is there something illegal about killing the ULP timer from within a ULP program? If not, what instruction and parameters would stop the timer? And if it's illegal to stop the timer from within the ULP, what other instruction might I use to prevent the ULP from running after I issue the wake and halt instructions until I want to start the ULP from the system again?
I asked about this before and you referred me to ulp.c wherein is defined ulp_run(), ulp_load_binary() and ulp_set_wakeup_period(). Almost immediately after waking the system in a test program I have running, I call ulp_run() (as part of the sequence that restarts the ULP), which first disables the ULP sleep timer and then, as it's last call, re-enables the ULP sleep timer. This works great.
But as I said, I'd like to be able to disable the ULP timer after issuing the wake and halt ULP instructions so as to keep the ULP from running while doing a pile of work in system code before starting the ULP again.
I have tried using the "reg_wr 0x006, 24, 24, 0", which, according to all the docs I've read, should reset the RTC_CNTL_ULP_CP_SLE_TIMER_EN bit in the RTC_CNTL_STATE0_REG register. However, when I call that instruction, the ULP never causes the system to wake. It never goes through the system reset cycle as it should after the wake instruction.
Does "reg_wr 0x006, 24, 24, 0" target the that timer enable bit? If so, is there something illegal about killing the ULP timer from within a ULP program? If not, what instruction and parameters would stop the timer? And if it's illegal to stop the timer from within the ULP, what other instruction might I use to prevent the ULP from running after I issue the wake and halt instructions until I want to start the ULP from the system again?