Arduino IDE配置STM32开发环境和烧录
前言:最近在制作三维打印机,自己画了一块STM32F446的三维打印机板子(RUMBA32),但是在Arduino的编译马林固件的时候,一直报错,定时器显示中断有问题
怀疑可能的英文由于Arduino的IDE编译环境的问题,因此花了一点时间配置Arduino IDE,并成功实现了使用串口/DFU进行程序烧录,实现了最简单的LED显示屏和串口显示。
下面对整个步骤进行了介绍:
1. 下载Arduino IDE并安装
方式1:官网下载,下载后安装
方式2:Microsoft store:直接搜索Arduino进行下载并安装
2.在Arduino中安装STM32开发板
- Arduino IDE中打开“文件->首选项”,在“附加开发板管理器地址”中输入:
- Arduino IDE中打开“工具->开发->开发板管理器”,滑倒最下面可以看到:
安装最新的平板,我的版本是1.9.0
- Arduino IDE中打开“工具->开发板”,选择合适的开发板类型,例如最简单的STM32板子。我选择的是RUMBA32板子
3.安装STM32CubeProgrammer
- STM32CubeProgrammer可以让STM32中更方便地烧录程序,4种方式连接到STM32支持,分别为STLink、UART(串口)、USB和OTA。其中USB连接方式是最简单的,但STM32芯片需要引出USB连接上。在这里我选择USB,并使用USB线电脑连接和STM32板子。
- 点击一下板子的RESET(如果没有试一下,BOOT0置11),就点击STM32CubeProgrammer上的连接按钮,成功连接了升级。
4.添加STM32CubeProgrammer中的bin文件夹的路径到系统路径中
- 添加到系统路径中,其他程序也可以通过STM32CubeProgrammer将程序烧录到STM32中了。在电脑左下角搜索“高级系统设置”,打开后点击“环境变量”。
- 选择PATH,并点击“编辑”
- 添加bin路径到环境变量中。
至此,你的Arduino已经可以使用USB烧录程序到STM32中了。
5.配合好BOOT0,使用串口/DFU(USB)进行烧录
烧录之前,需要将BOOT0置为1,按复位复位,之后才可以烧录程序
其原理应该是BOOT0为1时,按复位后运行DFU程序,系统进行DFU模式,之后就可以用Arduino进行烧录了
配置USB支持串口,则可以直接使用USB进行串口读取与发送
再配一张制作一张自己的RUMBA322开发图:
之后制作成功3D打印机后,将和大家分享一下3D打印机的资料,分享一下
对了,马林2.0过程并在编译的时候,遇到了一些提示:
sketchsrcHALSTM32timers.cpp: In function 'void HAL_timer_enable_interrupt(uint8_t)':
sketchsrcHALSTM32timers.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:UsersASUSAppDataLocalArduino15packagesSTM32hardwarestm321.9.0coresarduino/stm32/analog.h:45,
from C:UsersASUSAppDataLocalArduino15packagesSTM32hardwarestm321.9.0coresarduino/board.h:8,
from C:UsersASUSAppDataLocalArduino15packagesSTM32hardwarestm321.9.0coresarduino/wiring.h:41,
from C:UsersASUSAppDataLocalArduino15packagesSTM32hardwarestm321.9.0coresarduino/Arduino.h:36,
from c:usersasusappdatalocaltemparduino_build_611183sketchsrchalsharedmarduino.h:36,
from c:usersasusappdatalocaltemparduino_build_611183sketchsrchalstm32hal.h:28,
from c:usersasusappdatalocaltemparduino_build_611183sketchsrchalhal.h:26,
from c:usersasusappdatalocaltemparduino_build_611183sketchsrcincmarlinconfig.h:30,
from sketchsrcHALSTM32timers.cpp:24:
C:UsersASUSAppDataLocalArduino15packagesSTM32hardwarestm321.9.0coresarduino/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:UsersASUSAppDataLocalArduino15packagesSTM32hardwarestm321.9.0coresarduino/HardwareTimer.h:134:46: note: no known conversion for argument 1 from 'void(HardwareTimer*)' to 'callback_function_t' {aka 'std::function
'}
134 | void attachInterrupt(callback_function_t callback); // Attach interrupt callback which will be called upon update event (timer rollover)
| ~~~~~~~~~~~~~~~~~~~~^~~~~~~~
C:UsersASUSAppDataLocalArduino15packagesSTM32hardwarestm321.9.0coresarduino/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:UsersASUSAppDataLocalArduino15packagesSTM32hardwarestm321.9.0coresarduino/HardwareTimer.h:138:10: note: candidate expects 2 arguments, 1 provided
sketchsrcHALSTM32timers.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:UsersASUSAppDataLocalArduino15packagesSTM32hardwarestm321.9.0coresarduino/stm32/analog.h:45,
from C:UsersASUSAppDataLocalArduino15packagesSTM32hardwarestm321.9.0coresarduino/board.h:8,
from C:UsersASUSAppDataLocalArduino15packagesSTM32hardwarestm321.9.0coresarduino/wiring.h:41,
from C:UsersASUSAppDataLocalArduino15packagesSTM32hardwarestm321.9.0coresarduino/Arduino.h:36,
from c:usersasusappdatalocaltemparduino_build_611183sketchsrchalsharedmarduino.h:36,
from c:usersasusappdatalocaltemparduino_build_611183sketchsrchalstm32hal.h:28,
from c:usersasusappdatalocaltemparduino_build_611183sketchsrchalhal.h:26,
from c:usersasusappdatalocaltemparduino_build_611183sketchsrcincmarlinconfig.h:30,
from sketchsrcHALSTM32timers.cpp:24:
C:UsersASUSAppDataLocalArduino15packagesSTM32hardwarestm321.9.0coresarduino/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:UsersASUSAppDataLocalArduino15packagesSTM32hardwarestm321.9.0coresarduino/HardwareTimer.h:134:46: note: no known conversion for argument 1 from 'void(HardwareTimer*)' to 'callback_function_t' {aka 'std::function'}
134 | void attachInterrupt(callback_function_t callback); // Attach interrupt callback which will be called upon update event (timer rollover)
| ~~~~~~~~~~~~~~~~~~~~^~~~~~~~
C:UsersASUSAppDataLocalArduino15packagesSTM32hardwarestm321.9.0coresarduino/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:UsersASUSAppDataLocalArduino15packagesSTM32hardwarestm321.9.0coresarduino/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 时出错
Arduino IDE配置STM32开发环境和烧录
前言:最近在制作三维打印机,自己画了一块STM32F446的三维打印机板子(RUMBA32),但是在Arduino的编译马林固件的时候,一直报错,定时器显示中断有问题
怀疑可能的英文由于Arduino的IDE编译环境的问题,因此花了一点时间配置Arduino IDE,并成功实现了使用串口/DFU进行程序烧录,实现了最简单的LED显示屏和串口显示。
下面对整个步骤进行了介绍:
1. 下载Arduino IDE并安装
方式1:官网下载,下载后安装
方式2:Microsoft store:直接搜索Arduino进行下载并安装
2.在Arduino中安装STM32开发板
- Arduino IDE中打开“文件->首选项”,在“附加开发板管理器地址”中输入:
- Arduino IDE中打开“工具->开发->开发板管理器”,滑倒最下面可以看到:
安装最新的平板,我的版本是1.9.0
- Arduino IDE中打开“工具->开发板”,选择合适的开发板类型,例如最简单的STM32板子。我选择的是RUMBA32板子
3.安装STM32CubeProgrammer
- STM32CubeProgrammer可以让STM32中更方便地烧录程序,4种方式连接到STM32支持,分别为STLink、UART(串口)、USB和OTA。其中USB连接方式是最简单的,但STM32芯片需要引出USB连接上。在这里我选择USB,并使用USB线电脑连接和STM32板子。
- 点击一下板子的RESET(如果没有试一下,BOOT0置11),就点击STM32CubeProgrammer上的连接按钮,成功连接了升级。
4.添加STM32CubeProgrammer中的bin文件夹的路径到系统路径中
- 添加到系统路径中,其他程序也可以通过STM32CubeProgrammer将程序烧录到STM32中了。在电脑左下角搜索“高级系统设置”,打开后点击“环境变量”。
- 选择PATH,并点击“编辑”
- 添加bin路径到环境变量中。
至此,你的Arduino已经可以使用USB烧录程序到STM32中了。
5.配合好BOOT0,使用串口/DFU(USB)进行烧录
烧录之前,需要将BOOT0置为1,按复位复位,之后才可以烧录程序
其原理应该是BOOT0为1时,按复位后运行DFU程序,系统进行DFU模式,之后就可以用Arduino进行烧录了
配置USB支持串口,则可以直接使用USB进行串口读取与发送
再配一张制作一张自己的RUMBA322开发图:
之后制作成功3D打印机后,将和大家分享一下3D打印机的资料,分享一下
对了,马林2.0过程并在编译的时候,遇到了一些提示:
sketchsrcHALSTM32timers.cpp: In function 'void HAL_timer_enable_interrupt(uint8_t)':
sketchsrcHALSTM32timers.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:UsersASUSAppDataLocalArduino15packagesSTM32hardwarestm321.9.0coresarduino/stm32/analog.h:45,
from C:UsersASUSAppDataLocalArduino15packagesSTM32hardwarestm321.9.0coresarduino/board.h:8,
from C:UsersASUSAppDataLocalArduino15packagesSTM32hardwarestm321.9.0coresarduino/wiring.h:41,
from C:UsersASUSAppDataLocalArduino15packagesSTM32hardwarestm321.9.0coresarduino/Arduino.h:36,
from c:usersasusappdatalocaltemparduino_build_611183sketchsrchalsharedmarduino.h:36,
from c:usersasusappdatalocaltemparduino_build_611183sketchsrchalstm32hal.h:28,
from c:usersasusappdatalocaltemparduino_build_611183sketchsrchalhal.h:26,
from c:usersasusappdatalocaltemparduino_build_611183sketchsrcincmarlinconfig.h:30,
from sketchsrcHALSTM32timers.cpp:24:
C:UsersASUSAppDataLocalArduino15packagesSTM32hardwarestm321.9.0coresarduino/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:UsersASUSAppDataLocalArduino15packagesSTM32hardwarestm321.9.0coresarduino/HardwareTimer.h:134:46: note: no known conversion for argument 1 from 'void(HardwareTimer*)' to 'callback_function_t' {aka 'std::function
'}
134 | void attachInterrupt(callback_function_t callback); // Attach interrupt callback which will be called upon update event (timer rollover)
| ~~~~~~~~~~~~~~~~~~~~^~~~~~~~
C:UsersASUSAppDataLocalArduino15packagesSTM32hardwarestm321.9.0coresarduino/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:UsersASUSAppDataLocalArduino15packagesSTM32hardwarestm321.9.0coresarduino/HardwareTimer.h:138:10: note: candidate expects 2 arguments, 1 provided
sketchsrcHALSTM32timers.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:UsersASUSAppDataLocalArduino15packagesSTM32hardwarestm321.9.0coresarduino/stm32/analog.h:45,
from C:UsersASUSAppDataLocalArduino15packagesSTM32hardwarestm321.9.0coresarduino/board.h:8,
from C:UsersASUSAppDataLocalArduino15packagesSTM32hardwarestm321.9.0coresarduino/wiring.h:41,
from C:UsersASUSAppDataLocalArduino15packagesSTM32hardwarestm321.9.0coresarduino/Arduino.h:36,
from c:usersasusappdatalocaltemparduino_build_611183sketchsrchalsharedmarduino.h:36,
from c:usersasusappdatalocaltemparduino_build_611183sketchsrchalstm32hal.h:28,
from c:usersasusappdatalocaltemparduino_build_611183sketchsrchalhal.h:26,
from c:usersasusappdatalocaltemparduino_build_611183sketchsrcincmarlinconfig.h:30,
from sketchsrcHALSTM32timers.cpp:24:
C:UsersASUSAppDataLocalArduino15packagesSTM32hardwarestm321.9.0coresarduino/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:UsersASUSAppDataLocalArduino15packagesSTM32hardwarestm321.9.0coresarduino/HardwareTimer.h:134:46: note: no known conversion for argument 1 from 'void(HardwareTimer*)' to 'callback_function_t' {aka 'std::function'}
134 | void attachInterrupt(callback_function_t callback); // Attach interrupt callback which will be called upon update event (timer rollover)
| ~~~~~~~~~~~~~~~~~~~~^~~~~~~~
C:UsersASUSAppDataLocalArduino15packagesSTM32hardwarestm321.9.0coresarduino/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:UsersASUSAppDataLocalArduino15packagesSTM32hardwarestm321.9.0coresarduino/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 时出错
举报