This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Tool/software: Code Composer Studio
Hello Sir, Can you please give some detail about to interface wifi(esp8266) module via UART pin in UCD3138a64 or some program or little detail. Thank you.
You want to use a 16 (decimal)
The equation is (1953125/baud rate) -1
If you use 115200, it will be coming in pretty fast - you won't be able to poll with the normal standard interrupt.
Sir you have posted the UART program in uart community it was running well on UART 0 pin . the problem i was facing on UART1 in initialization
*******************************************************************************************************************************************************
this code below running proper on uart 0 but same applying for UART1 after editing it is not running properly
void init_uart0(void)
{
volatile unsigned char rx_byte;
Uart0Regs.UARTCTRL3.bit.SW_RESET = 0; //software reset while initializing UART
Uart0Regs.UARTCTRL0.bit.DATA_SIZE = 7; //8 bits
Uart0Regs.UARTCTRL0.bit.STOP = 1; //2 stop bits
Uart0Regs.UARTCTRL0.bit.SYNC_MODE = 1; //asynchronous mode
Uart0Regs.UARTHBAUD.bit.BAUD_DIV_H = 0;
Uart0Regs.UARTMBAUD.bit.BAUD_DIV_M = 0;
Uart0Regs.UARTLBAUD.bit.BAUD_DIV_L = 49; //for 38400 //47 for control board, 44 for open loop
Uart0Regs.UARTRXST.bit.RX_ENA = 1 ;//enable RX
Uart0Regs.UARTTXST.bit.TX_ENA = 1;//enable TX
Uart0Regs.UARTINTST.all = 0xff; //these two statements are supposed to clear the status bits
Uart0Regs.UARTINTST.all = 0;
rx_byte = Uart1Regs.UARTRXBUF.bit.RXDAT; //clear RXRDY flag
Uart0Regs.UARTIOCTRLTX.bit.IO_FUNC = 1; //enable transmit pin
Uart0Regs.UARTIOCTRLRX.bit.IO_FUNC = 1; //enable receive pin
Uart0Regs.UARTCTRL3.bit.CLOCK = 1; //internal clock select;
Uart0Regs.UARTCTRL3.bit.SW_RESET = 1; //software reset released UART init done?
Uart0Regs.UARTIOCTRLSCLK.bit.IO_FUNC = 0; //disable external clock for UART.
Uart0Regs.UARTTXBUF.all = ' '; //put out a byte to get things started.
}
void char_out_0(char data)
{
volatile char rx_byte;
while(Uart0Regs.UARTTXST.bit.TX_RDY == 0)
{
if(Uart0Regs.UARTRXST.bit.RX_RDY == 1)
{
rx_byte = Uart0Regs.UARTRXBUF.bit.RXDAT; //clear RXRDY flag
}
pmbus_handler();
}
Uart0Regs.UARTTXBUF.all = data; //put out a byte
}
****************
can you please send for UART1 so that i can send my at command to wifi.
There should be no difference between UART 0 and UART 1. When you say it doesn't work, what do you mean? For example, what happens if you try to continuously output a byte on the transmit pin? Do you see it coming out on the scope? Is the baud rate correct? If you get that working, what happens if you put that byte into the receive side? Does that work?
No, Sir, it is not happening after anything for UART1. But for UART0 working properly. We just have to send the Character serially from Uart.
Just to make sure, I tried out UART1 on the UCD3138128, which is the same as the A64 except for memory size. It worked fine, at least as far as transmitting went. I didn't test the receive side.
Here's the initialization code:
void init_uart1(void)
{
volatile Uint32 rx_byte1; //volatile to make warning go away about set but not read
Uart1Regs.UARTCTRL3.bit.SW_RESET = 0; //software reset while initializing UART
Uart1Regs.UARTCTRL0.bit.DATA_SIZE = 7; //8 bits
Uart1Regs.UARTCTRL0.bit.STOP = 1; //2 stop bits
Uart1Regs.UARTCTRL0.bit.SYNC_MODE = 1; //asynchronous mode
Uart1Regs.UARTHBAUD.all = 0;
Uart1Regs.UARTMBAUD.all = BAUD_RATE_VALUE_M;
Uart1Regs.UARTLBAUD.all = BAUD_RATE_VALUE_L; //for 38400 //47 for control board, 44 for open loop
Uart1Regs.UARTRXST.bit.RX_ENA = 1 ;//enable RX
Uart1Regs.UARTTXST.bit.TX_ENA = 1;//enable TX
Uart1Regs.UARTINTST.all = 0xff; //these two statements are supposed to clear the status bits
Uart1Regs.UARTINTST.all = 0;
rx_byte1 = Uart1Regs.UARTRXBUF.all; //clear RXRDY flag
Uart1Regs.UARTIOCTRLTX.bit.IO_FUNC = 1; //enable transmit pin
Uart1Regs.UARTIOCTRLRX.bit.IO_FUNC = 1; //enable receive pin
Uart1Regs.UARTCTRL3.bit.CLOCK = 1; //internal clock select;
Uart1Regs.UARTCTRL3.bit.SW_RESET = 1; //software reset released UART init done?
Uart1Regs.UARTIOCTRLSCLK.bit.IO_FUNC = 0; //disable external clock for UART.
Uart1Regs.UARTTXBUF.all = '\n'; //put out a byte to get things started.
}
To test it I downloaded the LLC code from .
I shrank the main function down so that all it did was initialize the PMBus and UART1, and just put out a character:
void main()
{
init_uart1();
init_pmbus(88);
for(;;)
{
char_out(0xaa);
}
}
I changed char_out to switch to uart1, and to include a call to pmbus_handler:
void char_out(char data)
{
while(Uart1Regs.UARTTXST.bit.TX_RDY == 0)
{
pmbus_handler();
}
Uart1Regs.UARTTXBUF.all = data; //put out a byte
}
I also had to put a:
#include "pmbus_common.h"
at the end of the includes in uart.c to avoid the warning message.
I'd suggest you try the same thing, and see if it works for you. That way, there's no other code that can mess things up.
I have been trying to think of things that could prevent it from working, and it occurs to me that maybe the bits in the GLBIOEN register are getting set? This takes control of those bits away from the UART, and gives it to the global io logic.
If it was me, I would say I might be looking at the wrong pin entirely, but presumably no one else makes that mistake. Or there might be some hardware on the outside that is messing things up - like you have TX from one device connected to TX on the other device, and RX connected to RX.