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

A problem at Cortex-m0 run RTX

Dear all,

My project use RTX base on Cortex-m0 lpc1114. The task1 configure the P0_2 as output and control the led, it works. The task2 configure the P0_1 as clkout pin, and configure the clkout connect to main clock, but it doesn't works.

But clkout pin is ok, when i remove the RTX.

Please help me, Thank you!
code:
#include <LPC11xx.h>
#include <RTL.h>

OS_TID id1, id2 ;

__task void task1(void) ;
__task void task2(void) ;

__task void task1(void)
{ id1 = os_tsk_self() ; id2 = os_tsk_create(task2, 1) ;

for(;;) { os_evt_set(0x0002, id2) ; os_evt_wait_or(0x0004, 0xffff) ; LPC_GPIO0->DATA = 0x00000000 ; os_dly_wait(100) ;

}
}

__task void task2(void)
{ for(;;) { os_evt_wait_or(0x0002, 0xffff) ; LPC_GPIO0->DATA = 0x0000000f ; os_dly_wait(100) ; os_evt_set(0x0004, id1) ;

}
}

int main(void)
{ LPC_GPIO0->DIR = 0x0000000f ; LPC_GPIO0->DATA = 0x0000000f ; LPC_IOCON->RESET_PIO0_0 = 0x00000001 ; LPC_IOCON->PIO0_1 = 0x00000001 ; LPC_IOCON->PIO0_2 = 0x00000011 ; LPC_SYSCON->CLKOUTCLKSEL = 0x00000003 ; LPC_SYSCON->CLKOUTDIV = 0x00000001 ; LPC_SYSCON->CLKOUTUEN = 0x00000000 ; LPC_SYSCON->CLKOUTUEN = 0x00000001 ; os_sys_init(task1) ;
}

Parents

  • My project run without RTX, the clkout pin can output the "main clock".
    So why the project run with RTX can't output the "main clock".
    Thank you for your help!

    Help

    #include "LPC11xx.h"                  /* LPC11xx Peripheral Registers */
    #include "gpio.h"
    
    void Delay(uint32_t nCount)
    {
      for(; nCount != 0; nCount--);
    }
    
    /*****************************************************************************
    **   Main Function  main()
    ******************************************************************************/
    int main (void)
    {
      SystemInit();
    
      GPIOInit();
    
      GPIOSetDir( PORT0, 0, 1 );      //P0.1 is output(LED2)
    
      GPIOSetDir( PORT0, 2, 1 );      //P1.8 is output(LED1)
      LPC_IOCON->RESET_PIO0_0 = 0x00000001 ;
            LPC_IOCON->PIO0_1 = 0x00000001 ;
            LPC_SYSCON->CLKOUTCLKSEL = 0x00000003 ;
            LPC_SYSCON->CLKOUTDIV = 0x00000001 ;
            LPC_SYSCON->CLKOUTUEN = 0x00000000 ;
            LPC_SYSCON->CLKOUTUEN = 0x00000001 ;
    
      while(1)
      {
              GPIOSetValue( PORT0, 0, 0 );
              GPIOSetValue( PORT0, 2, 1 );
              Delay(1000000);
              GPIOSetValue( PORT0, 0, 1 );
              GPIOSetValue( PORT0, 2, 0 );
              Delay(1000000);
      }
    }
    

Reply

  • My project run without RTX, the clkout pin can output the "main clock".
    So why the project run with RTX can't output the "main clock".
    Thank you for your help!

    Help

    #include "LPC11xx.h"                  /* LPC11xx Peripheral Registers */
    #include "gpio.h"
    
    void Delay(uint32_t nCount)
    {
      for(; nCount != 0; nCount--);
    }
    
    /*****************************************************************************
    **   Main Function  main()
    ******************************************************************************/
    int main (void)
    {
      SystemInit();
    
      GPIOInit();
    
      GPIOSetDir( PORT0, 0, 1 );      //P0.1 is output(LED2)
    
      GPIOSetDir( PORT0, 2, 1 );      //P1.8 is output(LED1)
      LPC_IOCON->RESET_PIO0_0 = 0x00000001 ;
            LPC_IOCON->PIO0_1 = 0x00000001 ;
            LPC_SYSCON->CLKOUTCLKSEL = 0x00000003 ;
            LPC_SYSCON->CLKOUTDIV = 0x00000001 ;
            LPC_SYSCON->CLKOUTUEN = 0x00000000 ;
            LPC_SYSCON->CLKOUTUEN = 0x00000001 ;
    
      while(1)
      {
              GPIOSetValue( PORT0, 0, 0 );
              GPIOSetValue( PORT0, 2, 1 );
              Delay(1000000);
              GPIOSetValue( PORT0, 0, 1 );
              GPIOSetValue( PORT0, 2, 0 );
              Delay(1000000);
      }
    }
    

Children
No data