Giter VIP home page Giter VIP logo

Comments (5)

meishaoming avatar meishaoming commented on July 19, 2024

sorry, this assert fail appeared again after this modification.

i am doing more test and debug on it.

from sub-iot-stack.

meishaoming avatar meishaoming commented on July 19, 2024

add a log, and reproduce the assert fail.

#ifndef NDEBUG
			//check that we didn't try to schedule a timer in the past
			//normally this shouldn't happen but it IS theoretically possible...
            fire_delay = (next_fire_time - timer_get_counter_value() - timer_info->min_delay_ticks) + 1;
			//fire_delay should be in [0,COUNTER_OVERFLOW_INCREASE]. if this is not the case, it is because timer_get_counter() is
			//now larger than next_fire_event, which means we 'missed' the event
            if (((int32_t)fire_delay) <= 0) {
                log_print_stack_string(LOG_STACK_FWK, "fire_delay %u, next_fire_time %u, counter_value %u, min_delay_ticks %u",
                                       fire_delay, next_fire_time, timer_get_counter_value(),timer_info->min_delay_ticks );
            }
			assert(((int32_t)fire_delay) > 0);
#endif

log:

[237097] [PHY] Switching to sleep mode
[237098] [PHY] resuming from sleep mode
[237099] [PHY] sync_word = f498, ch_coding 2
[237100] [PHY] Switching to sleep mode
[237101] [PHY] resuming from sleep mode
[237102] [PHY] sync_word = f498, ch_coding 2
[237103] [PHY] Switching to sleep mode
[237104] [PHY] resuming from sleep mode
[237105] [PHY] sync_word = f498, ch_coding 2
[237106] [PHY] Switching to sleep mode
[237107] [NONE] fire_delay 0, next_fire_time 6575904, counter_value 6575900, min_delay_ticks 5assertion "((int32_t)fire_delay) > 0" failed: file "/Users/sam/dash7-ap-open-source-stack/stack/framework/components/timer/timer.c", line 306, function: configure_next_event

the timer_get_counter_value() is increasing all the time cause its LPTIM hardware time. Every time we call it the result maybe increase.

So this feels that it is not very suitable to call it frequently here. I made a modification call at the top of configure_next_event() store the current_time and use it in the whold function, i am testing this modification for serveral hours to see if there is any other error.

--

update:

i have tested this modification for 15 hours by keeping sending read requset cmd to sensor_pull node and get the response, the gateway and sensor_pull works well without any error.

It seems like it works.

from sub-iot-stack.

glennergeerts avatar glennergeerts commented on July 19, 2024

ok thanks for the detailed information, I see the problem indeed. I did not notice it myself, probably because I'm not using debug builds for longer running tests, so this code is removed by precompiler. The modification you propose looks fine, can you create a PR please?

Related to this: we will probably re-add support for a normal timer next to LPTIMER as well, since for some internal timings the delay of setting the LPTIMER is too big

from sub-iot-stack.

meishaoming avatar meishaoming commented on July 19, 2024

Thanks for your reply. i make a PR for it. Please check if this is as your expectation.

from sub-iot-stack.

glennergeerts avatar glennergeerts commented on July 19, 2024

ok, merged. I will close this for now

from sub-iot-stack.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.