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

UART Problem

I have written a code which intializes 2 UARTs, i.e., UART-1 and UART-2.
The code works pretty fine. I am using the same code on two different controllers.

Simply say i have a board with two controllers and are connected by UART-2. (LPC2368)
Now i using same program in the two controllers.

I have used a LED in both the controllers to make them glow just before the program enters the while loop.

Now my problem when i power up the board the LED is not being glowing. So i have to assume that my code did not reach the while loop.

I have observed that if i comment UART2 intialization (which is used for inter communication between the two controllers) then the LED glows and the code is working fine.

So again i removed the comments at UART-2 intialization and started debugging one of the controller. Again it works fine.

Now what i did is i have made one controller in reset at power ON and let the other controller intilaize. and after some time say 5 secs i have released the 1st controller from reset and let it intialize. Now also it is working.

Now my conclusion if i run the board with the same code in both the controllers it is not working. I mean both the controllers are trying to intialize the UART-2 at the same time.

So how can i handle this? What could be the reason for this problem? I am unable to debug since only after power up i can debug which leads to the two controllers intializing at different time intervals.

Can some one please help me with this.

Parents
  • Maybe your initialization code is broken, so it doesn't correctly handle an UART that already has pending data before you have fully initialized the receiving side.

    Are you properly installing the ISR before you configure/enable interrupt handling so you don't get an interrupt out into the blue because the other side has already sent the first character?

Reply
  • Maybe your initialization code is broken, so it doesn't correctly handle an UART that already has pending data before you have fully initialized the receiving side.

    Are you properly installing the ISR before you configure/enable interrupt handling so you don't get an interrupt out into the blue because the other side has already sent the first character?

Children