Arduino IDE配置STM32开发环境和程序烧录

   日期:2020-08-22     浏览:199    评论:0    
核心提示:Arduino IDE配置STM32开发环境和烧录前言:最近在制作3D打印机,自己画了一块STM32F446的3D打印机板子(RUMBA32),但是在Arduino编译Marlin固件的时候,一直报错,显示定时器中断有问题。怀疑可能是由于Arduino IDE编译环境的问题,因此花了一点时间配置Arduino IDE,并成功实现使用串口/DFU进行程序烧录,实现了最简单的LED闪烁和串口显示。下面对整个步骤进行介绍:1. 下载Arduino IDE并安装方式1:官网下载地址:https://_arduin

Arduino IDE配置STM32开发环境和烧录

前言:最近在制作3D打印机,自己画了一块STM32F446的3D打印机板子(RUMBA32),但是在Arduino编译Marlin固件的时候,一直报错,显示定时器中断有问题。
怀疑可能是由于Arduino IDE编译环境的问题,因此花了一点时间配置Arduino IDE,并成功实现使用串口/DFU进行程序烧录,实现了最简单的LED闪烁和串口显示。
下面对整个步骤进行介绍:

1. 下载Arduino IDE并安装

方式1:官网下载地址:https://www.arduino.cc/en/Main/Software,下载后安装
方式2:Microsoft store:直接搜索Arduino进行下载并安装

2. 在Arduino中安装STM32开发板

  1. Arduino IDE中打开“文件 -> 首选项”,在“附加开发板管理器地址”中输入:https://github.com/stm32duino/BoardManagerFiles/raw/master/STM32/package_stm_index.json
  1. Arduino IDE中打开“工具 -> 开发板 -> 开发板管理器”,滑倒最下面可以看到:

    安装最新的即可,我的版本是1.9.0
  1. Arduino IDE中打开“工具 -> 开发板”,选择合适的开发板类型,例如最简单的STM32板子。我选择的是RUMBA32板子

3. 安装STM32CubeProgrammer

4. 添加STM32CubeProgrammer中的bin文件夹的路径到系统路径中

5. 配合好BOOT0,使用串口/DFU进行烧录

在这里只需要STM32CubeProgrammer初次设置好了是串口方式/DFU方式,之后就不需要用STM32CubeProgrammer了
在DFU模式中,如果需要重新下载程序,需要BOOT0为1,按reset复位,之后才可以烧录程序
其原理应该是BOOT0为1时,按reset后运行DFU程序,系统进行DFU模式,之后就可以用Arduino进行烧录
配置USB支持串口,则可以直接使用USB进行串口读取与发送

最后配一张自己制作的RUMBA32开发板图:。

之后制作成功3D打印机后,将会和大家分享一下制作3D打印机的过程,并分享一些资料

对了,在编译Marlin 2.0固件的时候,遇到报错:

sketch\src\HAL\STM32\timers.cpp: In function 'void HAL_timer_enable_interrupt(uint8_t)':
sketch\src\HAL\STM32\timers.cpp:178:62: error: no matching function for call to 'HardwareTimer::attachInterrupt(void (&)(HardwareTimer*))'
  178 |       timer_instance[timer_num]->attachInterrupt(Step_Handler);
      |                                                              ^
In file included from C:\Users\ASUS\AppData\Local\Arduino15\packages\STM32\hardware\stm32\1.9.0\cores\arduino/stm32/analog.h:45,
                 from C:\Users\ASUS\AppData\Local\Arduino15\packages\STM32\hardware\stm32\1.9.0\cores\arduino/board.h:8,
                 from C:\Users\ASUS\AppData\Local\Arduino15\packages\STM32\hardware\stm32\1.9.0\cores\arduino/wiring.h:41,
                 from C:\Users\ASUS\AppData\Local\Arduino15\packages\STM32\hardware\stm32\1.9.0\cores\arduino/Arduino.h:36,
                 from c:\users\asus\appdata\local\temp\arduino_build_611183\sketch\src\hal\shared\marduino.h:36,
                 from c:\users\asus\appdata\local\temp\arduino_build_611183\sketch\src\hal\stm32\hal.h:28,
                 from c:\users\asus\appdata\local\temp\arduino_build_611183\sketch\src\hal\hal.h:26,
                 from c:\users\asus\appdata\local\temp\arduino_build_611183\sketch\src\inc\marlinconfig.h:30,
                 from sketch\src\HAL\STM32\timers.cpp:24:
C:\Users\ASUS\AppData\Local\Arduino15\packages\STM32\hardware\stm32\1.9.0\cores\arduino/HardwareTimer.h:134:10: note: candidate: 'void HardwareTimer::attachInterrupt(callback_function_t)'
  134 |     void attachInterrupt(callback_function_t callback); // Attach interrupt callback which will be called upon update event (timer rollover)
      |          ^~~~~~~~~~~~~~~
C:\Users\ASUS\AppData\Local\Arduino15\packages\STM32\hardware\stm32\1.9.0\cores\arduino/HardwareTimer.h:134:46: note:   no known conversion for argument 1 from 'void(HardwareTimer*)' to 'callback_function_t' {aka 'std::function<void()>'}
  134 |     void attachInterrupt(callback_function_t callback); // Attach interrupt callback which will be called upon update event (timer rollover)
      |                          ~~~~~~~~~~~~~~~~~~~~^~~~~~~~
