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

Why can't I start the timer?

I am trying to create a timer and start it according to the guide.

    	// Create timers
	osTimerId_t UART_timer = osTimerNew(printMessage, osTimerPeriodic, (void *) 5U, NULL);
    if (UART_timer != NULL)
        printf("Periodic UART timer created\n");
    else
        printf("Periodic UART timer could not be created started\n"); 
    
    osStatus_t timerStatus = osTimerStart(UART_timer, 5U);
    
    if(timerStatus == osOK)
        printf("Periodic UART timer has been started\n");
    else
        printf("Periodic UART timer could not be started: Error %d\n", timerStatus);
  

void printMessage(void *arg) {

	int32_t time = (int32_t) arg;
	printf("Timer has executed after %d seconds\n", time);

}

I create the timer after the kernel initialization as described and then start it. I can't figure out why it doesn't work. I did it exactly as described. The return value is osErrorResource, but the timer was created successfuly.

On further inspection this if statement fails. So obviously the ticks are not specified, although I put the arguments in the function. 

    if (osRtxInfo.timer.tick == NULL) {
      EvrRtxTimerError(timer, (int32_t)osErrorResource);
      //lint -e{904} "Return statement before end of function" [MISRA Note 1]
      return osErrorResource;

Could it be related to this?

github.com/.../1b483a0202e24844da8bd6a8dc5b7830908c961a