Hi Kumar
I haven't heard of any problem with UART2. The driver code is the same for all UARTs apart from the register accesses.
Here are some ideas and how to debug.
1. If you use the uTasker simulator your can simulate the UARTs and do the same test on your PC - conect the COM port of the PC to the terminal(emulator). You can map the COM port to the UART in app_hw_m5223x.h
#define SERIAL_PORT_2 '1' will map UART2 to COM1
If the result is identical it is a code problem but if it isn't it may be a low level driver problem. In the simulator code problems can be easily tracked down and corrections simply tested.
2. Try in Interrupt and DMA modes (DMA support can be removed globally by removing #define SERIAL_SUPPORT_DMA or on a per channel basis by removing the DMA flag when opening the interface.
tInterfaceParameters.ucDMAConfig = 0; // remove UART_TX_DMA; 3. Which write method do you use?
fnWrite(serial_handle, buffer, length); or
fnDebugMsg("Hello World\r\n" );The result in both cases is that a certain length of data is copied into the output buffer. What you are seeing with "xxxxxxHello World" is that the start pointer is before the start of the string and also the length corresponds to the start of the pointer up to the end of the string which you want to send. This means that it is not that a counter of a pointer are off but these at least match up to the end of the string.
Can you show your write code?
4. With the simulator or BDM you can quite easily follow the write to where the characters are placed into the output buffer. After the copy you can expand the structure to see its state. I have attached a screen shot in the uTasker simulator showing this after writing the message to UART 2.
- fnWrite() calls entry_tty(), which takes the switch CALL_WRITE
- pointer ptTTYQue is set to the output TTYQUE structure.
- fnFillBuf() will be called to place the data into the output circular buffer
- Once this has been performed, compare your structure with mine.
A. check that your input buffer (ptBuffer) is really pointing to the string expected and the length of copied data (Counter) is identical to the length of the string.
B. check that the structure is correct. In my screen shot you can see that the string is 0x0a characters in length (variable chars) and that the string has been set to the beginning of the buffer (circular buffer 0x100 in length with get pointer pointing to it).
Regards
Mark