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

I2C with Keil RTX doesn't work

Hi

When I use I2C library without Keil RTX to communicate with I2C EEPROM the program works fine, but when I start the RTX the program stuck at:

while(!Status) Status=I2C_CheckEvent(I2C1, I2C_EVENT_MASTER_TRANSMITTER_MODE_SELECTED); // Test on EV6 and clear it

Somebody know how to fix this?

Ps: uVision3 V3.63 , MDK-ARM V3.24 , RL-ARM V3.40

Parents
  • Hi cleber melo,

    The problem I think you was facing was that you did not kill the current running thread inside the init() function.

    If you do not kill the current running thread, it will return to the startup code thus terminates the whole program.

    Here is what you should do:

    void init(void) {
      // Initialize code is here
      // ...
    
      // Kill the current running thread
      os_tsk_delete_self();
    }
    
    void main(void) {
      os_sys_init(init);
    }
    

Reply
  • Hi cleber melo,

    The problem I think you was facing was that you did not kill the current running thread inside the init() function.

    If you do not kill the current running thread, it will return to the startup code thus terminates the whole program.

    Here is what you should do:

    void init(void) {
      // Initialize code is here
      // ...
    
      // Kill the current running thread
      os_tsk_delete_self();
    }
    
    void main(void) {
      os_sys_init(init);
    }
    

Children