OS_ERR_ILLEGAL_IN_TIMER (161) without Software Timers

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • OS_ERR_ILLEGAL_IN_TIMER (161) without Software Timers

    i get a error 161, but i don't use any software Timers.
    and the only OS-functions which i call in the ISRs are "OS_SignalEvent() ; OS_EnterInterrupt() and OS_LeaveInterrupt().
    i use a MSP430F2618 and the 3 tasks are for communicating with another uC over spi.

    the Error occurs while calling OS_free after a few times (not in the ISR)
    i always use OS_malloc before OS_free.

    The Error is: OS_ERR_ILLEGAL_IN_TIMER -> " Illegal function call in an interrupt service routine:A routine that may not be called from within a software timer has been called from within a timer."

    what could be the Problem?
    Thank you for any help.

    gringo
  • Gringo, could you please give some more basic information?

    How to report embOS related issues:

    1. Which embOS do you use?
    This should include CPU, compiler and version.
    For example: embOS for ARM version 3.60d with IAR workbench 5.11 (embOS_ARM_IARV5 V360d).
    2. Which CPU and eval board do you use?
    For example: AVR32AP (AP7000) CPU with Atmel NGW100 eval board.
    3. Which start project do you use?
    Did you download e.g. a trial package from the Segger website?

    Thanks.

    Could you please also check which function calls OS_Error()? You can get this information from your call stack window or
    you can set OS_Status again to 0 and leave the while() loop and OS_Error() function. You will return to that function which calls OS_Error() before.
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.
  • Hello,
    i found the Error now, it was a wrong definition of my used Mailbox Size.
    My code was:

    C Source Code

    1. void main( void )
    2. {
    3. OS_IncDI();
    4. OS_InitKern();
    5. OS_InitHW();
    6. HAL_BOARD_INIT();
    7. HalDriverInit ();
    8. // Init functions for Tasks
    9. OS_CREATETASK(&TCB_LABELING, "Labeling Task", Labeling_Task, 70, StackLabeling);
    10. OS_CREATETASK(&TCB_SPI, "SPIProcess Task", SPIProcess_Task, 30, StackSPI);
    11. OS_CREATETASK(&TCB_POLLRXBUFF, "PollRXBuff Task", PollRXBuff_Task, 80, StackPollRXBuff);
    12. //Init function for MailBoxes
    13. OS_CREATEMB(&MBSlaveSend, sizeof(_os_messageEvent) , sizeof(MBSlaveSendBuffer), &MBSlaveSendBuffer);
    14. // create Semaphores
    15. OS_CreateRSema(&SemaStatusLED);
    16. OS_DecRI();
    17. OS_Start();
    18. }
    Display All


    The Error was that my message has 3 Bytes(_os_messageEvent) -> ( 1Byte datalength and one Pointer(2byte) to the data)

    the correct Mailbox definition is:

    C Source Code

    1. OS_CREATEMB(&MBSlaveSend, sizeof(_os_messageEvent) , sizeof(MBSlaveSendBuffer)/sizeof(_os_messageEvent), &MBSlaveSendBuffer);


    i think the memory was overwritten by the Mailbox, or in the other direction the code has corrupted the mailbox.
    The Error: OS_ERR_ILLEGAL_IN_TIMER has nothing to do with Timer or ISR in my case. (maybe internal Timer or ISR of the Mailbox or Some semaphore)

    But thank you anyway...

    - i use the version 3.62c at the moment as a trial ( licence is in progress in the company)
    - with IAR for MSP430 v 4.21 on a MSP430F2618
    - i made my own hardware Board with the MSP430 (and a CC2430, connected to the MSP over SPI nothing else)

    cheers from Switzerland