C:\Users\ASUS\AppData\Local\Arduino15\packages\STM32\hardware\stm32\1.9.0\cores\arduino/HardwareTimer.h:138:10: note: candidate: 'void HardwareTimer::attachInterrupt(uint32_t, callback_function_t)'
  138 |     void attachInterrupt(uint32_t channel, callback_function_t callback); // Attach interrupt callback which will be called upon compare match event of specified channel
      |          ^~~~~~~~~~~~~~~
C:\Users\ASUS\AppData\Local\Arduino15\packages\STM32\hardware\stm32\1.9.0\cores\arduino/HardwareTimer.h:138:10: note:   candidate expects 2 arguments, 1 provided
sketch\src\HAL\STM32\timers.cpp:181:62: error: no matching function for call to 'HardwareTimer::attachInterrupt(void (&)(HardwareTimer*))'
  181 |       timer_instance[timer_num]->attachInterrupt(Temp_Handler);
      |                                                              ^
In file included from C:\Users\ASUS\AppData\Local\Arduino15\packages\STM32\hardware\stm32\1.9.0\cores\arduino/stm32/analog.h:45,
                 from C:\Users\ASUS\AppData\Local\Arduino15\packages\STM32\hardware\stm32\1.9.0\cores\arduino/board.h:8,
                 from C:\Users\ASUS\AppData\Local\Arduino15\packages\STM32\hardware\stm32\1.9.0\cores\arduino/wiring.h:41,
                 from C:\Users\ASUS\AppData\Local\Arduino15\packages\STM32\hardware\stm32\1.9.0\cores\arduino/Arduino.h:36,
                 from c:\users\asus\appdata\local\temp\arduino_build_611183\sketch\src\hal\shared\marduino.h:36,
                 from c:\users\asus\appdata\local\temp\arduino_build_611183\sketch\src\hal\stm32\hal.h:28,
                 from c:\users\asus\appdata\local\temp\arduino_build_611183\sketch\src\hal\hal.h:26,
                 from c:\users\asus\appdata\local\temp\arduino_build_611183\sketch\src\inc\marlinconfig.h:30,
                 from sketch\src\HAL\STM32\timers.cpp:24:
C:\Users\ASUS\AppData\Local\Arduino15\packages\STM32\hardware\stm32\1.9.0\cores\arduino/HardwareTimer.h:134:10: note: candidate: 'void HardwareTimer::attachInterrupt(callback_function_t)'
  134 |     void attachInterrupt(callback_function_t callback); // Attach interrupt callback which will be called upon update event (timer rollover)
      |          ^~~~~~~~~~~~~~~
C:\Users\ASUS\AppData\Local\Arduino15\packages\STM32\hardware\stm32\1.9.0\cores\arduino/HardwareTimer.h:134:46: note:   no known conversion for argument 1 from 'void(HardwareTimer*)' to 'callback_function_t' {aka 'std::function<void()>'}
  134 |     void attachInterrupt(callback_function_t callback); // Attach interrupt callback which will be called upon update event (timer rollover)
      |                          ~~~~~~~~~~~~~~~~~~~~^~~~~~~~
C:\Users\ASUS\AppData\Local\Arduino15\packages\STM32\hardware\stm32\1.9.0\cores\arduino/HardwareTimer.h:138:10: note: candidate: 'void HardwareTimer::attachInterrupt(uint32_t, callback_function_t)'
  138 |     void attachInterrupt(uint32_t channel, callback_function_t callback); // Attach interrupt callback which will be called upon compare match event of specified channel
      |          ^~~~~~~~~~~~~~~
C:\Users\ASUS\AppData\Local\Arduino15\packages\STM32\hardware\stm32\1.9.0\cores\arduino/HardwareTimer.h:138:10: note:   candidate expects 2 arguments, 1 provided
exit status 1
为开发板 3D printer boards 编译时出错。
下载 https://github.com/stm32duino/BoardManagerFiles/raw/master/STM32/package_stm_index.json 时出错
下载 https://github.com/stm32duino/BoardManagerFiles/raw/master/STM32/package_stm_index.json 时出错

暂时没有得到解决,望知道的小伙伴解答!

上述的内容我还会再细化补充内容,如果对你有帮助,希望可以点赞以支持,同时也可以在评论区说出自己遇到的问题!

2020年8月21日:问题已解决,根据rumba32的wiki,需要使用VScode进行编译烧录。等之后材料到齐了,就可以制作3D打印机了

 
打赏
 本文转载自:网络 
所有权利归属于原作者,如文章来源标示错误或侵犯了您的权利请联系微信13520258486
更多>最近资讯中心
更多>最新资讯中心
0相关评论

推荐图文
推荐资讯中心
点击排行
最新信息
新手指南
采购商服务
供应商服务
交易安全
关注我们
手机网站:
新浪微博:
微信关注:

13520258486

周一至周五 9:00-18:00
(其他时间联系在线客服)

24小时在线客服