Raspberry Pi UART program in C using termios receives garbage (Rx and Tx are connected directly)

后端 未结 1 1635
再見小時候
再見小時候 2020-12-19 22:18

I have a simple program written in C which uses termios to send a basic string to the Raspberry Pi UART and attempts to read and output the response. The Rx and Tx pins on t

相关标签:
1条回答
  • 2020-12-19 22:28
    int wcount = write(fd, &str, strlen(str));
    int rcount = read(fd, &buffer, sizeof(buffer));
    

    In these lines, buffer/str are already pointers. You are passing a pointer to a pointer.

    The lines should be:

    int wcount = write(fd, str, strlen(str));
    int rcount = read(fd, buffer, sizeof(buffer));
    
    0 讨论(0)
提交回复
热议问题