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 transmitting wrong char

Hello, I am trying to set UART connection for the first time. I have a LPC2138 protoboard and I want to use its UART to transmit char A to bluetooth module RN41 via its UART. I managed to send something through but the char recieved on bt module is not the one send from LPC2138. For example if i try to transmit A i get AC on the other end.

Can anyone help me with this problem?

this is my code:

#include <stdio.h>

#define PINSEL0 (*((volatile unsigned long *) 0xE002C000))
#define PINSEL1 (*((volatile unsigned long *) 0xE002C004))
#define PINSEL2 (*((volatile unsigned long *) 0xE002C014))

//UART0
#define U0RBR (*((volatile unsigned char *) 0xE000C000))
#define U0THR (*((volatile unsigned char *) 0xE000C000))
#define U0IER (*((volatile unsigned char *) 0xE000C004))
#define U0IIR (*((volatile unsigned char *) 0xE000C008))
#define U0FCR (*((volatile unsigned char *) 0xE000C008))
#define U0LCR (*((volatile unsigned char *) 0xE000C00C))
#define U0LSR (*((volatile unsigned char *) 0xE000C014))
#define U0SCR (*((volatile unsigned char *) 0xE000C01C))
#define U0DLL (*((volatile unsigned char *) 0xE000C000))
#define U0DLM (*((volatile unsigned char *) 0xE000C004))
#define U0TER (*((volatile unsigned char *) 0xE000C030))

int main(void)
{

PINSEL0 = 0x5;

U0LCR = 0x83;
U0DLL = 78;
U0DLM = 0x00;
U0LCR = 0x03;

U1LCR = 0x83;
U1DLL = 78;
U1DLM = 0x00;
U1LCR = 0x03;

while(1)
{

while (!(U0LSR & 0x20)); //transmit condition
U0THR = 0x2D;

}
}

0