STM32 CubeMX HAL UART interface API
来源:互联网 发布:淘宝网红店铺有哪些 编辑:程序博客网 时间:2024/06/07 05:30
How to use HAL interface API for STM32 CubeMX generated freeRTOS code?
I am trying to use CubeMx auto-generated FreeRTOS code. Choose the UART you need, set NVIC interruput. CubeMX will handle the source code generation. It's absolutely an efficient way to write code. It's CMSIS based, freeRTOS included, everything I need to develop my application. I'm using STM32F103RCT6.
Once the UART is OK. You can use printf() in stdio.h to output all the log info from UART port, quite easy.
Put below code into your UART source code. Then printf("%s\r\n", "hello") is working now.
The reference link is: http://stm32f4-discovery.com/2014/10/use-printf-output-stream-stm32f4/
FILE __stdout;
int fputc(int ch, FILE *f) { /* Do your stuff here */ /* Send your custom byte */ uint8_t c = (char) ch; HAL_UART_Transmit(&huart1, (uint8_t*)&ch, 1, 10); // this is a blocking uart transmit function /* If everything is OK, you have to return character written */ return ch;}
I remember the old days of write assembly code for uart configuration. Now with ARM cortex-m3, -m4 IC, I can use the standard C library instead. I did a cli (command line interface) with UART, so easy. Remember the old days of DOS, now you can use nowaday 48KB RAM, 256 KB ARM MCU to do it. Multi-thread OS embedded, quite cool!
spike yang
- STM32 CubeMX HAL UART interface API
- STM32使用CubeMx用HAL库开发,怎么与PC进行USB双向的通信?
- STM32-CubeMX学习笔记
- stm32 CubeMx falsh应用
- STM32 CUBEMX的疑似BUG
- STM32的固件库和CubeMX
- STM32 uart
- STM32->UART
- STM32-HAL
- stm32 通过 stm32 cubemx 配置 串口中断
- Visual Studio + CubeMX +GDB 开发STM32
- STM32 CubeMX 中如何查看系统时钟
- verilog uart interface IP
- 一知半解学CubeMX——UART:Printf实现
- CubeMX中的HAL库之IWDG配置篇
- STM32F042 基于CubeMX HAL库CAN的配置
- HAL库-STM32F4 UART-IT
- STM32高级开发(14)-使用CubeMX生成STM32工程
- 触摸事件的机制
- addEventListener:为单个事件注册多个事件事件处理程序
- 猜拳游戏
- [Zabbix3.0 ]添加Nginx监控
- Kafka源码分析之Sender
- STM32 CubeMX HAL UART interface API
- JNI 开发笔记 - 示例代码
- 进程间通信 - 匿名管道实现
- 如何回答「未来5年如何规划?」【面试核心问题8】
- Lua语句
- DBGridEh解决乱码问题
- CI框架导出数据
- Java调用ICTCLAS2016 之中文分词
- 函数指针 指针函数 指针的指针 指向指针数组的指针