Kendryte K210 use of uart on freertos

First modify the project_cfg.h file to define the hardware-defined i2c pins, where 40 and 41 represent IO40 and IO41, as follows:

const fpioa_cfg_t g_fpioa_cfg =
{
    .version = PIN_CFG_VERSION,
    .functions_count = 2,
    .functions =
    {
        {40, FUNC_UART1_RX},
        {41, FUNC_UART1_TX}
    }
};

Then in the main function is as follows:

//打开uart1
uart1 = io_open("/dev/uart1");

//设置uart1
uart_config(uart1, 9600, 8, UART_STOP_1, UART_PARITY_NONE);

char hel[8] = {0x11,0x22,0x33,0x44,0x55,0x66,0x0d,0x0a};
   
while (1)
{
    //循环发送,每次发送8个字节数据
    io_write(uart1, (uint8_t *)hel, 8);
}

It is worth noting that this is only a routine for sending, but there is a problem with receiving. The receiving is blocked. If there are multiple threads, there will be problems. Although there is a timeout setting, it does not have much effect and is currently in the process of testing. It is found that the received buf is only 64 bytes.

Guess you like

Origin blog.csdn.net/smile_5me/article/details/106790375