Search the Community
Showing results for tags 'uart0'.
-
I am trying to send data from arty z7-7020 board to PC using uart through a function (driver xuartps.h). within the main program, the code works but calling it from function, output at putty gets overlapped. i tried to debug the code but it looks fine and get output as expected. Need help. thanks code: #include "platform.h" #include "xil_printf.h" #include<stdlib.h> #include "xuartps.h" void uart_output(){ char *p; char tip[100]=" hi : uart_text_multiple time \n\r\0"; u32 transmittedBytes; u32 totalTransmittedBytes; u32 status; u16 byteCnt; XUartPs_Config *PiUartConfig; XUartPs PiUart; byteCnt=0; PiUartConfig=XUartPs_LookupConfig(XPAR_PS7_UART_0_DEVICE_ID); status = XUartPs_CfgInitialize(&PiUart,PiUartConfig, PiUartConfig->BaseAddress); if(status!=XST_SUCCESS) print("Uart initialization failed...\n\r"); status = XUartPs_SetBaudRate(&PiUart, 115200); if(status!=XST_SUCCESS) print("BaudRATE init failed....\n\r"); int o; o=0; p =tip; while(*p != '\0'){ byteCnt+=1; p++; } do{ totalTransmittedBytes=0; p =tip; while( totalTransmittedBytes<byteCnt+2){ transmittedBytes = XUartPs_Send(&PiUart, (u8*)&p[totalTransmittedBytes],byteCnt); totalTransmittedBytes += transmittedBytes; } p++; o++; }while(o<10); } int main() { init_platform(); uart_output(); uart_output(); cleanup_platform(); return 0; }