Loops don't work.

Loops don't work.

Home Forums Real-Time Kernels Loops don't work.

This topic contains 2 replies, has 2 voices, and was last updated by  GeunHa You 5 months, 2 weeks ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #25705

    GeunHa You
    Participant

    Hi, I’m using TMS320F28335 and CCSv6, uC/OS-II

    I counted a problem
    I added just 3 lines at Micrium uC/OS-II. One of them is “#include <stdio.h>” to use “printf”.
    And remains are printf functions at App_TaskPing and App_TaskPong each. Like below code..

    But, after building and debugging, just 1 1 2 were printed. No loop anymore.
    Why loops don’t work?
    All code is attached.

    /*
    *********************************************************************************************************
    *                                           APPLICATION CODE
    *
    *                                             Delfino 28335
    *                                                on the
    *                                             TMDSDOCK28335
    *                                            Experimenter Kit
    *
    * Filename      : app.c
    * Version       : V1.00
    *********************************************************************************************************
    */
    
    /*
    *********************************************************************************************************
    *                                             INCLUDE FILES
    *********************************************************************************************************
    */
    
    #include  <app_cfg.h>
    
    #include  <ucos_ii.h>
    #include  <cpu_core.h>
    #include  <lib_def.h>
    
    #include  <bsp.h>
    
    #include <stdio.h>
    
                                                                    /* Start Task's stack.                                  */
    CPU_STK_SIZE  App_TaskStartStk[APP_CFG_TASK_STK_SIZE];
                                                                    /* Ping Task's stack.                                   */
    CPU_STK_SIZE  App_TaskPendStk[APP_CFG_TASK_STK_SIZE];
                                                                    /* Pong Task's stack.                                   */
    CPU_STK_SIZE  App_TaskPostStk[APP_CFG_TASK_STK_SIZE];
    
    static  OS_EVENT    *AppTaskObjSem;
    
                                                                    /* Start Task.*/
    static  void  App_TaskStart(void  *p_arg);
                                                                    /* Ping Task. */
    static  void  App_TaskPing (void  *p_arg);
                                                                    /* Pong Task. */
    static  void  App_TaskPong (void  *p_arg);
    
    int  main (void)
    {
        CPU_Init();
        BSP_Init();
        OSInit();
    
        OSTaskCreateExt(App_TaskStart,
                        (void    *)0,
                        (CPU_STK *)&App_TaskStartStk[0],
                        (INT8U    )APP_CFG_TASK_START_PRIO,
                        (INT16U   )APP_CFG_TASK_START_PRIO,
                        (CPU_STK *)&App_TaskStartStk[APP_CFG_TASK_STK_SIZE - 1u],
                        (INT32U   )APP_CFG_TASK_STK_SIZE,
                        (void    *)0,
                        (INT16U   )(OS_TASK_OPT_STK_CHK | OS_TASK_OPT_STK_CLR));
    
        OSStart();
    
    	while (DEF_TRUE) {
    		;
    	}
    }
    
    static  void  App_TaskStart (void *p_arg)
    {
        CPU_INT08U  os_err;
       (void)&p_arg;
    
        BSP_LED_Off(BSP_LED_ALL);
        BSP_Tick_Init();
    
        AppTaskObjSem = OSSemCreate(0);
    
        OSTaskCreateExt(App_TaskPing,
                        (void    *)0,
                        (CPU_STK *)&App_TaskPendStk[0],
                        (INT8U    )APP_CFG_TASK_PEND_PRIO,
                        (INT16U   )APP_CFG_TASK_PEND_PRIO,
                        (CPU_STK *)&App_TaskPendStk[APP_CFG_TASK_STK_SIZE - 1u],
                        (INT32U   )APP_CFG_TASK_STK_SIZE,
                        (void    *)0,
                        (INT16U   )(OS_TASK_OPT_STK_CHK | OS_TASK_OPT_STK_CLR));
    
        OSTaskCreateExt(App_TaskPong,
                        (void    *)0,
                        (CPU_STK *)&App_TaskPostStk[0],
                        (INT8U    )APP_CFG_TASK_POST_PRIO,
                        (INT16U   )APP_CFG_TASK_POST_PRIO,
                        (CPU_STK *)&App_TaskPostStk[APP_CFG_TASK_STK_SIZE - 1u],
                        (INT32U   )APP_CFG_TASK_STK_SIZE,
                        (void    *)0,
                        (INT16U   )(OS_TASK_OPT_STK_CHK | OS_TASK_OPT_STK_CLR));
                                                                    /* All tasks should be written as an infinite loop.     */
        while (DEF_TRUE) {
            os_err = OSSemPost(AppTaskObjSem);
            OSTimeDlyHMSM(0, 0, 0, 1);
        }
    }
    
    static  void  App_TaskPing (void *p_arg)
    {
        CPU_INT08U  os_err;
       (void)&p_arg;
    
        while (DEF_TRUE) {
        	printf("1\n");
    
            OSSemPend( AppTaskObjSem,
                       0,
                      &os_err);
        }
    }
    
    static  void  App_TaskPong (void *p_arg)
    {
       (void)&p_arg;
    
        while (DEF_TRUE) {
        	printf("2\n");
    
            OSTimeDlyHMSM(0, 0, 0, 300);
            BSP_LED_Toggle(BSP_LED_LD3);
        }
    }
    
    
    • This topic was modified 10 months, 1 week ago by  GeunHa You.
    • This topic was modified 10 months, 1 week ago by  GeunHa You.
    #25708

    Janos Magasrevy
    Keymaster

    Hi,

    Try this version of the port to see if it fixes it.

    https://www.dropbox.com/s/hn4jle0648nqabc/Micrium_C28x_OS2_Port.zip?dl=0

    #26759

    GeunHa You
    Participant

    Thank you, sir!

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.

View the complete site map

x
Loading...