Avatar for d3nd3-o0

d3nd3-o0

Member since Jun 2020 • Last active Aug 2020
  • 8 conversations
  • 55 comments

Most recent activity

  • in Bangle.js
    Avatar for d3nd3-o0

    The issue is that you can't reproduce it when you want? Once we can reproduce it, then we can simply test some fixes all at once, and find the one that does the magic.

  • in Bangle.js
    Avatar for d3nd3-o0

    It seems that just invoking the FPU and not clearing the interrupt, the nRF52 chip couldn't sleep.

    This one seems particularly common, have we covered that alreadY? The code above covers it. And we are doing float arithmetic with getBattery .. hmm

  • in Bangle.js
    Avatar for d3nd3-o0

    Btw, is it better to call this :

    targetlibs\nrf5x_12\components\libraries­\pwr_mgmt.c

    void nrf_pwr_mgmt_run(void)
    {
    ##if NRF_PWR_MGMT_CONFIG_FPU_SUPPORT_ENABLED
        /*
         * Clear FPU exceptions.
         * Without this step, the FPU interrupt is marked as pending,
         * preventing system from sleeping.
         */
        uint32_t fpscr = __get_FPSCR();
        __set_FPSCR(fpscr & ~0x9Fu);
        __DMB();
        NVIC_ClearPendingIRQ(FPU_IRQn);
    
        // Assert if a critical FPU exception is signaled.
        ASSERT((fpscr & 0x03) == 0);
    ##endif // NRF_PWR_MGMT_CONFIG_FPU_SUPPORT_ENABLED
    
        SLEEP_LOCK();
    
    ##if NRF_PWR_MGMT_CONFIG_CPU_USAGE_MONITOR_EN­ABLED
        uint32_t sleep_start;
        uint32_t sleep_end;
        uint32_t sleep_duration;
    
        sleep_start = app_timer_cnt_get();
    ##endif // NRF_PWR_MGMT_CONFIG_CPU_USAGE_MONITOR_EN­ABLED
    
        DEBUG_PIN_SET();
    
        // Wait for an event.
    ##ifdef SOFTDEVICE_PRESENT
        ret_code_t ret_code = sd_app_evt_wait();
        if (ret_code == NRF_ERROR_SOFTDEVICE_NOT_ENABLED)
        {
            __WFE();
            __SEV();
            __WFE();
        }
        else
        {
            APP_ERROR_CHECK(ret_code);
        }
    ##else
        __WFE();
        __SEV();
        __WFE();
    ##endif // SOFTDEVICE_PRESENT
    
        DEBUG_PIN_CLEAR();
    
    ##if NRF_PWR_MGMT_CONFIG_CPU_USAGE_MONITOR_EN­ABLED
        sleep_end = app_timer_cnt_get();
        UNUSED_VARIABLE(app_timer_cnt_diff_compu­te(sleep_end,
                                                   sleep_start,
                                                   &sleep_duration));
        m_ticks_sleeping += sleep_duration;
    ##endif // NRF_PWR_MGMT_CONFIG_CPU_USAGE_MONITOR_EN­ABLED
    
        SLEEP_RELEASE();
    }
    

    over just :

    sd_app_evt_wait();
    

    Seems like there are a lot of reasons why a SoC can't sleep.. :P whilst browsing the Nordic Forums..

    Btw, where is most of the power usage values coming from? I see most figures in the low uA range on the forums.. What makes our device use ~0.8mA? I'm surely getting confused by their figures, mb they are referring to only the SoC, whereas we are referring to an entire board?

  • in Bangle.js
    Avatar for d3nd3-o0

    I know that the official Bangle Apps boot code is perfectly fine. But i went OCD on efficiency trying to strip down anything I don't need and disallowing apps to run .boot code eg. It didnt' save much, but do you think there is a pattern here. That by reducing the power consumption down to a threshold then it triggers this 3mA? SOunds like thats what you might be implying.

    COuld it be a 'time' problem?? I also didnt eval a clock file, i just used the bootcde as my clock code directly.. Hm I mean, like a latency thing of doing stuff slower rather than faster.. after calling .sleep mb ?

    To be completely honest, I did notice at one brief moment, the Amperage drop to 1mA on 6.49 at one random point after uploading code to it via RAM function on the IDE. Couldn't make out why my code didn't load, so i assumed it crashed or something. I tried to reproduce it with "reset()" but couldn't.

    I think you are most correct when you talk about it like a 'state' ... I think that once it gets into that state , not much corrects it. Except maybe a full restart via power in, which might be why my BTN1 reset restart tests didn't show reduced power consumption?

    One of the defining features of my setup is that i use 0.1 brightness(the lowest). This might be an important factor too, somehow.

  • in Bangle.js
    Avatar for d3nd3-o0

    @Gordon Thanks for the work and feedback. Not much I can do but sit back at this point, I'm afraid.

  • in Bangle.js
    Avatar for d3nd3-o0

    There are some examples. I recommend that you download/clone the BangleApps repo, https://github.com/espruino/BangleApps. And use a decent IDE/text editor that can search through all the projects in there.
    I searched for keyword "emit" and found an example.

    https://github.com/espruino/BangleApps/b­lob/master/apps/jbells/jbells.js

    From briefly looking at the examples, its enough to call

    var myobj = new Object();
    myobj.on("customevent",callback)
    

    and later

    myobj.emit("customevent");
    

    The "Object" class is a compatible EventEmitter by default.

  • in Bangle.js
    Avatar for d3nd3-o0

    I notice that the analog pin reading code is changed between the 2 versions. Since i'm calling AnalogRead, could that be a prime suspect?
    I mean i tested without using any boot code right. With BTN1, so it can't be that.

    I think i should trust my power readings too, since I had it in series with a multimeter. I'm really lost and confused as to what this all could mean...

    The user on this forum named @allObjects could be useful in this matter. @allObjects since you have a power measurement capability, could you please test the idle current draw between v6/v5 and v6.49?

  • in Bangle.js
    Avatar for d3nd3-o0

    If you can load the code i use, on your 6.49??

    .boot0
    https://pastebin.com/1y9HHHLJ

    .bootcde
    https://pastebin.com/iN4dp74x

    and .bootcde is pulling in:
    require("gbridge.wid.js");
    require("widbt.wid.js");
    from each of these apps.

    My code turns BT on (.wake()) if you hold BTN1 for 5 seconds, but you have to do it atleast 3 seconds after the screen comes on.

    I cannot test with BangleApp because i put my watch back together. So i've lost my ability to test power usage now :)

    Can you give me some insight into where i can find the .bootrst code? within Espruino project.

  • in Bangle.js
    Avatar for d3nd3-o0

    v6 is fine. So the problem lays between v6+ and v6.49

Actions