马上注册,获取阅读精华内容及下载权限
您需要 登录 才可以下载或查看,没有帐号?注册
x
开发板收到了
首先初步了解了下NUCLEO-F412ZG开发板的基本属性:
4路USART,速率可高达12.5 Mbit/s 5路SPI(与I2S复用 ),速度高达50Mbit/s 4个I2C,高达1Mbps 2x CAN(2.0B有效) 1个全速USB 2.0 OTG 2个全双工I2S,最高32-bit/192 kHz 3个单工I2S,最高32-bit/192 kHz 2个数字滤波器,用于∑Δ调制器 4个PDM接口,支持立体声麦克风 速度高达2.4 MSPS的12位ADC, 14个定时器,频率高达100 MHz的16和32位定时器 硬件随机数发生器
板子接口兼容了arduino,很多arduino兼容外设板可以不用杜邦线直接与开发板相连接
初步了解了开发板之后,要开始了解这颗芯片了,首先要把工程建立起来。由于我感觉cube自带的hal库比较难用(也许是我了解的还不够深入,对标准库比较熟。),决定使用标准的外设库进行工程建立。
因为我比较熟悉keil,决定使用keil进行开发,首先要去keil官网下载pack包
经过百度,找到了标准外设库的下载地址:
将库的压缩包解压
可以看到 库里已经包含了模板的项目文件
打开项目,修改配置,后编译成功。今天附件上传限额到了。。。明天再贴图指出修改部分
用VS2015编辑代码很方便,而建立工程有点烦,送给大家原创一个小工具,快速建立VS2015工程文件
http://bbs.elecfans.com/jishu_1099747_1_1.html
标准库的风格跟STM32F103的库风格比较接近,所以有STM32F103的基础再使用STM32F412难度不会很高
简单的修改了下main.c,实现了流水灯,下载到开发板之后正常运行,证明工程建立正确,可以进行正常的开发工作了。
- /**
- ******************************************************************************
- * @file Project/STM32F4xx_StdPeriph_Templates/main.c
- * @author MCD Application Team
- * @version V1.7.1
- * @date 20-May-2016
- * @brief Main program body
- ******************************************************************************
- * @attention
- *
- * <h2><center>© COPYRIGHT 2016 STMicroelectronics</center></h2>
- *
- * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
- * You may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.st.com/software_license_agreement_liberty_v2
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- ******************************************************************************
- */
- /* Includes ------------------------------------------------------------------*/
- #include "main.h"
- /** @addtogroup Template_Project
- * @{
- */
- /* Private typedef -----------------------------------------------------------*/
- /* Private define ------------------------------------------------------------*/
- #define LED_RED GPIO_Pin_14
- #define LED_GREEN GPIO_Pin_0
- #define LED_BLUE GPIO_Pin_7
- /* Private macro -------------------------------------------------------------*/
- /* Private variables ---------------------------------------------------------*/
- static __IO uint32_t uwTimingDelay;
- RCC_ClocksTypeDef RCC_Clocks;
- /* Private function prototypes -----------------------------------------------*/
- static void Delay(__IO uint32_t nTime);
- /* Private functions ---------------------------------------------------------*/
- typedef struct
- {
- u32 b0 : 1;
- u32 b1 : 1;
- u32 b2 : 1;
- u32 b3 : 1;
- u32 b4 : 1;
- u32 b5 : 1;
- u32 b6 : 1;
- u32 b7 : 1;
- u32 b8 : 1;
- u32 b9 : 1;
- u32 b10 : 1;
- u32 b11 : 1;
- u32 b12 : 1;
- u32 b13 : 1;
- u32 b14 : 1;
- u32 b15 : 1;
- u32 b16 : 1;
- u32 b17 : 1;
- u32 b18 : 1;
- u32 b19 : 1;
- u32 b20 : 1;
- u32 b21 : 1;
- u32 b22 : 1;
- u32 b23 : 1;
- u32 b24 : 1;
- u32 b25 : 1;
- u32 b26 : 1;
- u32 b27 : 1;
- u32 b28 : 1;
- u32 b29 : 1;
- u32 b30 : 1;
- u32 b31 : 1;
- }Bit;
- /**
- * @brief Main program
- * @param None
- * @retval None
- */
- int main(void)
- {
- GPIO_InitTypeDef GPIO_InitStructure;
- RCC_GetClocksFreq(&RCC_Clocks);
- SysTick_Config(RCC_Clocks.HCLK_Frequency / 1000);
- RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOB, ENABLE);
- GPIO_InitStructure.GPIO_Pin = LED_RED | LED_GREEN | LED_BLUE;
- GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;
- GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
- GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
- GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;
- GPIO_Init(GPIOB, &GPIO_InitStructure);
[color=rgb(51, 102, 153) !important]复制代码
[color=rgb(51, 102, 153) !important]
|