OK I’m having difficulty with UART0 on my LPC2468. Here’s my trouble. A couple months back I wrote a small program just to see how the UART works. Got it up and running. Now I went to reload it and no dice.
I monkeyed with the board for quite a while. All the sudden it started running again. No idea what I did, it was the same code as before. Took a break. Came back to add more to the code. UART stopped working so I reverted back to my code that I had working before. No dice, stopped working.
I thought maybe I had a hardware issue so I tried 3 separate PC’s, 2 different cables, and two different development boards. Same store on all of them. When I plugged in the other development board the code immediately worked. However, upon reloading new code / power cycling the UART stopped working a refused to go again.
Any ideas?
Here’s my code. I’m using the standard Kiel uVision3 bootup:
#include "lpc246x.h"
int main( void )
{
char TX = 't';
PINSEL0 = 0x00050050; // Hookup UART0 - Page 170
PCONP = 0x00000018; // Power on UART0 - Page 60
PCLKSEL0 = 0x00000000; // Peripheral clock - Page 55
// Setup UART0 - Page 438
U0LCR = 0x00000083; // 8 bits, no parity, 1 stop bit
U0DLL = 0x000000C2; // 9600 bps @ 30MHz VPG Clock
U0LCR = 0x00000003; // DLAB = 0
while( 1 )
{
while( !(U0LSR & 0X20 ) );
U0THR = TX;
}
return 0;
}