uint32_t librpipUartRead(uint32_t id, void* buf, uint16_t len, uint32_t timeout);


Reads from a UART into a buffer.


  • uint32_t id
    The UART number to read from. The UART needs to have been detected during the librpipInit().
  • void* buf
    A pointer to an array that will be written to by the UART. Data needs to be 8 bit, e.g. char, unsigned char, uint8_t, int8_t.
  • uint16_t len
    The length of the buffer to read. Note that librpip needs to wait for data to appear due to the UARTS being internally buffered and the clock rates being much slower than the peripheral clock (250mHz). The larger the buffer and the lower the baud rate the longer librpip has to wait. So keep the baud rate high and the buffers small to ensure librpip returns control to your program in a timely manner.
  • uint32_t timeout
    An additional timeout in micro seconds (10 -6s).


0 on failure or 1 on success.


Read 10 bytes from UART0:

uint32_t feature_set;
feature_set = librpipInit(LIBRPIP_BOARD_DETECT, LIBRPIP_FLAG_DEBUG_ON, 0);
if(feature_set & LIBRPIP_FEATURE_UART0) {
        char buf[10];
        librpipUartRead(0, buf, sizeof(buf), 0);