Hello,
I have configured UART1 to send and transmit data but it is not working.
I have physically verified that it has no problems but still does not transmit or receive information.
anu suggestion?
void uart1_init(void) //9600 BAUD pclock 48MHZ
{
PCONP |= 0x00000010;
PINSEL0 |= 0x00050000; /* Enable RxD1 and TxD1*/
U1FCR = 0x07;
U1LCR=0X83; //8-data bits, 1 Stop bit, Disable Parity and Enable DLAB
U1DLL=0x38; // MULVAL = 0x5 and DIVADDVAL = 14
U1DLM=1;
U1LCR=0X03; //cleared DLAB
U1IER= 0x00000001;
}
void UART1_Interrupt_EN(void)
{
// VICIntSelect = 0x00000000;
VICVectAddr7 = (unsigned) UART1Handler; //Vector 7
VICVectCntl7 = 0x00000020 | 7; //select UART1 interrupt as IRQ i.e vector 7
VICIntEnable |=(1UL<<7);
}
void SendstreamUART1 (char *str){
while(*str)
{
U1THR = (char )*str++;
while( (U1LSR & 0x40) == 0 ); /* Wait till THRE bit becomes 1 which tells that transmission is completed */
}
}
void SendCharUART1 (char str){
U1THR = str;
while( (U1LSR & 0x40) == 0 ); /* Wait till THRE bit becomes 1 which tells that transmission is completed */
}
Thanks Sabina.
Check again and the error I found outside the microcontroller was an erroneous connection.
Regards,
RT
Hi Raul,
Hope you are doing well. I do have a quick question, if you could please clarify what you mean by checked it physically? Is this regarding the connections ? Have you been able to check the pins with an oscilloscope?
Also for the U1DLL line that you have in your configuration, you have a comment stating MULVAL and DIVADDVAL however thos values are in U1FDR. Could you please clarify what you are modifying here? I see that in your other post UART 0 is also configured this way but it does work, so I just want to understand that bit.
Unfortunately I do not have a board with this MCU so it would help if you can also provide images of what you see on the oscilloscope or any errors that are shown. If you debug are you getting stuck on a certain section?
Best Regards,
Sabina