STM32CubeMX+micro_ros_stm32cubemx_utils库

GitHub - micro-ROS/micro_ros_stm32cubemx_utils at humble

Using this package with STM32CubeMX

  1. Clone this repository in your STM32CubeMX project folder. A sample project can be generated with the provided sample_project.ioc.

  2. Make sure that your STM32CubeMX project is using a Makefile toolchain under Project Manager -> Project

  3. Make sure that if you are using FreeRTOS, the micro-ROS task has more than 10 kB of stack

  4. Configure the transport interface on the STM32CubeMX project, check the Transport configuration section for instructions on the custom transports provided.在STM32CubeMX内设置串口

  5. Modify the generated Makefile to include the following code before the build the application section:修改makefile文件,在build the application之前添加后面这个代码

    #######################################
    # micro-ROS addons
    #######################################
    LDFLAGS += micro_ros_stm32cubemx_utils/microros_static_library/libmicroros/libmicroros.a
    C_INCLUDES += -Imicro_ros_stm32cubemx_utils/microros_static_library/libmicroros/microros_include
    
    # Add micro-ROS utils
    C_SOURCES += micro_ros_stm32cubemx_utils/extra_sources/custom_memory_manager.c
    C_SOURCES += micro_ros_stm32cubemx_utils/extra_sources/microros_allocators.c
    C_SOURCES += micro_ros_stm32cubemx_utils/extra_sources/microros_time.c
    
    # Set here the custom transport implementation
    C_SOURCES += micro_ros_stm32cubemx_utils/extra_sources/microros_transports/dma_transport.c
    #注意看这里添加的是DMA传输方式文件,所以前面应该配置的是DMA传输方式,如果使用的是中断方式就不知道添加哪个文件了也许大概是包含IT_transport.c这样的一个文件吧
    
    print_cflags:
       @echo $(CFLAGS)
  6. Execute the static library generation tool. 编译Compiler flags will retrieved automatically from your Makefile and user will be prompted to check if they are correct.

    docker pull microros/micro_ros_static_library_builder:humble(这里遇到permission denied,所以需要先切换到超级用户在控制台输入su,然后再执行这个命令就可以了)
    
    docker run -it --rm -v $(pwd):/project --env MICROROS_LIBRARY_FOLDER=micro_ros_stm32cubemx_utils/microros_static_library microros/micro_ros_static_library_builder:humble
  7. Modify your main.c to use micro-ROS.(在开发文件cpp文件中根据需要使用micro-ros内容) An example application can be found in sample_main.c.

  8. Continue your usual workflow building your project and flashing the binary:

    make -j$(nproc)

Transport configuration(STM32与micro_ros支持的通讯方式)

Available transport for this platform are:

U(S)ART with DMA(DMA方式的串口通讯)

Steps to configure:

  • Enable U(S)ART in your STM32CubeMX
  • For the selected USART, enable DMA for Tx and Rx under DMA Settings
  • Set the DMA priotity to Very High for Tx and Rx
  • Set the DMA mode to Circular for Rx: Detail
  • For the selected, enable global interrupt under NVIC SettingsDetail

U(S)ART with Interrupts(中断方式串口通讯)

Steps to configure:

  • Enable U(S)ART in your STM32CubeMX
  • For the selected USART, enable global interrupt under NVIC SettingsDetail

USB CDC

Steps to configure:

  • Enable the USB in your STM32CubeMX Connectivity tab.

  • Select the Communication Device Class (Virtual Port Com) mode on the Middleware -> USB_DEVICE configuration.

    Note: The micro-ROS transport will override the autogenerated USB_DEVICE/App/usbd_cdc_if.c methods.

相关推荐

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2023-12-07 12:32:08       94 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2023-12-07 12:32:08       101 阅读
  3. 在Django里面运行非项目文件

    2023-12-07 12:32:08       82 阅读
  4. Python语言-面向对象

    2023-12-07 12:32:08       91 阅读

热门阅读

  1. 数据结构-哈希表

    2023-12-07 12:32:08       65 阅读
  2. Remix v2 中使用 remix-i18n 进行国际化翻译

    2023-12-07 12:32:08       63 阅读
  3. c的编译链接与执行

    2023-12-07 12:32:08       54 阅读
  4. 熟悉ElasticSearch 集群中搜索数据的过程吗?

    2023-12-07 12:32:08       57 阅读
  5. EEMD算法的Python实现

    2023-12-07 12:32:08       63 阅读
  6. C++:每日选择题--Day3

    2023-12-07 12:32:08       59 阅读
  7. postgres 登录及常用命令

    2023-12-07 12:32:08       65 阅读