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

lpc-2368-uart receiver problem

I have connected lpc 2368 to computer via uart-1
and using bioscom funtion in c++ i have made a programme to send and receive char through uart.my problem is that i can send char from lpc 2368 and able to receive it on pc but when i send it from pc i am unable to receive it on lpc 2368 board.

receiver code::

#include <LPC23xx.H> /* LPC23xx definitions */

#define UART1 /* Use UART 0 for printf */

/* 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 */
#elif defined(UART1) #define UxFDR U1FDR #define UxLCR U1LCR #define UxDLL U1DLL #define UxDLM U1DLM #define UxLSR U1LSR #define UxTHR U1THR #define UxRBR U1RBR
#endif

void init_serial (void) { /* Initialize Serial Interface */ #ifdef UART0 PINSEL0 |= 0x00000050; /* Enable TxD0 and RxD0 */ #elif defined (UART1) PINSEL0 |= 0x40000000; /* Enable TxD1 */ PINSEL1 |= 0x00000001; /* Enable RxD1 */ #endif UxFDR = 0; UxLCR = 0x83; UxDLL = 78; UxDLM = 0; UxLCR = 0x03;
}

int getkey (void) { /* Read character from Serial Port */

while (!(UxLSR & 0x01));//it just wait hear for infinite time???

return (UxRBR);
}

int main()
{

char c; init_serial(); PINSEL10=0;

FIO2DIR0=0xff; FIO2CLR0=0xFF;

c=getkey();

FIO2SET0=0x01;//never reach to this point???
while(1);

}

plz help me....

Parents
  • If you are using Windows Xp or greater you do not have direct access to the comm ports like you used to in DOS. Instead of bioscom you should be able to rewrite your windows code using a function called CreateFile and then use WriteFile to transmit if you go the Win32 library route.

    You can confirm that the fault lies with the PC by doing a loopback test both on the ARM and on the PC. I suspect you'll find the ARM code is fine.

Reply
  • If you are using Windows Xp or greater you do not have direct access to the comm ports like you used to in DOS. Instead of bioscom you should be able to rewrite your windows code using a function called CreateFile and then use WriteFile to transmit if you go the Win32 library route.

    You can confirm that the fault lies with the PC by doing a loopback test both on the ARM and on the PC. I suspect you'll find the ARM code is fine.

Children