I open the port and set the UART
uart_fd = open("/dev/serial0", O_RDWR | O_NOCTTY | O_NDELAY);
if (uart_fd < 0)
{
printf("Failed to open UART\n");
return -1;
}
config.c_cflag = UART_SPEED | CS8 | CLOCAL | CREAD;
config.c_iflag = IGNPAR;
config.c_oflag = 0;
config.c_lflag = 0;
if (tcsetattr(uart_fd, TCSANOW, &config) < 0)
{
printf("Error setting UART configuration\n");
return -1;
}
And I send strings to terminal
void UART_WriteString(const char *str)
{
write (uart_fd, str, strlen(str));
//wait all chars are sent
tcdrain(uart_fd);
}
now I get gibberish on terminal no matter what baud rate I choose. What could be a problem?