使用uart5作为控制台时(MCU时STM32H7B0VBT6),发现串口未打印,最后在代码在drv_usart.c中(注释部分)发现一处bug,修改后就可以了,但不知道这算不算bug
static const struct gpio_uart_af uart_afs[] =
{
{ .pin_index = GET_PIN(A, 0), .afs[0] = {.uart_num = UART_IS_TX|4, .af_num = 8}},
{ .pin_index = GET_PIN(A, 1), .afs[0] = {.uart_num = UART_IS_RX|4, .af_num = 8}},
{ .pin_index = GET_PIN(A, 2), .afs[0] = {.uart_num = UART_IS_TX|2, .af_num = 7}},
{ .pin_index = GET_PIN(A, 3), .afs[0] = {.uart_num = UART_IS_RX|2, .af_num = 7}},
{ .pin_index = GET_PIN(A, 9), .afs[0] = {.uart_num = UART_IS_TX|1, .af_num = 7}},
{ .pin_index = GET_PIN(A, 10), .afs[0] = {.uart_num = UART_IS_RX|1, .af_num = 7}},
{ .pin_index = GET_PIN(A, 11), .afs[0] = {.uart_num = UART_IS_TX|4, .af_num = 6}},
{ .pin_index = GET_PIN(A, 12), .afs[0] = {.uart_num = UART_IS_RX|4, .af_num = 6}},
{ .pin_index = GET_PIN(A, 15), .afs[0] = {.uart_num = UART_IS_RX|7, .af_num = 11}},
{ .pin_index = GET_PIN(A, 8), .afs[0] = {.uart_num = UART_IS_RX|7, .af_num = 11}},
{ .pin_index = GET_PIN(B, 4), .afs[0] = {.uart_num = UART_IS_TX|7, .af_num = 11}},
{ .pin_index = GET_PIN(B, 3), .afs[0] = {.uart_num = UART_IS_RX|7, .af_num = 11}},
{ .pin_index = GET_PIN(B, 5), .afs[0] = {.uart_num = UART_IS_TX|5, .af_num = 14}},
{ .pin_index = GET_PIN(B, 6), .afs[0] = {.uart_num = UART_IS_RX|5, .af_num = 14}},
{ .pin_index = GET_PIN(B, 6), .afs[0] = {.uart_num = UART_IS_TX|1, .af_num = 7}},
{ .pin_index = GET_PIN(B, 7), .afs[0] = {.uart_num = UART_IS_RX|1, .af_num = 7}},
{ .pin_index = GET_PIN(B, 9), .afs[0] = {.uart_num = UART_IS_TX|4, .af_num = 8}},
{ .pin_index = GET_PIN(B, 8), .afs[0] = {.uart_num = UART_IS_RX|4, .af_num = 8}},
{ .pin_index = GET_PIN(B, 10), .afs[0] = {.uart_num = UART_IS_TX|3, .af_num = 7}},
{ .pin_index = GET_PIN(B, 11), .afs[0] = {.uart_num = UART_IS_RX|3, .af_num = 7}},
{ .pin_index = GET_PIN(B, 13), .afs[0] = {.uart_num = UART_IS_TX|5, .af_num = 14}},
{ .pin_index = GET_PIN(B, 12), .afs[0] = {.uart_num = UART_IS_RX|5, .af_num = 14}},
{ .pin_index = GET_PIN(B, 14), .afs[0] = {.uart_num = UART_IS_TX|1, .af_num = 4}},
{ .pin_index = GET_PIN(B, 15), .afs[0] = {.uart_num = UART_IS_RX|1, .af_num = 4}},
{ .pin_index = GET_PIN(C, 6), .afs[0] = {.uart_num = UART_IS_TX|6, .af_num = 7}},
{ .pin_index = GET_PIN(C, 7), .afs[0] = {.uart_num = UART_IS_RX|6, .af_num = 7}},
{ .pin_index = GET_PIN(C, 10), .afs[0] = {.uart_num = UART_IS_TX|3, .af_num = 7}},
{ .pin_index = GET_PIN(C, 11), .afs[0] = {.uart_num = UART_IS_RX|3, .af_num = 7}},
{ .pin_index = GET_PIN(C, 10), .afs[0] = {.uart_num = UART_IS_TX|4, .af_num = 8}},
{ .pin_index = GET_PIN(C, 11), .afs[0] = {.uart_num = UART_IS_RX|4, .af_num = 8}},
{ .pin_index = GET_PIN(C, 12), .afs[0] = { .uart_num = UART_IS_TX|5, .af_num = 8}}, // 此处官方库中C12默认的是RX,应修改为TX
{ .pin_index = GET_PIN(D, 2), .afs[0] = { .uart_num =
UART_IS_RX|5, .af_num = 8 }}, // 此处官方库中D2默认的是TX,应修改为RX
{ .pin_index = GET_PIN(D, 1), .afs[0] = {.uart_num = UART_IS_TX|4, .af_num = 8}},
{ .pin_index = GET_PIN(D, 0), .afs[0] = {.uart_num = UART_IS_RX|4, .af_num = 8}},
{ .pin_index = GET_PIN(D, 5), .afs[0] = {.uart_num = UART_IS_TX|2, .af_num = 7}},
{ .pin_index = GET_PIN(D, 6), .afs[0] = {.uart_num = UART_IS_RX|2, .af_num = 7}},
{ .pin_index = GET_PIN(D, 8), .afs[0] = {.uart_num = UART_IS_TX|3, .af_num = 7}},
{ .pin_index = GET_PIN(D, 9), .afs[0] = {.uart_num = UART_IS_RX|3, .af_num = 7}},
{ .pin_index = GET_PIN(E, 1), .afs[0] = {.uart_num = UART_IS_TX|8, .af_num = 8}},
{ .pin_index = GET_PIN(E, 0), .afs[0] = {.uart_num = UART_IS_RX|8, .af_num = 8}},
{ .pin_index = GET_PIN(E, 8), .afs[0] = {.uart_num = UART_IS_TX|7, .af_num = 7}},
{ .pin_index = GET_PIN(E, 7), .afs[0] = {.uart_num = UART_IS_RX|7, .af_num = 7}},
{ .pin_index = GET_PIN(F, 7), .afs[0] = {.uart_num = UART_IS_TX|7, .af_num = 7}},
{ .pin_index = GET_PIN(F, 6), .afs[0] = {.uart_num = UART_IS_RX|7, .af_num = 7}},
{ .pin_index = GET_PIN(G, 14), .afs[0] = {.uart_num = UART_IS_TX|6, .af_num = 7}},
{ .pin_index = GET_PIN(G, 9), .afs[0] = {.uart_num = UART_IS_RX|6, .af_num = 7}},
{ .pin_index = GET_PIN(H, 13), .afs[0] = {.uart_num = UART_IS_TX|4, .af_num = 8}},
{ .pin_index = GET_PIN(H, 14), .afs[0] = {.uart_num = UART_IS_RX|4, .af_num = 8}},
{ .pin_index = GET_PIN(G, 8), .afs[0] = {.uart_num = UART_IS_TX|8, .af_num = 8}},
{ .pin_index = GET_PIN(G, 9), .afs[0] = {.uart_num = UART_IS_RX|8, .af_num = 8}},
};