This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

os_tmr_create

Hello!!

I hace a problem with os_tmr_create and os_tmr_kill. I need use these functions in the USART interrupt, but when the procesor run this line it goes to Hard Fault.

Can you help me please?

Parents Reply Children
  • "Can I modify the OS function?"

    Depends on if you have bought the source code (not included with the copmiler) and if you have the skills.

    Another choice is to have a timer interrupt that counts down (or compares) integer variables and on zero/match sets an event (isr_evt_set).

  • Hi, I've solved my problem. I can create and kill timers in a interrupt using the functions rt_tmr_create and rt_tmr_kill.

    I hope that ti was correct, do you know if this solution can be wrong?

  • Note that these are internal functions used by os_tmr_create() and os_tmr_kill(). They don't seem to be documented anywhere.

    - what happens if two ISR calls os_tmr_create() and/or os_tmr_kill() concurrently?
    - may an ISR call rt_tmr_kill concurrently with a os_tmr_create()/os_tmr_kill()? What happens?

    Note also that the os_evt_set() makes use of rt_evt_set(), but it isn't obvious if isr_evt_set() uses rt_evt_set().

    The big questions to ask: Does it work, or does it just looks like it's working? And what happens with your code if Keil modifies the internals?

  • I know that this isn't the best solution, but in may application is very difficult any other solution with the RTOS, in this question the other solution is to use directly a timer of the microcontroller and the hardware interrupts.

    In the RTL.h you can see that the call to these function seem the same that de os functions, and there is others isr thar are directly the rt function:

    #define isr_mbx_check(mbx) rt_mbx_check(mbx)

    I've checked that the program works correctly, but I will try to solve this in other way.

  • I've checked that the program works correctly, but I will try to solve this in other way.

    How about:

    - create a high-priority task that starts the timer
    - from the UART isr, activate the task using the available isr_* functions

    This way, the timer will be started right after the UART isr finishes.