We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hi all, I am using MCB2300 Evaluation Board (LPC2368 based) for tesing UARTs now. I tried to run blinky demo code, UART0 and UART1 work fine, but I modified the code to use UART2 or UART3, it does not work.Follwong is what I modified in blinky demo code, config pin0.10 and pin0.11 as UART2 Tx and RX. No signal on pin 0.10. I only modified "Serial.c" source code,Please help me to find out the problems. By the way, I use uVersion3 with Evaluation version of compiler.
Thanks
Jack
/******************************************************************************/ /* SERIAL.C: Low Level Serial Routines */ /******************************************************************************/ /* This file is part of the uVision/ARM development tools. */ /* Copyright (c) 2005-2006 Keil Software. All rights reserved. */ /* This software may only be used under the terms of a valid, current, */ /* end user licence from KEIL for a compatible version of KEIL software */ /* development tools. Nothing else gives you the right to use this software. */ /******************************************************************************/ #include <LPC23xx.H> /* LPC23xx definitions */ #define UART2 /* Use UART 2 for printf /*modified here*/ /*use UART2*/ /* If UART 0 is used for printf */ #ifdef UART0 #define UxFDR U0FDR #define UxLCR U0LCR #define UxDLL U0DLL #define UxDLM U0DLM #define UxLSR U0LSR #define UxTHR U0THR #define UxRBR U0RBR /* If UART 1 is used for printf */ /* modified here to use UART2*/ #elif defined(UART2) #define UxFDR U2FDR #define UxLCR U2LCR #define UxDLL U2DLL #define UxDLM U2DLM #define UxLSR U2LSR #define UxTHR U2THR #define UxRBR U2RBR #endif void init_serial (void) { /* Initialize Serial Interface */ #ifdef UART0 PINSEL0 |= 0x00000050; /* Enable TxD0 and RxD0*/ //modified here to use UART2 #elif defined (UART2) /*PINSEL0 |= 0x40000000; /* Enable TxD1 */ /* PINSEL1 |= 0x00000001; /* Enable RxD1 */ /*modified here: */ PINSEL0 |= 0x00500000; /* Enable TxD2,RXD2*/ #endif UxFDR = 0; /* Fractional divider not used */ UxLCR = 0x83; /* 8 bits, no Parity, 1 Stop bit */ UxDLL = 94; /* 9600 Baud Rate @ 14.4 MHZ PCLK */ UxDLM = 0; /* High divisor latch = 0 */ UxLCR = 0x03; /* DLAB = 0 */ } /* Implementation of putchar (also used by printf function to output data) */ int sendchar (int ch) { /* Write character to Serial Port */ while (!(UxLSR & 0x20)); return (UxTHR = ch); } int getkey (void) { /* Read character from Serial Port */ while (!(UxLSR & 0x01)); return (UxRBR); }
You did not turn on the clock for UART2 and UART3 (register PCONP). The clock for UART2 and UART3 is off by default.
Hi Franc, Thanks a lot, I will try it.
Hi Farnc, It works!
Thanks again
I have the same evaluation board and processor but the blinky example does not work for COM0. By default it is configured to compile for UART1 and that works fine. When I configured the code for UART0, COM0 does not output anything.
Do you have any ideas or suggestions ?
After uploading the code through COM0 with Flash Magic 3.51, JP9 (reset) must be removed on the MCB2300. Then the com port on the PC can be used to monitor COM0 from the MCB2300.
Apparantly the program TTY.exe (3.0) that I am using to monitor COM0 uses RTS and DTR (respectively pin 7 and 4 on the DB9) which affects the reset circuitry. Eventhough TTY is configured to not use any control/signal lines.