一般 rt-thread 发布的 bsp 库默认的 rt_kprintf 函数的输出设备是串口1,想要更改输出设备为串口1,以 stm32 为例步骤如下:

  首先,打开 UART2 设备

  其次,在 menuconfig 中 RT-Thread Kernel --- Kernel Device Object --- Using console for rt_kprintf 修改 the device name for console 的值为 uart2

  最后,在文件 <stm32f1xx_hal_msp.c> 中加入串口2相关的时钟、引脚配置信息即可

相关文章:

  • 2021-07-10
  • 2021-06-05
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-05
猜你喜欢
  • 2022-12-23
  • 2022-02-19
  • 2021-07-27
  • 2021-07-10
  • 2022-01-25
  • 2022-12-23
  • 2021-07-26
相关资源
相似解决方案