Hi ,
I am trying to run the UART ECO C Program with ADSP21489 EZ KIT in ADSP Ver 5.1.0 But not getting the desired output on the Tera Term Screen ,
SW14 - 1,2 are ON on the Kit , UART Port 2 Pin - DSP Tx , 3 Rx PIN is DSP Rx . Code is same as it of Example
///////////////////////////////////////////////////////////////////////////////////////
//NAME: UART Echo Back
//DATE: 02/06/10
//PURPOSE: UART Example for the ADSP-21489 Ez-Board
//
//USAGE: Connect the UART connector (P1) to your PC and interact with the EZBoard
// when using the following settings.
// Bits per Second -> 19200
// Data Bits -> 8
// Parity -> odd
// Stop Bits -> 2
// Flow Control -> None
////////////////////////////////////////////////////////////////////////////////////////
#include <Cdef21489.h>
#include <signal.h>
// The following definition allows the SRU macro to check for errors. Once the routings have
// been verified, this definition can be removed to save some program memory space.
// The preprocessor will issue a warning stating this when using the SRU macro without this
// definition
#define SRUDEBUG // Check SRU Routings for errors.
#include <SRU.h>
void initDPI(void); //makes UART0 signal connections to DPI pins
void initUART(void); //function for initializing the UART
void UARTisr(); //function for receive interrupt
void xmitUARTmessage(char*, int); // function to transmit the welcome message
extern void initPLL_SDRAM(void); //Configure the PLL for a core-clock of 266MHz and SDCLK of 133MHz
char welcomemessage[] = {"\fHello! \n\r"
"This program echoes back whatever you type in...\n\r"};
int count,test;
main()
{
*pPICR2 &= ~(0x3E0); //Sets the UART0 receive interrupt to P13
*pPICR2 |= (0x13<<5);
initPLL_SDRAM();
*pUART0LCR=0;
*pUART0IER = UARTRBFIE; // enables UART0 receive interrupt
interrupt(SIG_P13,UARTisr);
initDPI();
initUART();
while(1)
{
};
}
void initDPI()
{
SRU2(UART0_TX_O,DPI_PB09_I); // UART transmit signal is connected to DPI pin 9
SRU2(HIGH,DPI_PBEN09_I);
SRU2(DPI_PB10_O,UART0_RX_I); // connect the pin buffer output signal to the UART0 receive
SRU2(LOW,DPI_PB10_I);
SRU2(LOW,DPI_PBEN10_I); // disables DPI pin10 as input
}
void initUART()
{
/* Sets the Baud rate for UART0 */
*pUART0LCR = UARTDLAB; //enables access to Divisor register to set bauda rate
*pUART0DLL = 0x8B; //0x28b = 651 for divisor value and gives a baud rate of 19200 for peripheral clock of 200MHz
*pUART0DLH = 0x02;
/* Configures UART0 LCR */
*pUART0LCR = UARTWLS8| // word length 8
UARTPEN| // parity enable ODD parity
UARTSTB ; // Two stop bits
*pUART0RXCTL = UARTEN; //enables UART0 in receive mode
*pUART0TXCTL = UARTEN; //enables UART0 in core driven mode
xmitUARTmessage(welcomemessage,sizeof(welcomemessage));
}
void UARTisr()
{
int value;
value = *pUART0RBR;
/* echoes back the value on to the hyperterminal screen*/
while ((*pUART0LSR & UARTTHRE) == 0)
{;
}
*pUART0THR = value;
/* poll to ensure UART has completed the transfer */
while ((*pUART0LSR & UARTTEMT) == 0)
{;
}
}
void xmitUARTmessage(char*xmit, int SIZE)
{
int i;
/* loop to transmit source array in core driven mode */
for (i=0; i<SIZE; i++)
{
// Wait for the UART transmitter to be ready
do {
;}
while ((*pUART0LSR & UARTTHRE) == 0);
//Transmit a byte
*pUART0THR = xmit[i];
}
/* poll to ensure UART has completed the transfer */
while ((*pUART0LSR & UARTTEMT) == 0)
{;
}
}
I am attaching the output screen Hi,
These example codes have been tested on our end and are working as expected.
Please ensure that JP4 is OFF and JP3 is ON. Also, connect the PC serial port to the UART connector on the EZ-Board using a non-crossover serial cable.
Regards,
Nandini.C
Hi,
These example codes have been tested on our end and are working as expected.
Please ensure that JP4 is OFF and JP3 is ON. Also, connect the PC serial port to the UART connector on the EZ-Board using a non-crossover serial cable.
Regards,
Nandini.C