This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

BLE Osal_Timers

Hi

How many timers can be run at a time in a BLE application?

When can osalAddTimer time fail?

Should the program delete a used timer (osalDeleteTimer) after timeout? or the same timer could be reused without init?

Regards

Gautam

  • Hi

    the function "osal_start_timerEx( TaskID, TEST_EVENT, TEST_EVENT_PERIOD );" returns NO_TIMER_AVAIL(0x08).

    what could be the possible cause of this?

    Regards

    Gautam

  • Hi Gautam,

    As you can see from the code in OSAL_Timers.c, this means that there is no heap space available for the timer struct.

    An old timer (same task, same event) will be reused on a call to set up a timer. A timed out timer will have its timer struct freed.

    Perhaps you should check the heap usage. Read 3.1.3 of the Software developers guide v 1.3 for info on this.

    Best regards,
    Aslak 

  • Hi

    Apparently this is what I did after going thro your post Aslak

    1) Checked “INT_HEAP_LEN” from pre-processor defines of my project. It was 3K changed it to 4K, but this doesn’t help. The issue persists.

    2) Then, I set OSALMEM_METRICS = TRUE to look at the variable memMax, in order to know the max memory I typically need. The highest value the memMax achieved was around 400. This confused me even more.

    3) Then to confirm whether this is memory related issue I removed (commented) all other event functions that the application was performing leaving only setting and clearing of the event. With this the event generation is consistent.

    Don’t know where the problem is. Anybody who has gone thro a similar problem may help.

    Regards

    Gautam

  • Hi,

    Can you clarify what you mean in 3? What is consistent?

    Aslak

  • Hi aslak

    lets say for example,

    I create "EVENT1" for "taskID = 0x0c", using "osal_start_timerEx( taskID, EVENT1, PERIOD_EVENT1)" peridically.

    The generation of this event calls "FUNCTION_A" and "FUNCTION_B".

    What i meant in 3 was, i commented "FUNCTION_A" and "FUNCTION_B".

    So this only generates "EVENT1" after every "PERIOD_EVENT1", there are no functinal operations that take place( as they are commented).

    This sets the event( EVENT1) consistently after every PERIOD_EVENT1. Dont know why this doesnt happen when the actual function are called.

    Is this because of the limit in the memory allocated for this task? or what other reasoncan cause this?

    regards

    gautam

  • Hi all  

    I got the issue resolved, it was a silly mistake in my program.

    Sorry for all the trouble.

    Gautam

  • Good. Please post info on the mistake as well, so that others may learn from it.

  • HI aslak

    The mistake was that i had initialised the variable wher i declared it.

    it looked like this

    static uint8 tmp = 0;

    .

    .

    .

    tmp ++;

    tmp++; and so on

    this created memory dumps, n controller ran out of memory.

    BR 

    Gautam