初步功能已经加全了
parent
c1ec838049
commit
92cc9d0b1c
|
|
@ -0,0 +1,93 @@
|
|||
#include "adc.h"
|
||||
#include "delay.h"
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
//本程序只供学习使用,未经作者许可,不得用于其它任何用途
|
||||
//ALIENTEK STM32F407开发板
|
||||
//ADC 驱动代码
|
||||
//正点原子@ALIENTEK
|
||||
//技术论坛:www.openedv.com
|
||||
//创建日期:2014/5/6
|
||||
//版本:V1.0
|
||||
//版权所有,盗版必究。
|
||||
//Copyright(C) 广州市星翼电子科技有限公司 2014-2024
|
||||
//All rights reserved
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
//初始化ADC
|
||||
void Adc_Init(void)
|
||||
{
|
||||
GPIO_InitTypeDef GPIO_InitStructure;
|
||||
ADC_CommonInitTypeDef ADC_CommonInitStructure;
|
||||
ADC_InitTypeDef ADC_InitStructure;
|
||||
|
||||
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOA, ENABLE);//使能GPIOA时钟
|
||||
RCC_APB2PeriphClockCmd(RCC_APB2Periph_ADC1, ENABLE); //使能ADC1时钟
|
||||
|
||||
//先初始化ADC1通道5 IO口
|
||||
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_5 | GPIO_Pin_6 | GPIO_Pin_7;//PA5 通道5
|
||||
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AN;//模拟输入
|
||||
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL ;//不带上下拉
|
||||
GPIO_Init(GPIOA, &GPIO_InitStructure);//初始化
|
||||
|
||||
RCC_APB2PeriphResetCmd(RCC_APB2Periph_ADC1,ENABLE); //ADC1复位
|
||||
RCC_APB2PeriphResetCmd(RCC_APB2Periph_ADC1,DISABLE); //复位结束
|
||||
|
||||
|
||||
ADC_CommonInitStructure.ADC_Mode = ADC_Mode_Independent;//独立模式
|
||||
ADC_CommonInitStructure.ADC_TwoSamplingDelay = ADC_TwoSamplingDelay_5Cycles;//两个采样阶段之间的延迟5个时钟
|
||||
ADC_CommonInitStructure.ADC_DMAAccessMode = ADC_DMAAccessMode_Disabled; //DMA失能
|
||||
ADC_CommonInitStructure.ADC_Prescaler = ADC_Prescaler_Div4;//预分频4分频。ADCCLK=PCLK2/4=84/4=21Mhz,ADC时钟最好不要超过36Mhz
|
||||
ADC_CommonInit(&ADC_CommonInitStructure);//初始化
|
||||
|
||||
ADC_InitStructure.ADC_Resolution = ADC_Resolution_12b;//12位模式
|
||||
ADC_InitStructure.ADC_ScanConvMode = DISABLE;//非扫描模式
|
||||
ADC_InitStructure.ADC_ContinuousConvMode = DISABLE;//关闭连续转换
|
||||
ADC_InitStructure.ADC_ExternalTrigConvEdge = ADC_ExternalTrigConvEdge_None;//禁止触发检测,使用软件触发
|
||||
ADC_InitStructure.ADC_DataAlign = ADC_DataAlign_Right;//右对齐
|
||||
ADC_InitStructure.ADC_NbrOfConversion = 1;//1个转换在规则序列中 也就是只转换规则序列1
|
||||
ADC_Init(ADC1, &ADC_InitStructure);//ADC初始化
|
||||
|
||||
|
||||
ADC_Cmd(ADC1, ENABLE);//开启AD转换器
|
||||
|
||||
}
|
||||
//获得ADC值
|
||||
//ch: @ref ADC_channels
|
||||
//通道值 0~16取值范围为:ADC_Channel_0~ADC_Channel_16
|
||||
//返回值:转换结果
|
||||
u16 Get_Adc(u8 ch)
|
||||
{
|
||||
//设置指定ADC的规则组通道,一个序列,采样时间
|
||||
ADC_RegularChannelConfig(ADC1, ch, 1, ADC_SampleTime_480Cycles ); //ADC1,ADC通道,480个周期,提高采样时间可以提高精确度
|
||||
|
||||
ADC_SoftwareStartConv(ADC1); //使能指定的ADC1的软件转换启动功能
|
||||
|
||||
while(!ADC_GetFlagStatus(ADC1, ADC_FLAG_EOC ));//等待转换结束
|
||||
|
||||
return ADC_GetConversionValue(ADC1); //返回最近一次ADC1规则组的转换结果
|
||||
}
|
||||
//获取通道ch的转换值,取times次,然后平均
|
||||
//ch:通道编号
|
||||
//times:获取次数
|
||||
//返回值:通道ch的times次转换结果平均值
|
||||
u16 Get_Adc_Average(u8 ch,u8 times)
|
||||
{
|
||||
u32 temp_val=0;
|
||||
u8 t;
|
||||
for(t=0;t<times;t++)
|
||||
{
|
||||
temp_val+=Get_Adc(ch);
|
||||
delay_ms(1);
|
||||
}
|
||||
return temp_val/times;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
#ifndef __ADC_H
|
||||
#define __ADC_H
|
||||
#include "sys.h"
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
//本程序只供学习使用,未经作者许可,不得用于其它任何用途
|
||||
//ALIENTEK STM32F407开发板
|
||||
//ADC 驱动代码
|
||||
//正点原子@ALIENTEK
|
||||
//技术论坛:www.openedv.com
|
||||
//创建日期:2014/5/6
|
||||
//版本:V1.0
|
||||
//版权所有,盗版必究。
|
||||
//Copyright(C) 广州市星翼电子科技有限公司 2014-2024
|
||||
//All rights reserved
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void Adc_Init(void); //ADC通道初始化
|
||||
u16 Get_Adc(u8 ch); //获得某个通道值
|
||||
u16 Get_Adc_Average(u8 ch,u8 times);//得到某个通道给定次数采样的平均值
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,90 @@
|
|||
#include "spi.h"
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//SPI 驱动代码
|
||||
//STM32F4工程模板-库函数版本
|
||||
//淘宝店铺:http://mcudev.taobao.com
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
//以下是SPI模块的初始化代码,配置成主机模式
|
||||
//SPI口初始化
|
||||
//这里针是对SPI1的初始化
|
||||
void SPI1_Init(void)
|
||||
{
|
||||
GPIO_InitTypeDef GPIO_InitStructure;
|
||||
SPI_InitTypeDef SPI_InitStructure;
|
||||
|
||||
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOA, ENABLE);//使能GPIOA时钟
|
||||
RCC_APB2PeriphClockCmd(RCC_APB2Periph_SPI1, ENABLE);//使能SPI1时钟
|
||||
|
||||
//GPIOFB3,4,5初始化设置
|
||||
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_3|GPIO_Pin_4|GPIO_Pin_5;//PB3~5复用功能输出
|
||||
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;//复用功能
|
||||
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;//推挽输出
|
||||
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;//100MHz
|
||||
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;//上拉
|
||||
GPIO_Init(GPIOB, &GPIO_InitStructure);//初始化
|
||||
|
||||
GPIO_PinAFConfig(GPIOB,GPIO_PinSource3,GPIO_AF_SPI1); //PB3复用为 SPI1
|
||||
GPIO_PinAFConfig(GPIOB,GPIO_PinSource4,GPIO_AF_SPI1); //PB4复用为 SPI1
|
||||
GPIO_PinAFConfig(GPIOB,GPIO_PinSource5,GPIO_AF_SPI1); //PB5复用为 SPI1
|
||||
|
||||
//这里只针对SPI口初始化
|
||||
RCC_APB2PeriphResetCmd(RCC_APB2Periph_SPI1,ENABLE);//复位SPI1
|
||||
RCC_APB2PeriphResetCmd(RCC_APB2Periph_SPI1,DISABLE);//停止复位SPI1
|
||||
|
||||
SPI_InitStructure.SPI_Direction = SPI_Direction_2Lines_FullDuplex; //设置SPI单向或者双向的数据模式:SPI设置为双线双向全双工
|
||||
SPI_InitStructure.SPI_Mode = SPI_Mode_Master; //设置SPI工作模式:设置为主SPI
|
||||
SPI_InitStructure.SPI_DataSize = SPI_DataSize_8b; //设置SPI的数据大小:SPI发送接收8位帧结构
|
||||
SPI_InitStructure.SPI_CPOL = SPI_CPOL_High; //串行同步时钟的空闲状态为高电平
|
||||
SPI_InitStructure.SPI_CPHA = SPI_CPHA_2Edge; //串行同步时钟的第二个跳变沿(上升或下降)数据被采样
|
||||
SPI_InitStructure.SPI_NSS = SPI_NSS_Soft; //NSS信号由硬件(NSS管脚)还是软件(使用SSI位)管理:内部NSS信号有SSI位控制
|
||||
SPI_InitStructure.SPI_BaudRatePrescaler = SPI_BaudRatePrescaler_256; //定义波特率预分频的值:波特率预分频值为256
|
||||
SPI_InitStructure.SPI_FirstBit = SPI_FirstBit_MSB; //指定数据传输从MSB位还是LSB位开始:数据传输从MSB位开始
|
||||
SPI_InitStructure.SPI_CRCPolynomial = 7; //CRC值计算的多项式
|
||||
SPI_Init(SPI1, &SPI_InitStructure); //根据SPI_InitStruct中指定的参数初始化外设SPIx寄存器
|
||||
|
||||
SPI_Cmd(SPI1, ENABLE); //使能SPI外设
|
||||
|
||||
SPI1_ReadWriteByte(0xff);//启动传输
|
||||
}
|
||||
//SPI1速度设置函数
|
||||
//SPI速度=fAPB2/分频系数
|
||||
//@ref SPI_BaudRate_Prescaler:SPI_BaudRatePrescaler_2~SPI_BaudRatePrescaler_256
|
||||
//fAPB2时钟一般为84Mhz:
|
||||
void SPI1_SetSpeed(u8 SPI_BaudRatePrescaler)
|
||||
{
|
||||
assert_param(IS_SPI_BAUDRATE_PRESCALER(SPI_BaudRatePrescaler));//判断有效性
|
||||
SPI1->CR1&=0XFFC7;//位3-5清零,用来设置波特率
|
||||
SPI1->CR1|=SPI_BaudRatePrescaler; //设置SPI1速度
|
||||
SPI_Cmd(SPI1,ENABLE); //使能SPI1
|
||||
}
|
||||
//SPI1 读写一个字节
|
||||
//TxData:要写入的字节
|
||||
//返回值:读取到的字节
|
||||
u8 SPI1_ReadWriteByte(u8 TxData)
|
||||
{
|
||||
|
||||
while (SPI_I2S_GetFlagStatus(SPI1, SPI_I2S_FLAG_TXE) == RESET){}//等待发送区空
|
||||
|
||||
SPI_I2S_SendData(SPI1, TxData); //通过外设SPIx发送一个byte 数据
|
||||
|
||||
while (SPI_I2S_GetFlagStatus(SPI1, SPI_I2S_FLAG_RXNE) == RESET){} //等待接收完一个byte
|
||||
|
||||
return SPI_I2S_ReceiveData(SPI1); //返回通过SPIx最近接收的数据
|
||||
|
||||
}
|
||||
|
||||
u8 spi1_read_write_byte(u8 TxData)
|
||||
{
|
||||
SPI1_ReadWriteByte(TxData);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
#ifndef __SPI_H
|
||||
#define __SPI_H
|
||||
#include "sys.h"
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//SPI 驱动代码
|
||||
//STM32F4工程模板-库函数版本
|
||||
//淘宝店铺:http://mcudev.taobao.com
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void SPI1_Init(void); //初始化SPI1口
|
||||
void SPI1_SetSpeed(u8 SpeedSet); //设置SPI1速度
|
||||
u8 SPI1_ReadWriteByte(u8 TxData);//SPI1总线读写一个字节
|
||||
|
||||
#endif
|
||||
|
||||
|
|
@ -0,0 +1,172 @@
|
|||
#include "timer.h"
|
||||
#include "led.h"
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
//本程序只供学习使用,未经作者许可,不得用于其它任何用途
|
||||
//ALIENTEK STM32F407开发板
|
||||
//定时器 驱动代码
|
||||
//正点原子@ALIENTEK
|
||||
//技术论坛:www.openedv.com
|
||||
//创建日期:2014/5/4
|
||||
//版本:V1.0
|
||||
//版权所有,盗版必究。
|
||||
//Copyright(C) 广州市星翼电子科技有限公司 2014-2024
|
||||
//All rights reserved
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
void TIM2_Int_Init(u16 arr,u16 psc)
|
||||
{
|
||||
TIM_TimeBaseInitTypeDef TIM_TimeBaseInitStructure;
|
||||
NVIC_InitTypeDef NVIC_InitStructure;
|
||||
|
||||
RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM2,ENABLE); ///使能TIM3时钟
|
||||
|
||||
TIM_TimeBaseInitStructure.TIM_Period = arr; //自动重装载值
|
||||
TIM_TimeBaseInitStructure.TIM_Prescaler=psc; //定时器分频
|
||||
TIM_TimeBaseInitStructure.TIM_CounterMode=TIM_CounterMode_Up; //向上计数模式
|
||||
TIM_TimeBaseInitStructure.TIM_ClockDivision=TIM_CKD_DIV1;
|
||||
|
||||
TIM_TimeBaseInit(TIM2,&TIM_TimeBaseInitStructure);//初始化TIM3
|
||||
|
||||
TIM_ITConfig(TIM2,TIM_IT_Update,ENABLE); //允许定时器3更新中断
|
||||
TIM_Cmd(TIM2,ENABLE); //使能定时器3
|
||||
|
||||
NVIC_InitStructure.NVIC_IRQChannel=TIM2_IRQn; //定时器3中断
|
||||
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority=0x01; //抢占优先级1
|
||||
NVIC_InitStructure.NVIC_IRQChannelSubPriority=0x03; //子优先级3
|
||||
NVIC_InitStructure.NVIC_IRQChannelCmd=ENABLE;
|
||||
NVIC_Init(&NVIC_InitStructure);
|
||||
|
||||
}
|
||||
|
||||
u8 led_flag=0;
|
||||
u16 index=0;
|
||||
|
||||
extern u16 real_dis_data[6];
|
||||
extern u16 real_dis_data_bak[6];
|
||||
extern u8 double_buffer_flag;
|
||||
|
||||
//定时器3中断服务函数
|
||||
void TIM2_IRQHandler(void)
|
||||
{
|
||||
char vcm_cmd[16];
|
||||
if(TIM_GetITStatus(TIM2,TIM_IT_Update)==SET) //溢出中断
|
||||
{
|
||||
|
||||
#if 1
|
||||
if(led_flag == 0)
|
||||
{
|
||||
GPIO_SetBits(GPIOE, GPIO_Pin_0);
|
||||
led_flag = 1;
|
||||
TIM_ClearITPendingBit(TIM2,TIM_IT_Update); //清除中断标志位
|
||||
return;
|
||||
}
|
||||
if(led_flag == 1)
|
||||
{
|
||||
GPIO_ResetBits(GPIOE, GPIO_Pin_0);
|
||||
led_flag = 0;
|
||||
TIM_ClearITPendingBit(TIM2,TIM_IT_Update); //清除中断标志位
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
#if 0
|
||||
sprintf(vcm_cmd,VCM_DISPLACE_CMD,real_dis_data[index]);
|
||||
usart_send(USART3, vcm_cmd);
|
||||
usart_send(USART3, START_MACRO_NUM);
|
||||
TIM_ClearITPendingBit(TIM2,TIM_IT_Update); //清除中断标志位
|
||||
return;
|
||||
|
||||
#endif
|
||||
#if 0
|
||||
if(led_flag == 0)
|
||||
{
|
||||
sprintf(vcm_cmd,VCM_DISPLACE_CMD,real_dis_data[index]);
|
||||
usart_send(USART3, vcm_cmd);
|
||||
usart_send(USART3, START_MACRO_NUM);
|
||||
index++;
|
||||
TIM_ClearITPendingBit(TIM2,TIM_IT_Update); //清除中断标志位
|
||||
return;
|
||||
}
|
||||
if(led_flag == 1)
|
||||
{
|
||||
sprintf(vcm_cmd,VCM_DISPLACE_CMD,real_dis_data_bak[index]);
|
||||
usart_send(USART3, vcm_cmd);
|
||||
usart_send(USART3, START_MACRO_NUM);
|
||||
TIM_ClearITPendingBit(TIM2,TIM_IT_Update); //清除中断标志位
|
||||
return;
|
||||
}
|
||||
if(index > 199 && led_flag == 0)
|
||||
{
|
||||
index = 0;
|
||||
led_flag = 1;
|
||||
double_buffer_flag = 0;
|
||||
usart_send(USART1, "laishuju");
|
||||
}
|
||||
if(index > 199 && led_flag == 1)
|
||||
{
|
||||
index = 0;
|
||||
led_flag = 0;
|
||||
double_buffer_flag = 1;
|
||||
usart_send(USART1, "laishuju");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//通用定时器3中断初始化
|
||||
//arr:自动重装值。
|
||||
//psc:时钟预分频数
|
||||
//定时器溢出时间计算方法:Tout=((arr+1)*(psc+1))/Ft us.
|
||||
//Ft=定时器工作频率,单位:Mhz
|
||||
//这里使用的是定时器3!
|
||||
void TIM3_PWM_Init(u16 arr,u16 psc)
|
||||
{
|
||||
GPIO_InitTypeDef GPIO_InitStructure;
|
||||
TIM_TimeBaseInitTypeDef TIM_TimeBaseInitStructure;
|
||||
TIM_OCInitTypeDef TIM_OCInitStructure;
|
||||
|
||||
|
||||
RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM3,ENABLE); ///使能TIM3时钟
|
||||
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOA,ENABLE);
|
||||
|
||||
GPIO_PinAFConfig(GPIOA,GPIO_PinSource6,GPIO_AF_TIM3);
|
||||
|
||||
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_6;
|
||||
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
|
||||
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;
|
||||
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
|
||||
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;
|
||||
GPIO_Init(GPIOA,&GPIO_InitStructure);
|
||||
|
||||
GPIO_ResetBits(GPIOA, GPIO_Pin_6);
|
||||
|
||||
TIM_TimeBaseInitStructure.TIM_Period = arr; //自动重装载值
|
||||
TIM_TimeBaseInitStructure.TIM_Prescaler=psc; //定时器分频
|
||||
TIM_TimeBaseInitStructure.TIM_CounterMode=TIM_CounterMode_Up; //向上计数模式
|
||||
TIM_TimeBaseInitStructure.TIM_ClockDivision=TIM_CKD_DIV1;
|
||||
|
||||
TIM_TimeBaseInit(TIM3,&TIM_TimeBaseInitStructure);//初始化TIM3
|
||||
|
||||
TIM_OCInitStructure.TIM_OCMode = TIM_OCMode_PWM1;
|
||||
TIM_OCInitStructure.TIM_OutputState = TIM_OutputState_Enable;
|
||||
TIM_OCInitStructure.TIM_OCPolarity = TIM_OCPolarity_Low;
|
||||
TIM_OCInitStructure.TIM_Pulse = 100;
|
||||
|
||||
TIM_OC1Init(TIM3, &TIM_OCInitStructure);
|
||||
|
||||
TIM_OC1PreloadConfig(TIM3, TIM_OCPreload_Enable);
|
||||
|
||||
TIM_ARRPreloadConfig(TIM3,ENABLE);
|
||||
|
||||
//TIM_Cmd(TIM3, ENABLE);
|
||||
|
||||
}
|
||||
|
||||
//定时器3中断服务函数
|
||||
void TIM3_IRQHandler(void)
|
||||
{
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
#ifndef _TIMER_H
|
||||
#define _TIMER_H
|
||||
#include "sys.h"
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
//本程序只供学习使用,未经作者许可,不得用于其它任何用途
|
||||
//ALIENTEK STM32F407开发板
|
||||
//定时器 驱动代码
|
||||
//正点原子@ALIENTEK
|
||||
//技术论坛:www.openedv.com
|
||||
//创建日期:2014/6/16
|
||||
//版本:V1.0
|
||||
//版权所有,盗版必究。
|
||||
//Copyright(C) 广州市星翼电子科技有限公司 2014-2024
|
||||
//All rights reserved
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void TIM3_PWM_Init(u16 arr,u16 psc);
|
||||
#endif
|
||||
|
|
@ -0,0 +1,834 @@
|
|||
#include "elemachinery.h"
|
||||
//#include "stm32f4xx_hal.h"
|
||||
|
||||
typedef uint32_t u32;
|
||||
typedef uint16_t u16;
|
||||
typedef uint8_t u8;
|
||||
|
||||
|
||||
#define Poutup(n) GPIO_SetBits(GPIOC, n) //输出
|
||||
#define Poutdown(n) GPIO_ResetBits(GPIOC, n) //输出
|
||||
|
||||
|
||||
u32 lcd_key;
|
||||
char if_mobilemotor_rotate = 0; // 推拉移动电机是否旋转 旋转为1 不旋转为0
|
||||
char if_rotatingmotor_rotate = 1; // 旋转采集电机是否旋转 旋转为1 不旋转为0
|
||||
char mobile_configure = 0; // 推拉移动电机是否怕配置参数 0为未配置参数 1为配置参数
|
||||
char rotating_configure = 0; // 旋转采集电机是否怕配置参数 0为未配置参数 1为配置参数
|
||||
char step;
|
||||
|
||||
|
||||
|
||||
enum process_stage{
|
||||
CHANGE_STAGE_TO_RIGHT_LIMIT_POSITION, // 找零阶段向右移动
|
||||
CHANGE_STAGE_TO_LEFT_LIMIT_POSITION, // 找零阶段向左移
|
||||
CLOESE_THE_LID, // 关盖阶段 左移压紧
|
||||
FIND_THE_RIGHT_LIMIT_POSITION, // 找右线位阶段
|
||||
FAILD_FIND, // 没有找到试剂
|
||||
TESTING_SAMPLES, // 检测阶段
|
||||
FIND_THE_LEFT_LIMIT_POSITION, //找右线位阶段
|
||||
MOTOR_STOP //电机停止状态
|
||||
};
|
||||
enum rotating_stage{
|
||||
GIVE_CHANGE, // 找零阶段
|
||||
ROTATE, // 电机旋转
|
||||
RO_MOTOR_STOP, // 找零阶段向左移
|
||||
FIND_READ_FROM_CHANGE // 从零点到红色
|
||||
};
|
||||
enum motor_movement_direction{
|
||||
MOVE_LEFT, // 向左移动
|
||||
MOVE_RIGHT // 向右移动
|
||||
};
|
||||
|
||||
enum motor_movement_direction motor_move = MOVE_LEFT;
|
||||
enum process_stage pro_stage = CHANGE_STAGE_TO_RIGHT_LIMIT_POSITION; // 电机启动 进入找零阶段
|
||||
enum rotating_stage rot_stage = RO_MOTOR_STOP;
|
||||
|
||||
void TMC2240_CS_LOW(){
|
||||
|
||||
Poutdown(GPIO_Pin_4);
|
||||
Poutdown(GPIO_Pin_1);
|
||||
#if 0
|
||||
if(step == 1){
|
||||
Poutdown(4);
|
||||
}
|
||||
else{
|
||||
Poutdown(1);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
void TMC2240_CS_HIGH(){
|
||||
Poutup(GPIO_Pin_4);Poutup(GPIO_Pin_1);
|
||||
}
|
||||
|
||||
// 向TMC2240写入数据
|
||||
void tmc2240_write(uint8_t address, uint8_t data) {
|
||||
// 先发送地址
|
||||
spi1_read_write_byte(address);
|
||||
// 再发送数据
|
||||
spi1_read_write_byte(data);
|
||||
}
|
||||
|
||||
// TMC2240寄存器写操作(地址+32位数据)
|
||||
void TMC2240_WriteReg(uint8_t addr, uint32_t data) {
|
||||
|
||||
TMC2240_CS_LOW();
|
||||
|
||||
spi1_read_write_byte(addr | 0x80); // 写命令(bit7=1)?:ml-citation{ref="1" data="citationList"}
|
||||
spi1_read_write_byte((data >> 24) & 0xFF);
|
||||
spi1_read_write_byte((data >> 16) & 0xFF);
|
||||
spi1_read_write_byte((data >> 8) & 0xFF);
|
||||
spi1_read_write_byte(data & 0xFF);
|
||||
|
||||
// SoftSPI_TransferByte(addr | 0x80); // 写命令(bit7=1)?:ml-citation{ref="1" data="citationList"}
|
||||
// SoftSPI_TransferByte((data >> 24) & 0xFF);
|
||||
// SoftSPI_TransferByte((data >> 16) & 0xFF);
|
||||
// SoftSPI_TransferByte((data >> 8) & 0xFF);
|
||||
// SoftSPI_TransferByte(data & 0xFF);
|
||||
|
||||
|
||||
TMC2240_CS_HIGH();
|
||||
}
|
||||
|
||||
// TMC2240寄存器读操作
|
||||
uint32_t TMC2240_ReadReg(uint8_t addr) {
|
||||
uint32_t data = 0;
|
||||
|
||||
TMC2240_CS_LOW();
|
||||
|
||||
spi1_read_write_byte(addr & 0x7F); // 读命令(bit7=0)?:ml-citation{ref="1" data="citationList"}
|
||||
data = (uint32_t)spi1_read_write_byte(0xFF) << 24;
|
||||
data |= (uint32_t)spi1_read_write_byte(0xFF) << 16;
|
||||
data |= (uint32_t)spi1_read_write_byte(0xFF) << 8;
|
||||
data |= spi1_read_write_byte(0xFF);
|
||||
|
||||
// SoftSPI_TransferByte(addr & 0x7F); // 读命令(bit7=0)?:ml-citation{ref="1" data="citationList"}
|
||||
// data = (uint32_t)SoftSPI_TransferByte(0xFF) << 24;
|
||||
// data |= (uint32_t)SoftSPI_TransferByte(0xFF) << 16;
|
||||
// data |= (uint32_t)SoftSPI_TransferByte(0xFF) << 8;
|
||||
// data |= SoftSPI_TransferByte(0xFF);
|
||||
|
||||
TMC2240_CS_HIGH();
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
|
||||
// direct_mode (Bit 16)
|
||||
void TMC2240_SetDirectMode(uint8_t value, uint32_t *gconf) {
|
||||
if (value > 1) return; // 允许值0或1
|
||||
*gconf = (*gconf & ~(1 << 16)) | ((value & 0x01) << 16);
|
||||
TMC2240_WriteReg(0x00, *gconf);
|
||||
}
|
||||
|
||||
// stop_enable (Bit 15)
|
||||
void TMC2240_SetStopEnable(uint8_t value, uint32_t *gconf) {
|
||||
if (value > 1) return;
|
||||
*gconf = (*gconf & ~(1 << 15)) | ((value & 0x01) << 15);
|
||||
TMC2240_WriteReg(0x00, *gconf);
|
||||
}
|
||||
|
||||
// small_hysteresis (Bit 14)
|
||||
void TMC2240_SetSmallHysteresis(uint8_t value, uint32_t *gconf) {
|
||||
if (value > 1) return;
|
||||
*gconf = (*gconf & ~(1 << 14)) | ((value & 0x01) << 14);
|
||||
TMC2240_WriteReg(0x00, *gconf);
|
||||
}
|
||||
|
||||
// diag1_pushpull (Bit 13)
|
||||
void TMC2240_SetDiag1PushPull(uint8_t value, uint32_t *gconf) {
|
||||
if (value > 1) return;
|
||||
*gconf = (*gconf & ~(1 << 13)) | ((value & 0x01) << 13);
|
||||
TMC2240_WriteReg(0x00, *gconf);
|
||||
}
|
||||
|
||||
// diag0_pushpull (Bit 12)
|
||||
void TMC2240_SetDiag0PushPull(uint8_t value, uint32_t *gconf) {
|
||||
if (value > 1) return;
|
||||
*gconf = (*gconf & ~(1 << 12)) | ((value & 0x01) << 12);
|
||||
TMC2240_WriteReg(0x00, *gconf);
|
||||
}
|
||||
|
||||
// diag1_onstate (Bit 10)
|
||||
void TMC2240_SetDiag1OnState(uint8_t value, uint32_t *gconf) {
|
||||
if (value > 1) return;
|
||||
*gconf = (*gconf & ~(1 << 10)) | ((value & 0x01) << 10);
|
||||
TMC2240_WriteReg(0x00, *gconf);
|
||||
}
|
||||
|
||||
// diag1_index (Bit 9)
|
||||
void TMC2240_SetDiag1Index(uint8_t value, uint32_t *gconf) {
|
||||
if (value > 1) return;
|
||||
*gconf = (*gconf & ~(1 << 9)) | ((value & 0x01) << 9);
|
||||
TMC2240_WriteReg(0x00, *gconf);
|
||||
}
|
||||
|
||||
// diag1_stall (Bit 8)
|
||||
void TMC2240_SetDiag1Stall(uint8_t value, uint32_t *gconf) {
|
||||
if (value > 1) return;
|
||||
*gconf = (*gconf & ~(1 << 8)) | ((value & 0x01) << 8);
|
||||
TMC2240_WriteReg(0x00, *gconf);
|
||||
}
|
||||
|
||||
// diag0_stall (Bit 7)
|
||||
void TMC2240_SetDiag0Stall(uint8_t value, uint32_t *gconf) {
|
||||
if (value > 1) return;
|
||||
*gconf = (*gconf & ~(1 << 7)) | ((value & 0x01) << 7);
|
||||
TMC2240_WriteReg(0x00, *gconf);
|
||||
}
|
||||
|
||||
// diag0_otpw (Bit 6)
|
||||
void TMC2240_SetDiag0Otpw(uint8_t value, uint32_t *gconf) {
|
||||
if (value > 1) return;
|
||||
*gconf = (*gconf & ~(1 << 6)) | ((value & 0x01) << 6);
|
||||
TMC2240_WriteReg(0x00, *gconf);
|
||||
}
|
||||
|
||||
// diag0_error (Bit 5)
|
||||
void TMC2240_SetDiag0Error(uint8_t value, uint32_t *gconf) {
|
||||
if (value > 1) return;
|
||||
*gconf = (*gconf & ~(1 << 5)) | ((value & 0x01) << 5);
|
||||
TMC2240_WriteReg(0x00, *gconf);
|
||||
}
|
||||
|
||||
// shaft (Bit 4)
|
||||
void TMC2240_SetShaft(uint8_t value, uint32_t *gconf) {
|
||||
if (value > 1) return;
|
||||
*gconf = (*gconf & ~(1 << 4)) | ((value & 0x01) << 4);
|
||||
TMC2240_WriteReg(0x00, *gconf);
|
||||
}
|
||||
|
||||
// multistep_filt (Bit 3)
|
||||
void TMC2240_SetMultistepFilt(uint8_t value, uint32_t *gconf) {
|
||||
if (value > 1) return;
|
||||
*gconf = (*gconf & ~(1 << 3)) | ((value & 0x01) << 3);
|
||||
TMC2240_WriteReg(0x00, *gconf);
|
||||
}
|
||||
|
||||
// en_pwm_mode (Bit 2)
|
||||
void TMC2240_SetEnPwmMode(uint8_t value, uint32_t *gconf) {
|
||||
if (value > 1) return;
|
||||
*gconf = (*gconf & ~(1 << 2)) | ((value & 0x01) << 2);
|
||||
TMC2240_WriteReg(0x00, *gconf);
|
||||
}
|
||||
|
||||
// fast_standstill (Bit 1)
|
||||
void TMC2240_SetFastStandstill(uint8_t value, uint32_t *gconf) {
|
||||
if (value > 1) return;
|
||||
*gconf = (*gconf & ~(1 << 1)) | ((value & 0x01) << 1);
|
||||
TMC2240_WriteReg(0x00, *gconf);
|
||||
}
|
||||
|
||||
void set_GCONF(uint8_t field_selector, uint8_t param_value, uint32_t *gconf) {
|
||||
switch(field_selector) {
|
||||
case 0x00: TMC2240_SetDirectMode(param_value, gconf); break;
|
||||
case 0x01: TMC2240_SetStopEnable(param_value, gconf); break;
|
||||
case 0x02: TMC2240_SetSmallHysteresis(param_value, gconf); break;
|
||||
case 0x03: TMC2240_SetDiag1PushPull(param_value, gconf); break;
|
||||
case 0x04: TMC2240_SetDiag0PushPull(param_value, gconf); break;
|
||||
case 0x05: TMC2240_SetDiag1OnState(param_value, gconf); break;
|
||||
case 0x06: TMC2240_SetDiag1Index(param_value, gconf); break;
|
||||
case 0x07: TMC2240_SetDiag1Stall(param_value, gconf); break;
|
||||
case 0x08: TMC2240_SetDiag0Stall(param_value, gconf); break;
|
||||
case 0x09: TMC2240_SetDiag0Otpw(param_value, gconf); break;
|
||||
case 0x0A: TMC2240_SetDiag0Error(param_value, gconf); break;
|
||||
case 0x0B: TMC2240_SetShaft(param_value, gconf); break;
|
||||
case 0x0C: TMC2240_SetMultistepFilt(param_value, gconf); break;
|
||||
case 0x0D: TMC2240_SetEnPwmMode(param_value, gconf); break;
|
||||
case 0x0E: TMC2240_SetFastStandstill(param_value, gconf); break;
|
||||
default:
|
||||
// 可添加错误处理(如打印无效选择器)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// IRUNDELAY (Bits 27:24)
|
||||
void TMC2240_SetIRunDelay(uint8_t value, uint32_t *current_config) {
|
||||
if (value > 15) return; // 错误:超出范围(0-15)
|
||||
*current_config = (*current_config & 0xF0FFFFFF) | ((value & 0x0F) << 24);
|
||||
TMC2240_WriteReg(0x10, *current_config);
|
||||
}
|
||||
|
||||
// IHOLDDELAY (Bits 19:16)
|
||||
void TMC2240_SetIHoldDelay(uint8_t value, uint32_t *current_config) {
|
||||
if (value > 15) return;
|
||||
*current_config = (*current_config & 0xFFF0FFFF) | ((value & 0x0F) << 16);
|
||||
TMC2240_WriteReg(0x10, *current_config);
|
||||
}
|
||||
|
||||
// IRUN (Bits 12:8)
|
||||
void TMC2240_SetIRun(uint8_t value, uint32_t *current_config) {
|
||||
if (value > 31) return; // 错误:超出范围(0-31)
|
||||
*current_config = (*current_config & 0xFFFFE0FF) | ((value & 0x1F) << 8);
|
||||
TMC2240_WriteReg(0x10, *current_config);
|
||||
}
|
||||
|
||||
// IHOLD (Bits 4:0)
|
||||
void TMC2240_SetIHold(uint8_t value, uint32_t *current_config) {
|
||||
if (value > 31) return;
|
||||
*current_config = (*current_config & 0xFFFFFFE0) | (value & 0x1F);
|
||||
TMC2240_WriteReg(0x10, *current_config);
|
||||
}
|
||||
|
||||
// CHOPCONF寄存器配置(0x6C)
|
||||
void set_IHOLD_IRUN(uint8_t field_selector, uint8_t param_value, uint32_t *current_config) {
|
||||
switch(field_selector) {
|
||||
case 0x00: // IHOLD (0-31)
|
||||
TMC2240_SetIHold(param_value, current_config);
|
||||
break;
|
||||
case 0x01: // IRUN (0-31)
|
||||
TMC2240_SetIRun(param_value, current_config);
|
||||
break;
|
||||
case 0x02: // IHOLDDELAY (0-15)
|
||||
TMC2240_SetIHoldDelay(param_value, current_config);
|
||||
break;
|
||||
case 0x03: // IRUNDELAY (0-15)
|
||||
TMC2240_SetIRunDelay(param_value, current_config);
|
||||
break;
|
||||
default:
|
||||
// 可添加错误处理(如日志输出)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 设置TOFF(位0-3)
|
||||
void TMC2240_SetTOFF(uint8_t toff_value, uint32_t *chopconf) {
|
||||
if (toff_value > 15) return; // 错误:超出范围
|
||||
*chopconf = (*chopconf & 0xFFFFFFF0) | (toff_value & 0x0F);
|
||||
TMC2240_WriteReg(0x6C, *chopconf);
|
||||
}
|
||||
|
||||
// 设置HSTRT(位4-6)
|
||||
void TMC2240_SetHSTRT(uint8_t hstrt_value, uint32_t *chopconf) {
|
||||
if (hstrt_value > 7) return; // 错误:超出范围
|
||||
*chopconf = (*chopconf & 0xFFFFF8FF) | ((hstrt_value & 0x07) << 4);
|
||||
TMC2240_WriteReg(0x6C, *chopconf);
|
||||
}
|
||||
|
||||
// 设置HEND(位7-10)
|
||||
void TMC2240_SetHEND(uint8_t hend_value, uint32_t *chopconf) {
|
||||
if (hend_value > 15) return; // 错误:超出范围
|
||||
*chopconf = (*chopconf & 0xFFFFF0FF) | ((hend_value & 0x0F) << 7);
|
||||
TMC2240_WriteReg(0x6C, *chopconf);
|
||||
}
|
||||
|
||||
// 设置FD3(位11)
|
||||
void TMC2240_SetFD3(uint8_t enable, uint32_t *chopconf) {
|
||||
enable = (enable != 0) ? 1 : 0; // 强制转换为0或1
|
||||
*chopconf = (*chopconf & 0xFFFFF7FF) | (enable << 11);
|
||||
TMC2240_WriteReg(0x6C, *chopconf);
|
||||
}
|
||||
|
||||
// 设置DISFDCC(位12)
|
||||
void TMC2240_SetDISFDCC(uint8_t enable, uint32_t *chopconf) {
|
||||
enable = (enable != 0) ? 1 : 0;
|
||||
*chopconf = (*chopconf & 0xFFFFEFFF) | (enable << 12);
|
||||
TMC2240_WriteReg(0x6C, *chopconf);
|
||||
}
|
||||
|
||||
// 设置RNDTF(位13)
|
||||
void TMC2240_SetRNDTF(uint8_t enable, uint32_t *chopconf) {
|
||||
enable = (enable != 0) ? 1 : 0;
|
||||
*chopconf = (*chopconf & 0xFFFFDFFF) | (enable << 13);
|
||||
TMC2240_WriteReg(0x6C, *chopconf);
|
||||
}
|
||||
|
||||
// 设置CHM模式(位14)
|
||||
void TMC2240_SetCHM(uint8_t enable, uint32_t *chopconf) {
|
||||
enable = (enable != 0) ? 1 : 0;
|
||||
*chopconf = (*chopconf & 0xFFFFBFFF) | (enable << 14);
|
||||
TMC2240_WriteReg(0x6C, *chopconf);
|
||||
}
|
||||
|
||||
// 设置TBL(位15-16)
|
||||
void TMC2240_SetTBL(uint8_t tbl_value, uint32_t *chopconf) {
|
||||
if (tbl_value > 3) return; // 错误:超出范围
|
||||
*chopconf = (*chopconf & 0xFFF9FFFF) | ((tbl_value & 0x03) << 15);
|
||||
TMC2240_WriteReg(0x6C, *chopconf);
|
||||
}
|
||||
|
||||
// 设置VHIGHFS(位18)
|
||||
void TMC2240_SetVHIGHFS(uint8_t enable, uint32_t *chopconf) {
|
||||
enable = (enable != 0) ? 1 : 0;
|
||||
*chopconf = (*chopconf & 0xFFFBFFFF) | (enable << 18);
|
||||
TMC2240_WriteReg(0x6C, *chopconf);
|
||||
}
|
||||
|
||||
// 设置VHIGHCHM(位19)
|
||||
void TMC2240_SetVHIGHCHM(uint8_t enable, uint32_t *chopconf) {
|
||||
enable = (enable != 0) ? 1 : 0;
|
||||
*chopconf = (*chopconf & 0xFFF7FFFF) | (enable << 19);
|
||||
TMC2240_WriteReg(0x6C, *chopconf);
|
||||
}
|
||||
|
||||
// 设置TPFD(位20-23)
|
||||
void TMC2240_SetTPFD(uint8_t tpfd_value, uint32_t *chopconf) {
|
||||
if (tpfd_value > 15) return; // 错误:超出范围
|
||||
*chopconf = (*chopconf & 0xFF0FFFFF) | ((tpfd_value & 0x0F) << 20);
|
||||
TMC2240_WriteReg(0x6C, *chopconf);
|
||||
}
|
||||
|
||||
// 设置MRES(位24-27)
|
||||
void TMC2240_SetMRES(uint8_t mres_value, uint32_t *chopconf) {
|
||||
if (mres_value > 15) return; // 错误:超出范围
|
||||
*chopconf = (*chopconf & 0xF0FFFFFF) | ((mres_value & 0x0F) << 24);
|
||||
TMC2240_WriteReg(0x6C, *chopconf);
|
||||
}
|
||||
|
||||
void set_CHOPCONF(uint8_t field_selector, uint8_t param_value, uint32_t *chopconf) {
|
||||
switch(field_selector) {
|
||||
case 0x00: TMC2240_SetTOFF(param_value, chopconf); break; // Bits 0-3
|
||||
case 0x01: TMC2240_SetHSTRT(param_value, chopconf); break; // Bits 4-6
|
||||
case 0x02: TMC2240_SetHEND(param_value, chopconf); break; // Bits 7-10
|
||||
case 0x03: TMC2240_SetFD3(param_value, chopconf); break; // Bit 11
|
||||
case 0x04: TMC2240_SetDISFDCC(param_value, chopconf); break; // Bit 12
|
||||
case 0x05: TMC2240_SetRNDTF(param_value, chopconf); break; // Bit 13
|
||||
case 0x06: TMC2240_SetCHM(param_value, chopconf); break; // Bit 14
|
||||
case 0x07: TMC2240_SetTBL(param_value, chopconf); break; // Bits 15-16
|
||||
case 0x08: TMC2240_SetVHIGHFS(param_value, chopconf); break; // Bit 18
|
||||
case 0x09: TMC2240_SetVHIGHCHM(param_value, chopconf); break; // Bit 19
|
||||
case 0x0A: TMC2240_SetTPFD(param_value, chopconf); break; // Bits 20-23
|
||||
case 0x0B: TMC2240_SetMRES(param_value, chopconf); break; // Bits 24-27
|
||||
default:
|
||||
lcd_key |= 0x80000000; // 假设最高位用作错误标志
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// sfilt (Bit 24)
|
||||
void TMC2240_SetSFilt(uint8_t value, uint32_t *coolstep_config) {
|
||||
if (value > 1) return; // 允许值0或1
|
||||
*coolstep_config = (*coolstep_config & ~(1 << 24)) | ((value & 0x01) << 24);
|
||||
TMC2240_WriteReg(0x6D, *coolstep_config);
|
||||
}
|
||||
|
||||
// sgt (Bits 22:16) 有符号整数范围 -64~63
|
||||
void TMC2240_SetSGT(int8_t value, uint32_t *coolstep_config) {
|
||||
if (value < -64 || value > 63) return; // 错误:超出范围
|
||||
*coolstep_config = (*coolstep_config & ~(0x7F << 16)) | ((value & 0x7F) << 16);
|
||||
TMC2240_WriteReg(0x6D, *coolstep_config);
|
||||
}
|
||||
|
||||
// seimin (Bit 15)
|
||||
void TMC2240_SetSEIMin(uint8_t value, uint32_t *coolstep_config) {
|
||||
if (value > 1) return;
|
||||
*coolstep_config = (*coolstep_config & ~(1 << 15)) | ((value & 0x01) << 15);
|
||||
TMC2240_WriteReg(0x6D, *coolstep_config);
|
||||
}
|
||||
|
||||
// sedn (Bits 14:13)
|
||||
void TMC2240_SetSEDN(uint8_t value, uint32_t *coolstep_config) {
|
||||
if (value > 3) return; // 允许值0~3
|
||||
*coolstep_config = (*coolstep_config & ~(0x03 << 13)) | ((value & 0x03) << 13);
|
||||
TMC2240_WriteReg(0x6D, *coolstep_config);
|
||||
}
|
||||
|
||||
// semax (Bits 11:8)
|
||||
void TMC2240_SetSEMax(uint8_t value, uint32_t *coolstep_config) {
|
||||
if (value > 15) return; // 允许值0~15
|
||||
*coolstep_config = (*coolstep_config & ~(0x0F << 8)) | ((value & 0x0F) << 8);
|
||||
TMC2240_WriteReg(0x6D, *coolstep_config);
|
||||
}
|
||||
|
||||
// seup (Bits 6:5)
|
||||
void TMC2240_SetSEUp(uint8_t value, uint32_t *coolstep_config) {
|
||||
if (value > 3) return; // 允许值0~3
|
||||
*coolstep_config = (*coolstep_config & ~(0x03 << 5)) | ((value & 0x03) << 5);
|
||||
TMC2240_WriteReg(0x6D, *coolstep_config);
|
||||
}
|
||||
|
||||
// semin (Bits 3:0)
|
||||
void TMC2240_SetSEMin(uint8_t value, uint32_t *coolstep_config) {
|
||||
if (value > 15) return; // 允许值0~15
|
||||
*coolstep_config = (*coolstep_config & ~0x0F) | (value & 0x0F);
|
||||
TMC2240_WriteReg(0x6D, *coolstep_config);
|
||||
}
|
||||
|
||||
// COOLCONF寄存器配置函数
|
||||
void set_COOLCONF(uint8_t field_selector, uint8_t param_value, uint32_t *coolstep_config) {
|
||||
switch(field_selector) {
|
||||
case 0x00: TMC2240_SetSEMin(param_value, coolstep_config); break;
|
||||
case 0x01: TMC2240_SetSEUp(param_value, coolstep_config); break;
|
||||
case 0x02: TMC2240_SetSEMax(param_value, coolstep_config); break;
|
||||
case 0x03: TMC2240_SetSEDN(param_value, coolstep_config); break;
|
||||
case 0x04: TMC2240_SetSEIMin(param_value, coolstep_config); break;
|
||||
case 0x05: TMC2240_SetSGT((int8_t)param_value, coolstep_config); break;
|
||||
case 0x06: TMC2240_SetSFilt(param_value, coolstep_config); break;
|
||||
default:
|
||||
// 可添加错误处理(如日志输出)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//---- 左右平移电机电机参数配置
|
||||
// 0x00 GCONF 参数配置
|
||||
uint32_t mobile_gconf = 0x000000C4 | (1 << 7);
|
||||
// 全局变量声明
|
||||
uint32_t mobile_current_config = 0x00180C10; // 地址 0x10 的寄存器值
|
||||
// CHOPCONF寄存器配置(地址0x6C)
|
||||
uint32_t mobile_chopconf = 0x020080C3;
|
||||
// 全局变量声明
|
||||
uint32_t mobile_coolstep_config = 0; // 地址 0x6D 的寄存器值
|
||||
//---- 旋转采集电机参数配置
|
||||
// 0x00 GCONF 参数配置
|
||||
uint32_t rotating_gconf = 0x000000C4 | (1 << 7);
|
||||
// 全局变量声明
|
||||
uint32_t rotating_current_config = 0x00180C10; // 地址 0x10 的寄存器值
|
||||
// CHOPCONF寄存器配置(地址0x6C)
|
||||
uint32_t rotating_chopconf = 0x020080C3;
|
||||
// 全局变量声明
|
||||
uint32_t rotating_coolstep_config = 0; // 地址 0x6D 的寄存器值
|
||||
|
||||
void motor_left(){
|
||||
delay_us(500);
|
||||
MOVE_THE_MOTOR_TO_THE_LEFT;
|
||||
TMC2240_SetMRES(6, &mobile_gconf);
|
||||
motor_move = MOVE_LEFT;
|
||||
//TMC2240_WriteReg(0x10, 0x00180C10);
|
||||
}
|
||||
void motor_right(){
|
||||
delay_us(500);
|
||||
MOVE_THE_MOTOR_TO_THE_RIGHT;
|
||||
TMC2240_SetMRES(6, &mobile_gconf);
|
||||
motor_move = MOVE_RIGHT;
|
||||
//TMC2240_WriteReg(0x10, 0x00180C10);
|
||||
}
|
||||
#if 0
|
||||
//---- 左右平移电机电机参数配置
|
||||
// 0x00 GCONF 参数配置
|
||||
uint32_t mobile_gconf = 0x000000C4 | (1 << 7);
|
||||
// 全局变量声明
|
||||
uint32_t mobile_current_config = 0x00180C10; // 地址 0x10 的寄存器值
|
||||
// CHOPCONF寄存器配置(地址0x6C)
|
||||
uint32_t mobile_chopconf = 0x020080C3;
|
||||
// 全局变量声明
|
||||
uint32_t mobile_coolstep_config = 0; // 地址 0x6D 的寄存器值
|
||||
//---- 旋转采集电机参数配置
|
||||
// 0x00 GCONF 参数配置
|
||||
uint32_t rotating_gconf = 0x000000C4 | (1 << 7);
|
||||
// 全局变量声明
|
||||
uint32_t rotating_current_config = 0x00180C10; // 地址 0x10 的寄存器值
|
||||
// CHOPCONF寄存器配置(地址0x6C)
|
||||
uint32_t rotating_chopconf = 0x020080C3;
|
||||
// 全局变量声明
|
||||
uint32_t rotating_coolstep_config = 0; // 地址 0x6D 的寄存器值
|
||||
|
||||
extern uint16_t Rotation_times;
|
||||
char rotatingbit = 0;
|
||||
void change_spi(char *str){
|
||||
|
||||
uint8_t stepselete = str[0];
|
||||
uint8_t reg_addr = str[1];
|
||||
uint8_t field_selector = str[2];
|
||||
uint16_t param_value = str[3] ; // 合并高/低字节
|
||||
if(stepselete == 1){
|
||||
mobile_configure = 1; //配置参数结束
|
||||
step = 1;
|
||||
switch(reg_addr) {
|
||||
case 0x00: // 用于全局状态监控和故障诊断。
|
||||
set_CHOPCONF(field_selector, param_value,&mobile_gconf);
|
||||
break;
|
||||
case 0x10: // 用于动态调节电机电流以优化能耗和性能
|
||||
set_IHOLD_IRUN(field_selector, param_value,&mobile_current_config);
|
||||
break;
|
||||
|
||||
case 0x6C: // 用于配置静音、高效或高动态的驱动模式。
|
||||
set_CHOPCONF(field_selector, param_value,&mobile_chopconf);
|
||||
break;
|
||||
|
||||
case 0x0D: // 提供实时状态反馈,支持负载检测和温度保护。
|
||||
set_COOLCONF(field_selector, param_value,&mobile_coolstep_config);
|
||||
break;
|
||||
case 0x01: // 正转 反转
|
||||
if(param_value == 1) GPIO_SetBits(GPIOD,GPIO_Pin_8);
|
||||
else GPIO_ResetBits(GPIOD,GPIO_Pin_8);
|
||||
break;
|
||||
case 0xFF: // 电机是否启动
|
||||
if_mobilemotor_rotate = param_value;
|
||||
break;
|
||||
case 0xF1: // 设置电机旋转圈数
|
||||
pro_stage = CLOESE_THE_LID;
|
||||
rot_stage = GIVE_CHANGE;
|
||||
rotatingbit = GPIO_ReadInputDataBit(GPIOA, GPIO_Pin_15);
|
||||
ProcessControl();
|
||||
OPENMOTOR;
|
||||
break;
|
||||
default:
|
||||
// 可添加错误处理(如日志输出)
|
||||
break;
|
||||
}
|
||||
mobile_configure = 0; //配置参数结束
|
||||
}
|
||||
else{
|
||||
switch(reg_addr) {
|
||||
rotating_configure = 1; //配置参数结束
|
||||
step = 2;
|
||||
case 0x00: // 用于全局状态监控和故障诊断。
|
||||
set_CHOPCONF(field_selector, param_value,&rotating_gconf);
|
||||
break;
|
||||
case 0x10: // 用于动态调节电机电流以优化能耗和性能
|
||||
set_IHOLD_IRUN(field_selector, param_value,&rotating_current_config);
|
||||
break;
|
||||
|
||||
case 0x6C: // 用于配置静音、高效或高动态的驱动模式。
|
||||
set_CHOPCONF(field_selector, param_value,&rotating_chopconf);
|
||||
break;
|
||||
|
||||
case 0x0D: // 提供实时状态反馈,支持负载检测和温度保护。
|
||||
set_COOLCONF(field_selector, param_value,&rotating_coolstep_config);
|
||||
break;
|
||||
case 0x01: // 正转 反转
|
||||
if(param_value == 1) GPIO_SetBits(GPIOB,GPIO_Pin_14);
|
||||
else GPIO_ResetBits(GPIOB,GPIO_Pin_14);
|
||||
break;
|
||||
case 0xFF: // 电机是否启动
|
||||
if_rotatingmotor_rotate = param_value;
|
||||
break;
|
||||
case 0xF0: // 设置电机旋转圈数
|
||||
Rotation_times = param_value*100;
|
||||
break;
|
||||
|
||||
default:
|
||||
// 可添加错误处理(如日志输出)
|
||||
break;
|
||||
}
|
||||
rotating_configure = 0; //配置参数结束
|
||||
}
|
||||
}
|
||||
extern volatile uint32_t pulse_count;
|
||||
// 电机移动
|
||||
//void motor_move(){
|
||||
// step = 1;
|
||||
// GPIO_SetBits(GPIOD,GPIO_Pin_9);
|
||||
// delay_us(50);
|
||||
// GPIO_ResetBits(GPIOD,GPIO_Pin_9);
|
||||
// Rotation_quantity++;
|
||||
// if(Rotation_quantity == 1500){
|
||||
// delay_us(100);
|
||||
// // TMC2240_WriteReg(0x10, 0x00190C10);
|
||||
// TMC2240_SetMRES(7, &mobile_gconf);
|
||||
// }
|
||||
//
|
||||
//}
|
||||
void accelerate(){
|
||||
step = 1;
|
||||
if(pulse_count == 1600){
|
||||
TMC2240_SetMRES(7, &mobile_gconf);
|
||||
}
|
||||
}
|
||||
void motor_left(){
|
||||
delay_us(500);
|
||||
MOVE_THE_MOTOR_TO_THE_LEFT;
|
||||
TMC2240_SetMRES(6, &mobile_gconf);
|
||||
motor_move = MOVE_LEFT;
|
||||
//TMC2240_WriteReg(0x10, 0x00180C10);
|
||||
pulse_count = 0;
|
||||
}
|
||||
void motor_right(){
|
||||
delay_us(500);
|
||||
MOVE_THE_MOTOR_TO_THE_RIGHT;
|
||||
TMC2240_SetMRES(6, &mobile_gconf);
|
||||
motor_move = MOVE_RIGHT;
|
||||
//TMC2240_WriteReg(0x10, 0x00180C10);
|
||||
pulse_count = 0;
|
||||
}
|
||||
uint16_t rotating_rotation_times = 0; // 旋转采集电机需要旋转的圈数
|
||||
char number_of_detection_cycles = 0;
|
||||
// 清除线位
|
||||
|
||||
extern char right_limit; // 到达右线位
|
||||
extern char left_limit; // 到达左线位
|
||||
extern char mid_limit; // 到达左线位
|
||||
void clean_limit(void){
|
||||
right_limit = 0;
|
||||
left_limit = 0;
|
||||
mid_limit = 0;
|
||||
}
|
||||
// 左右平移电机电机流程控制函数
|
||||
void ProcessControl(void){
|
||||
step = 1;
|
||||
switch(pro_stage){
|
||||
case CHANGE_STAGE_TO_RIGHT_LIMIT_POSITION: // 找零阶段
|
||||
// 向右
|
||||
motor_right();
|
||||
OPENMOTOR;
|
||||
break;
|
||||
case CHANGE_STAGE_TO_LEFT_LIMIT_POSITION: // 找零阶段
|
||||
motor_left();
|
||||
break;
|
||||
case CLOESE_THE_LID: // 关盖阶段 左移压紧
|
||||
motor_left();
|
||||
break;
|
||||
case FIND_THE_RIGHT_LIMIT_POSITION: // 找右线位阶段
|
||||
motor_right();
|
||||
/////--------------------还需要开启等光 待完善
|
||||
break;
|
||||
case TESTING_SAMPLES: // 检测阶段
|
||||
rotating_rotation_times = 1600;
|
||||
number_of_detection_cycles = 0;
|
||||
motor_left();
|
||||
break;
|
||||
case FIND_THE_LEFT_LIMIT_POSITION: //找左线位阶段
|
||||
rotating_rotation_times = 1600; // 因为绿色在上时 就是处于0点位置 防止出现校准问题 转开他
|
||||
motor_left();
|
||||
break;
|
||||
case FAILD_FIND:
|
||||
motor_left();
|
||||
break;
|
||||
}
|
||||
}
|
||||
extern u8 if_read7683;
|
||||
void detection_steps(){
|
||||
step = 1;
|
||||
static u32 steps = 0;
|
||||
static char needstep = 0; //记录上一次是否路过左线位 0为向左的阶段 1为向右的阶段
|
||||
if(motor_move == MOVE_LEFT){
|
||||
if((steps == 0) && (mid_limit == 1)){
|
||||
clean_limit();
|
||||
steps = 3000;
|
||||
}
|
||||
else if(steps > 0){
|
||||
steps --;
|
||||
if(steps <= 0){
|
||||
motor_right();
|
||||
}
|
||||
}
|
||||
if(pulse_count > START_THE_BLACK_LIGHT){
|
||||
if_read7683 = 1;
|
||||
}
|
||||
}
|
||||
else{
|
||||
// 右移 到达右限位
|
||||
if(right_limit == 1)
|
||||
{
|
||||
motor_left();
|
||||
clean_limit();
|
||||
number_of_detection_cycles++;
|
||||
if(number_of_detection_cycles >= 8){ //完成8次检测
|
||||
pro_stage = FIND_THE_LEFT_LIMIT_POSITION;
|
||||
ProcessControl();
|
||||
number_of_detection_cycles = 0;
|
||||
}
|
||||
}
|
||||
if(pulse_count > END_THE_BLACK_LIGHT){
|
||||
if_read7683 = 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 大电机运动
|
||||
void motor_motion(void){
|
||||
step = 1;
|
||||
switch(pro_stage){
|
||||
case CHANGE_STAGE_TO_RIGHT_LIMIT_POSITION:
|
||||
if(right_limit == 1){
|
||||
pro_stage = CHANGE_STAGE_TO_LEFT_LIMIT_POSITION; //进入下个阶段 向左移动
|
||||
ProcessControl();
|
||||
clean_limit();
|
||||
}
|
||||
break;
|
||||
case CHANGE_STAGE_TO_LEFT_LIMIT_POSITION: // 找零阶段
|
||||
if(left_limit == 1){ //找零阶段结束
|
||||
clean_limit();
|
||||
pro_stage = MOTOR_STOP;
|
||||
CLOSEMOTOR;
|
||||
pulse_count = 0;
|
||||
}
|
||||
break;
|
||||
case CLOESE_THE_LID: // 关盖阶段 左移压紧
|
||||
if(800 <= pulse_count){
|
||||
// 停止左移 进入下一个步骤
|
||||
pro_stage = FIND_THE_RIGHT_LIMIT_POSITION;
|
||||
ProcessControl();
|
||||
}
|
||||
break;
|
||||
case FIND_THE_RIGHT_LIMIT_POSITION: // 找右线位阶段
|
||||
if(rot_stage == RO_MOTOR_STOP){
|
||||
rot_stage = FIND_READ_FROM_CHANGE;
|
||||
rotating_rotation_times = 4800; // 1600 转90度 目的时为了找红色
|
||||
}
|
||||
if((rot_stage != FIND_READ_FROM_CHANGE)||(rotating_rotation_times !=0))
|
||||
{
|
||||
pulse_count = 1498;
|
||||
}
|
||||
if(right_limit == 1){
|
||||
pro_stage = TESTING_SAMPLES; //进入下个阶段 向左移动
|
||||
ProcessControl();
|
||||
clean_limit();
|
||||
}
|
||||
if(pulse_count > INFRARED_STARTING_POINT && pulse_count < INFRARED_ENDING_POINT) // 进行AD采集
|
||||
if_read7683 = 1;
|
||||
else if_read7683 = 2;
|
||||
break;
|
||||
case TESTING_SAMPLES: // 检测阶段
|
||||
detection_steps();
|
||||
///----采集dac数据 待完善
|
||||
break;
|
||||
case FIND_THE_LEFT_LIMIT_POSITION: //找左线位阶段
|
||||
if(left_limit == 1){ //找零阶段结束
|
||||
clean_limit();
|
||||
pro_stage = MOTOR_STOP;
|
||||
CLOSEMOTOR;
|
||||
pulse_count =0;
|
||||
////---- 是否需要关闭相应的灯光
|
||||
}
|
||||
break;
|
||||
case FAILD_FIND:
|
||||
if(left_limit == 1){ //找零阶段结束
|
||||
clean_limit();
|
||||
pro_stage = MOTOR_STOP;
|
||||
///--- 弹出错误预警
|
||||
}
|
||||
break;
|
||||
case MOTOR_STOP:
|
||||
break;
|
||||
};
|
||||
}
|
||||
// 电机旋转
|
||||
void rotating_move(){
|
||||
GPIO_SetBits(GPIOB,GPIO_Pin_15);
|
||||
delay_us(100);
|
||||
GPIO_ResetBits(GPIOB,GPIO_Pin_15);
|
||||
}
|
||||
// 小电机运动
|
||||
void motor_rotating(void){
|
||||
switch(rot_stage){
|
||||
case ROTATE:
|
||||
if(rotating_rotation_times <= 0){
|
||||
rot_stage = RO_MOTOR_STOP;
|
||||
}
|
||||
rotating_move();
|
||||
rotating_rotation_times--;
|
||||
break;
|
||||
case RO_MOTOR_STOP:
|
||||
break;
|
||||
case GIVE_CHANGE:
|
||||
if(rotatingbit == 0){ // 在0点上 需要进行移动
|
||||
rotatingbit = 1;
|
||||
rotating_rotation_times = 1600;
|
||||
}
|
||||
if(rotating_rotation_times > 0){
|
||||
rotating_rotation_times--;
|
||||
rotating_move();
|
||||
}
|
||||
else{
|
||||
rotating_move();
|
||||
if(GPIO_ReadInputDataBit(GPIOA, GPIO_Pin_15) == 0){
|
||||
rot_stage = ROTATE;
|
||||
rotating_rotation_times = 200;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case FIND_READ_FROM_CHANGE:
|
||||
if(rotating_rotation_times > 0){
|
||||
rotating_move();
|
||||
rotating_rotation_times--;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
#ifndef __ELEMACHINERY_H
|
||||
#define __ELEMACHINERY_H
|
||||
//#include "spi.h"
|
||||
#include <stdint.h>
|
||||
#include "sys.h"
|
||||
|
||||
#define MOVE_THE_MOTOR_TO_THE_LEFT GPIO_SetBits(GPIOD, GPIO_Pin_3); //电机向左移动
|
||||
#define MOVE_THE_MOTOR_TO_THE_RIGHT GPIO_ResetBits(GPIOD, GPIO_Pin_3); // 电机向右移动
|
||||
|
||||
#define INFRARED_STARTING_POINT 0x08D3
|
||||
#define INFRARED_ENDING_POINT 0x242E
|
||||
|
||||
#define START_THE_BLACK_LIGHT 0x0EB0
|
||||
#define END_THE_BLACK_LIGHT 0x2273
|
||||
|
||||
|
||||
|
||||
void change_spi(char *str);
|
||||
void tmc2240_write(uint8_t address, uint8_t data);
|
||||
void TMC2240_WriteReg(uint8_t addr, uint32_t data);
|
||||
void ProcessControl(void);
|
||||
void motor_motion(void);
|
||||
uint32_t TMC2240_ReadReg(uint8_t addr);
|
||||
void motor_rotating(void);
|
||||
void accelerate();
|
||||
void clean_limit(void);
|
||||
#endif
|
||||
BIN
OBJ/USART.axf
BIN
OBJ/USART.axf
Binary file not shown.
|
|
@ -3,62 +3,51 @@
|
|||
<pre>
|
||||
<h1>µVision Build Log</h1>
|
||||
<h2>Tool Versions:</h2>
|
||||
IDE-Version: μVision V5.38.0.0
|
||||
Copyright (C) 2022 ARM Ltd and ARM Germany GmbH. All rights reserved.
|
||||
License Information: baibaila3 baibaila3@163.com, keil, LIC=47GU5-GE5WI-JJF6S-L5PAY-BRK7N-23XAJ
|
||||
IDE-Version: ¦ÌVision V5.25.3.0
|
||||
Copyright (C) 2018 ARM Ltd and ARM Germany GmbH. All rights reserved.
|
||||
License Information: cgy cgy, cgy, LIC=CRMFW-QWL2E-RC0JZ-J6WMG-6WJZU-2F249
|
||||
|
||||
Tool Versions:
|
||||
Toolchain: MDK-ARM Plus Version: 5.22
|
||||
Toolchain: MDK-ARM Professional Version: 5.15.0
|
||||
Toolchain Path: C:\Keil_v5\ARM\ARMCC\Bin
|
||||
C Compiler: Armcc.exe V5.06 update 4 (build 422)
|
||||
Assembler: Armasm.exe V5.06 update 4 (build 422)
|
||||
Linker/Locator: ArmLink.exe V5.06 update 4 (build 422)
|
||||
Library Manager: ArmAr.exe V5.06 update 4 (build 422)
|
||||
Hex Converter: FromElf.exe V5.06 update 4 (build 422)
|
||||
CPU DLL: SARMCM3.DLL V5.22
|
||||
Dialog DLL: DCM.DLL V1.13.9.0
|
||||
Target DLL: STLink\ST-LINKIII-KEIL_SWO.dll V2.0.18.0
|
||||
Dialog DLL: TCM.DLL V1.21.0.0
|
||||
C Compiler: Armcc.exe V5.05 update 2 (build 169)
|
||||
Assembler: Armasm.exe V5.05 update 2 (build 169)
|
||||
Linker/Locator: ArmLink.exe V5.05 update 2 (build 169)
|
||||
Library Manager: ArmAr.exe V5.05 update 2 (build 169)
|
||||
Hex Converter: FromElf.exe V5.05 update 2 (build 169)
|
||||
CPU DLL: SARMCM3.DLL V5.15.0
|
||||
Dialog DLL: DCM.DLL V1.13.2.0
|
||||
Target DLL: STLink\ST-LINKIII-KEIL_SWO.dll V2.0.15.0_KEIL
|
||||
Dialog DLL: TCM.DLL V1.14.5.0
|
||||
|
||||
<h2>Project:</h2>
|
||||
C:\Users\baiba\Downloads\c0d15-main\c0d15-main\标准例程-库函数版本\2,标准例程-库函数版本\实验4 串口实验\USER\USART.uvprojx
|
||||
Project File Date: 02/08/2026
|
||||
D:\fighterteam\project\gu\make\code\sensor_2026\sensor_2026\USER\USART.uvprojx
|
||||
Project File Date: 02/09/2026
|
||||
|
||||
<h2>Output:</h2>
|
||||
*** Using Compiler 'V5.06 update 4 (build 422)', folder: 'C:\Keil_v5\ARM\ARMCC\Bin'
|
||||
*** Using Compiler 'V5.05 update 2 (build 169)', folder: 'C:\Keil_v5\ARM\ARMCC\Bin'
|
||||
Build target 'USART'
|
||||
assembling startup_stm32f40_41xxx.s...
|
||||
compiling stm32f4xx_usart.c...
|
||||
compiling delay.c...
|
||||
compiling misc.c...
|
||||
compiling stm32f4xx_rcc.c...
|
||||
compiling beep.c...
|
||||
compiling main.c...
|
||||
compiling system_stm32f4xx.c...
|
||||
compiling stm32f4xx_it.c...
|
||||
compiling sys.c...
|
||||
compiling led.c...
|
||||
compiling key.c...
|
||||
compiling stm32f4xx_syscfg.c...
|
||||
compiling stm32f4xx_gpio.c...
|
||||
compiling usart.c...
|
||||
compiling stm32f4xx_adc.c...
|
||||
compiling stm32f4xx_spi.c...
|
||||
compiling stm32f4xx_tim.c...
|
||||
linking...
|
||||
Program Size: Code=2932 RO-data=424 RW-data=28 ZI-data=1836
|
||||
Program Size: Code=2844 RO-data=424 RW-data=32 ZI-data=1832
|
||||
FromELF: creating hex file...
|
||||
"..\OBJ\USART.axf" - 0 Error(s), 0 Warning(s).
|
||||
|
||||
<h2>Software Packages used:</h2>
|
||||
|
||||
Package Vendor: Keil
|
||||
http://www.keil.com/pack/Keil.STM32F4xx_DFP.2.11.0.pack
|
||||
Keil.STM32F4xx_DFP.2.11.0
|
||||
http://www.keil.com/pack/Keil.STM32F4xx_DFP.2.14.0.pack
|
||||
Keil.STM32F4xx_DFP.2.14.0
|
||||
STMicroelectronics STM32F4 Series Device Support, Drivers and Examples
|
||||
|
||||
<h2>Collection of Component include folders:</h2>
|
||||
C:/Keil_v5/ARM/PACK/Keil/STM32F4xx_DFP/2.11.0/Drivers/CMSIS/Device/ST/STM32F4xx/Include
|
||||
.\RTE\_USART
|
||||
C:\Keil_v5\ARM\PACK\Keil\STM32F4xx_DFP\2.14.0\Drivers\CMSIS\Device\ST\STM32F4xx\Include
|
||||
|
||||
<h2>Collection of Component Files used:</h2>
|
||||
Build Time Elapsed: 00:00:03
|
||||
Build Time Elapsed: 00:00:02
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
254
OBJ/USART.htm
254
OBJ/USART.htm
|
|
@ -3,7 +3,7 @@
|
|||
<title>Static Call Graph - [..\OBJ\USART.axf]</title></head>
|
||||
<body><HR>
|
||||
<H1>Static Call Graph for image ..\OBJ\USART.axf</H1><HR>
|
||||
<BR><P>#<CALLGRAPH># ARM Linker, 5060422: Last Updated: Sun Feb 08 17:42:53 2026
|
||||
<BR><P>#<CALLGRAPH># ARM Linker, 5050169: Last Updated: Mon Feb 09 11:13:49 2026
|
||||
<BR><P>
|
||||
<H3>Maximum Stack Usage = 128 bytes + Unknown(Functions without stacksize, Cycles, Untraceable Function Pointers)</H3><H3>
|
||||
Call chain for Maximum Stack Depth:</H3>
|
||||
|
|
@ -99,8 +99,8 @@ Function Pointers
|
|||
<LI><a href="#[27]">TIM1_CC_IRQHandler</a> from startup_stm32f40_41xxx.o(.text) referenced from startup_stm32f40_41xxx.o(RESET)
|
||||
<LI><a href="#[26]">TIM1_TRG_COM_TIM11_IRQHandler</a> from startup_stm32f40_41xxx.o(.text) referenced from startup_stm32f40_41xxx.o(RESET)
|
||||
<LI><a href="#[25]">TIM1_UP_TIM10_IRQHandler</a> from startup_stm32f40_41xxx.o(.text) referenced from startup_stm32f40_41xxx.o(RESET)
|
||||
<LI><a href="#[28]">TIM2_IRQHandler</a> from startup_stm32f40_41xxx.o(.text) referenced from startup_stm32f40_41xxx.o(RESET)
|
||||
<LI><a href="#[29]">TIM3_IRQHandler</a> from startup_stm32f40_41xxx.o(.text) referenced from startup_stm32f40_41xxx.o(RESET)
|
||||
<LI><a href="#[28]">TIM2_IRQHandler</a> from timer.o(i.TIM2_IRQHandler) referenced from startup_stm32f40_41xxx.o(RESET)
|
||||
<LI><a href="#[29]">TIM3_IRQHandler</a> from timer.o(i.TIM3_IRQHandler) referenced from startup_stm32f40_41xxx.o(RESET)
|
||||
<LI><a href="#[2a]">TIM4_IRQHandler</a> from startup_stm32f40_41xxx.o(.text) referenced from startup_stm32f40_41xxx.o(RESET)
|
||||
<LI><a href="#[3e]">TIM5_IRQHandler</a> from startup_stm32f40_41xxx.o(.text) referenced from startup_stm32f40_41xxx.o(RESET)
|
||||
<LI><a href="#[42]">TIM6_DAC_IRQHandler</a> from startup_stm32f40_41xxx.o(.text) referenced from startup_stm32f40_41xxx.o(RESET)
|
||||
|
|
@ -109,12 +109,12 @@ Function Pointers
|
|||
<LI><a href="#[3a]">TIM8_CC_IRQHandler</a> from startup_stm32f40_41xxx.o(.text) referenced from startup_stm32f40_41xxx.o(RESET)
|
||||
<LI><a href="#[39]">TIM8_TRG_COM_TIM14_IRQHandler</a> from startup_stm32f40_41xxx.o(.text) referenced from startup_stm32f40_41xxx.o(RESET)
|
||||
<LI><a href="#[38]">TIM8_UP_TIM13_IRQHandler</a> from startup_stm32f40_41xxx.o(.text) referenced from startup_stm32f40_41xxx.o(RESET)
|
||||
<LI><a href="#[40]">UART4_IRQHandler</a> from startup_stm32f40_41xxx.o(.text) referenced from startup_stm32f40_41xxx.o(RESET)
|
||||
<LI><a href="#[41]">UART5_IRQHandler</a> from startup_stm32f40_41xxx.o(.text) referenced from startup_stm32f40_41xxx.o(RESET)
|
||||
<LI><a href="#[40]">UART4_IRQHandler</a> from usart.o(i.UART4_IRQHandler) referenced from startup_stm32f40_41xxx.o(RESET)
|
||||
<LI><a href="#[41]">UART5_IRQHandler</a> from usart.o(i.UART5_IRQHandler) referenced from startup_stm32f40_41xxx.o(RESET)
|
||||
<LI><a href="#[31]">USART1_IRQHandler</a> from usart.o(i.USART1_IRQHandler) referenced from startup_stm32f40_41xxx.o(RESET)
|
||||
<LI><a href="#[32]">USART2_IRQHandler</a> from startup_stm32f40_41xxx.o(.text) referenced from startup_stm32f40_41xxx.o(RESET)
|
||||
<LI><a href="#[33]">USART3_IRQHandler</a> from startup_stm32f40_41xxx.o(.text) referenced from startup_stm32f40_41xxx.o(RESET)
|
||||
<LI><a href="#[53]">USART6_IRQHandler</a> from startup_stm32f40_41xxx.o(.text) referenced from startup_stm32f40_41xxx.o(RESET)
|
||||
<LI><a href="#[32]">USART2_IRQHandler</a> from usart.o(i.USART2_IRQHandler) referenced from startup_stm32f40_41xxx.o(RESET)
|
||||
<LI><a href="#[33]">USART3_IRQHandler</a> from usart.o(i.USART3_IRQHandler) referenced from startup_stm32f40_41xxx.o(RESET)
|
||||
<LI><a href="#[53]">USART6_IRQHandler</a> from usart.o(i.USART6_IRQHandler) referenced from startup_stm32f40_41xxx.o(RESET)
|
||||
<LI><a href="#[7]">UsageFault_Handler</a> from stm32f4xx_it.o(i.UsageFault_Handler) referenced from startup_stm32f40_41xxx.o(RESET)
|
||||
<LI><a href="#[c]">WWDG_IRQHandler</a> from startup_stm32f40_41xxx.o(.text) referenced from startup_stm32f40_41xxx.o(RESET)
|
||||
<LI><a href="#[62]">__main</a> from __main.o(!!!main) referenced from startup_stm32f40_41xxx.o(.text)
|
||||
|
|
@ -126,8 +126,8 @@ Function Pointers
|
|||
Global Symbols
|
||||
</H3>
|
||||
<P><STRONG><a name="[62]"></a>__main</STRONG> (Thumb, 8 bytes, Stack size 0 bytes, __main.o(!!!main))
|
||||
<BR><BR>[Calls]<UL><LI><a href="#[64]">>></a> __rt_entry
|
||||
<LI><a href="#[63]">>></a> __scatterload
|
||||
<BR><BR>[Calls]<UL><LI><a href="#[63]">>></a> __scatterload
|
||||
<LI><a href="#[64]">>></a> __rt_entry
|
||||
</UL>
|
||||
|
||||
<P><STRONG><a name="[63]"></a>__scatterload</STRONG> (Thumb, 0 bytes, Stack size unknown bytes, __scatter.o(!!!scatter))
|
||||
|
|
@ -138,9 +138,9 @@ Global Symbols
|
|||
<BR><BR>[Calls]<UL><LI><a href="#[64]">>></a> __rt_entry
|
||||
</UL>
|
||||
|
||||
<P><STRONG><a name="[92]"></a>__scatterload_rt2_thumb_only</STRONG> (Thumb, 0 bytes, Stack size unknown bytes, __scatter.o(!!!scatter), UNUSED)
|
||||
<P><STRONG><a name="[93]"></a>__scatterload_rt2_thumb_only</STRONG> (Thumb, 0 bytes, Stack size unknown bytes, __scatter.o(!!!scatter), UNUSED)
|
||||
|
||||
<P><STRONG><a name="[93]"></a>__scatterload_null</STRONG> (Thumb, 0 bytes, Stack size unknown bytes, __scatter.o(!!!scatter), UNUSED)
|
||||
<P><STRONG><a name="[94]"></a>__scatterload_null</STRONG> (Thumb, 0 bytes, Stack size unknown bytes, __scatter.o(!!!scatter), UNUSED)
|
||||
|
||||
<P><STRONG><a name="[66]"></a>__scatterload_copy</STRONG> (Thumb, 26 bytes, Stack size unknown bytes, __scatter_copy.o(!!handler_copy), UNUSED)
|
||||
<BR><BR>[Calls]<UL><LI><a href="#[66]">>></a> __scatterload_copy
|
||||
|
|
@ -148,7 +148,7 @@ Global Symbols
|
|||
<BR>[Called By]<UL><LI><a href="#[66]">>></a> __scatterload_copy
|
||||
</UL>
|
||||
|
||||
<P><STRONG><a name="[94]"></a>__scatterload_zeroinit</STRONG> (Thumb, 28 bytes, Stack size unknown bytes, __scatter_zi.o(!!handler_zi), UNUSED)
|
||||
<P><STRONG><a name="[95]"></a>__scatterload_zeroinit</STRONG> (Thumb, 28 bytes, Stack size unknown bytes, __scatter_zi.o(!!handler_zi), UNUSED)
|
||||
|
||||
<P><STRONG><a name="[6c]"></a>__rt_lib_init</STRONG> (Thumb, 0 bytes, Stack size unknown bytes, libinit.o(.ARM.Collect$$libinit$$00000000))
|
||||
<BR><BR>[Called By]<UL><LI><a href="#[6b]">>></a> __rt_entry_li
|
||||
|
|
@ -158,67 +158,65 @@ Global Symbols
|
|||
<BR><BR>[Calls]<UL><LI><a href="#[68]">>></a> _fp_init
|
||||
</UL>
|
||||
|
||||
<P><STRONG><a name="[95]"></a>__rt_lib_init_alloca_1</STRONG> (Thumb, 0 bytes, Stack size unknown bytes, libinit2.o(.ARM.Collect$$libinit$$0000002E))
|
||||
<P><STRONG><a name="[96]"></a>__rt_lib_init_alloca_1</STRONG> (Thumb, 0 bytes, Stack size unknown bytes, libinit2.o(.ARM.Collect$$libinit$$0000002E))
|
||||
|
||||
<P><STRONG><a name="[96]"></a>__rt_lib_init_argv_1</STRONG> (Thumb, 0 bytes, Stack size unknown bytes, libinit2.o(.ARM.Collect$$libinit$$0000002C))
|
||||
<P><STRONG><a name="[97]"></a>__rt_lib_init_argv_1</STRONG> (Thumb, 0 bytes, Stack size unknown bytes, libinit2.o(.ARM.Collect$$libinit$$0000002C))
|
||||
|
||||
<P><STRONG><a name="[97]"></a>__rt_lib_init_atexit_1</STRONG> (Thumb, 0 bytes, Stack size unknown bytes, libinit2.o(.ARM.Collect$$libinit$$0000001B))
|
||||
<P><STRONG><a name="[98]"></a>__rt_lib_init_atexit_1</STRONG> (Thumb, 0 bytes, Stack size unknown bytes, libinit2.o(.ARM.Collect$$libinit$$0000001B))
|
||||
|
||||
<P><STRONG><a name="[98]"></a>__rt_lib_init_clock_1</STRONG> (Thumb, 0 bytes, Stack size unknown bytes, libinit2.o(.ARM.Collect$$libinit$$00000021))
|
||||
<P><STRONG><a name="[99]"></a>__rt_lib_init_clock_1</STRONG> (Thumb, 0 bytes, Stack size unknown bytes, libinit2.o(.ARM.Collect$$libinit$$00000021))
|
||||
|
||||
<P><STRONG><a name="[99]"></a>__rt_lib_init_cpp_1</STRONG> (Thumb, 0 bytes, Stack size unknown bytes, libinit2.o(.ARM.Collect$$libinit$$00000032))
|
||||
<P><STRONG><a name="[9a]"></a>__rt_lib_init_cpp_1</STRONG> (Thumb, 0 bytes, Stack size unknown bytes, libinit2.o(.ARM.Collect$$libinit$$00000032))
|
||||
|
||||
<P><STRONG><a name="[9a]"></a>__rt_lib_init_exceptions_1</STRONG> (Thumb, 0 bytes, Stack size unknown bytes, libinit2.o(.ARM.Collect$$libinit$$00000030))
|
||||
<P><STRONG><a name="[9b]"></a>__rt_lib_init_exceptions_1</STRONG> (Thumb, 0 bytes, Stack size unknown bytes, libinit2.o(.ARM.Collect$$libinit$$00000030))
|
||||
|
||||
<P><STRONG><a name="[9b]"></a>__rt_lib_init_fp_trap_1</STRONG> (Thumb, 0 bytes, Stack size unknown bytes, libinit2.o(.ARM.Collect$$libinit$$0000001F))
|
||||
<P><STRONG><a name="[9c]"></a>__rt_lib_init_fp_trap_1</STRONG> (Thumb, 0 bytes, Stack size unknown bytes, libinit2.o(.ARM.Collect$$libinit$$0000001F))
|
||||
|
||||
<P><STRONG><a name="[9c]"></a>__rt_lib_init_getenv_1</STRONG> (Thumb, 0 bytes, Stack size unknown bytes, libinit2.o(.ARM.Collect$$libinit$$00000023))
|
||||
<P><STRONG><a name="[9d]"></a>__rt_lib_init_getenv_1</STRONG> (Thumb, 0 bytes, Stack size unknown bytes, libinit2.o(.ARM.Collect$$libinit$$00000023))
|
||||
|
||||
<P><STRONG><a name="[9d]"></a>__rt_lib_init_heap_1</STRONG> (Thumb, 0 bytes, Stack size unknown bytes, libinit2.o(.ARM.Collect$$libinit$$0000000A))
|
||||
<P><STRONG><a name="[9e]"></a>__rt_lib_init_heap_1</STRONG> (Thumb, 0 bytes, Stack size unknown bytes, libinit2.o(.ARM.Collect$$libinit$$0000000A))
|
||||
|
||||
<P><STRONG><a name="[9e]"></a>__rt_lib_init_lc_collate_1</STRONG> (Thumb, 0 bytes, Stack size unknown bytes, libinit2.o(.ARM.Collect$$libinit$$00000011))
|
||||
<P><STRONG><a name="[9f]"></a>__rt_lib_init_lc_collate_1</STRONG> (Thumb, 0 bytes, Stack size unknown bytes, libinit2.o(.ARM.Collect$$libinit$$00000011))
|
||||
|
||||
<P><STRONG><a name="[9f]"></a>__rt_lib_init_lc_ctype_1</STRONG> (Thumb, 0 bytes, Stack size unknown bytes, libinit2.o(.ARM.Collect$$libinit$$00000013))
|
||||
<P><STRONG><a name="[a0]"></a>__rt_lib_init_lc_ctype_1</STRONG> (Thumb, 0 bytes, Stack size unknown bytes, libinit2.o(.ARM.Collect$$libinit$$00000013))
|
||||
|
||||
<P><STRONG><a name="[a0]"></a>__rt_lib_init_lc_monetary_1</STRONG> (Thumb, 0 bytes, Stack size unknown bytes, libinit2.o(.ARM.Collect$$libinit$$00000015))
|
||||
<P><STRONG><a name="[a1]"></a>__rt_lib_init_lc_monetary_1</STRONG> (Thumb, 0 bytes, Stack size unknown bytes, libinit2.o(.ARM.Collect$$libinit$$00000015))
|
||||
|
||||
<P><STRONG><a name="[a1]"></a>__rt_lib_init_lc_numeric_1</STRONG> (Thumb, 0 bytes, Stack size unknown bytes, libinit2.o(.ARM.Collect$$libinit$$00000017))
|
||||
<P><STRONG><a name="[a2]"></a>__rt_lib_init_lc_numeric_1</STRONG> (Thumb, 0 bytes, Stack size unknown bytes, libinit2.o(.ARM.Collect$$libinit$$00000017))
|
||||
|
||||
<P><STRONG><a name="[a2]"></a>__rt_lib_init_lc_time_1</STRONG> (Thumb, 0 bytes, Stack size unknown bytes, libinit2.o(.ARM.Collect$$libinit$$00000019))
|
||||
<P><STRONG><a name="[a3]"></a>__rt_lib_init_lc_time_1</STRONG> (Thumb, 0 bytes, Stack size unknown bytes, libinit2.o(.ARM.Collect$$libinit$$00000019))
|
||||
|
||||
<P><STRONG><a name="[a3]"></a>__rt_lib_init_preinit_1</STRONG> (Thumb, 0 bytes, Stack size unknown bytes, libinit2.o(.ARM.Collect$$libinit$$00000004))
|
||||
<P><STRONG><a name="[a4]"></a>__rt_lib_init_preinit_1</STRONG> (Thumb, 0 bytes, Stack size unknown bytes, libinit2.o(.ARM.Collect$$libinit$$00000004))
|
||||
|
||||
<P><STRONG><a name="[a4]"></a>__rt_lib_init_rand_1</STRONG> (Thumb, 0 bytes, Stack size unknown bytes, libinit2.o(.ARM.Collect$$libinit$$0000000E))
|
||||
<P><STRONG><a name="[a5]"></a>__rt_lib_init_rand_1</STRONG> (Thumb, 0 bytes, Stack size unknown bytes, libinit2.o(.ARM.Collect$$libinit$$0000000E))
|
||||
|
||||
<P><STRONG><a name="[a5]"></a>__rt_lib_init_return</STRONG> (Thumb, 0 bytes, Stack size unknown bytes, libinit2.o(.ARM.Collect$$libinit$$00000033))
|
||||
<P><STRONG><a name="[a6]"></a>__rt_lib_init_return</STRONG> (Thumb, 0 bytes, Stack size unknown bytes, libinit2.o(.ARM.Collect$$libinit$$00000033))
|
||||
|
||||
<P><STRONG><a name="[a6]"></a>__rt_lib_init_signal_1</STRONG> (Thumb, 0 bytes, Stack size unknown bytes, libinit2.o(.ARM.Collect$$libinit$$0000001D))
|
||||
<P><STRONG><a name="[a7]"></a>__rt_lib_init_signal_1</STRONG> (Thumb, 0 bytes, Stack size unknown bytes, libinit2.o(.ARM.Collect$$libinit$$0000001D))
|
||||
|
||||
<P><STRONG><a name="[a7]"></a>__rt_lib_init_stdio_1</STRONG> (Thumb, 0 bytes, Stack size unknown bytes, libinit2.o(.ARM.Collect$$libinit$$00000025))
|
||||
<P><STRONG><a name="[a8]"></a>__rt_lib_init_stdio_1</STRONG> (Thumb, 0 bytes, Stack size unknown bytes, libinit2.o(.ARM.Collect$$libinit$$00000025))
|
||||
|
||||
<P><STRONG><a name="[a8]"></a>__rt_lib_init_user_alloc_1</STRONG> (Thumb, 0 bytes, Stack size unknown bytes, libinit2.o(.ARM.Collect$$libinit$$0000000C))
|
||||
<P><STRONG><a name="[a9]"></a>__rt_lib_init_user_alloc_1</STRONG> (Thumb, 0 bytes, Stack size unknown bytes, libinit2.o(.ARM.Collect$$libinit$$0000000C))
|
||||
|
||||
<P><STRONG><a name="[71]"></a>__rt_lib_shutdown</STRONG> (Thumb, 0 bytes, Stack size unknown bytes, libshutdown.o(.ARM.Collect$$libshutdown$$00000000))
|
||||
<BR><BR>[Called By]<UL><LI><a href="#[70]">>></a> __rt_exit_ls
|
||||
</UL>
|
||||
|
||||
<P><STRONG><a name="[a9]"></a>__rt_lib_shutdown_cpp_1</STRONG> (Thumb, 0 bytes, Stack size unknown bytes, libshutdown2.o(.ARM.Collect$$libshutdown$$00000002))
|
||||
<P><STRONG><a name="[aa]"></a>__rt_lib_shutdown_fp_trap_1</STRONG> (Thumb, 0 bytes, Stack size unknown bytes, libshutdown2.o(.ARM.Collect$$libshutdown$$00000006))
|
||||
|
||||
<P><STRONG><a name="[aa]"></a>__rt_lib_shutdown_fp_trap_1</STRONG> (Thumb, 0 bytes, Stack size unknown bytes, libshutdown2.o(.ARM.Collect$$libshutdown$$00000007))
|
||||
<P><STRONG><a name="[ab]"></a>__rt_lib_shutdown_heap_1</STRONG> (Thumb, 0 bytes, Stack size unknown bytes, libshutdown2.o(.ARM.Collect$$libshutdown$$0000000E))
|
||||
|
||||
<P><STRONG><a name="[ab]"></a>__rt_lib_shutdown_heap_1</STRONG> (Thumb, 0 bytes, Stack size unknown bytes, libshutdown2.o(.ARM.Collect$$libshutdown$$0000000F))
|
||||
<P><STRONG><a name="[ac]"></a>__rt_lib_shutdown_return</STRONG> (Thumb, 0 bytes, Stack size unknown bytes, libshutdown2.o(.ARM.Collect$$libshutdown$$0000000F))
|
||||
|
||||
<P><STRONG><a name="[ac]"></a>__rt_lib_shutdown_return</STRONG> (Thumb, 0 bytes, Stack size unknown bytes, libshutdown2.o(.ARM.Collect$$libshutdown$$00000010))
|
||||
<P><STRONG><a name="[ad]"></a>__rt_lib_shutdown_signal_1</STRONG> (Thumb, 0 bytes, Stack size unknown bytes, libshutdown2.o(.ARM.Collect$$libshutdown$$00000009))
|
||||
|
||||
<P><STRONG><a name="[ad]"></a>__rt_lib_shutdown_signal_1</STRONG> (Thumb, 0 bytes, Stack size unknown bytes, libshutdown2.o(.ARM.Collect$$libshutdown$$0000000A))
|
||||
<P><STRONG><a name="[ae]"></a>__rt_lib_shutdown_stdio_1</STRONG> (Thumb, 0 bytes, Stack size unknown bytes, libshutdown2.o(.ARM.Collect$$libshutdown$$00000003))
|
||||
|
||||
<P><STRONG><a name="[ae]"></a>__rt_lib_shutdown_stdio_1</STRONG> (Thumb, 0 bytes, Stack size unknown bytes, libshutdown2.o(.ARM.Collect$$libshutdown$$00000004))
|
||||
|
||||
<P><STRONG><a name="[af]"></a>__rt_lib_shutdown_user_alloc_1</STRONG> (Thumb, 0 bytes, Stack size unknown bytes, libshutdown2.o(.ARM.Collect$$libshutdown$$0000000C))
|
||||
<P><STRONG><a name="[af]"></a>__rt_lib_shutdown_user_alloc_1</STRONG> (Thumb, 0 bytes, Stack size unknown bytes, libshutdown2.o(.ARM.Collect$$libshutdown$$0000000B))
|
||||
|
||||
<P><STRONG><a name="[64]"></a>__rt_entry</STRONG> (Thumb, 0 bytes, Stack size unknown bytes, __rtentry.o(.ARM.Collect$$rtentry$$00000000))
|
||||
<BR><BR>[Called By]<UL><LI><a href="#[62]">>></a> __main
|
||||
<LI><a href="#[65]">>></a> __scatterload_rt2
|
||||
<BR><BR>[Called By]<UL><LI><a href="#[65]">>></a> __scatterload_rt2
|
||||
<LI><a href="#[62]">>></a> __main
|
||||
</UL>
|
||||
|
||||
<P><STRONG><a name="[b0]"></a>__rt_entry_presh_1</STRONG> (Thumb, 0 bytes, Stack size unknown bytes, __rtentry2.o(.ARM.Collect$$rtentry$$00000002))
|
||||
|
|
@ -462,12 +460,6 @@ Global Symbols
|
|||
<P><STRONG><a name="[25]"></a>TIM1_UP_TIM10_IRQHandler</STRONG> (Thumb, 0 bytes, Stack size 0 bytes, startup_stm32f40_41xxx.o(.text))
|
||||
<BR>[Address Reference Count : 1]<UL><LI> startup_stm32f40_41xxx.o(RESET)
|
||||
</UL>
|
||||
<P><STRONG><a name="[28]"></a>TIM2_IRQHandler</STRONG> (Thumb, 0 bytes, Stack size 0 bytes, startup_stm32f40_41xxx.o(.text))
|
||||
<BR>[Address Reference Count : 1]<UL><LI> startup_stm32f40_41xxx.o(RESET)
|
||||
</UL>
|
||||
<P><STRONG><a name="[29]"></a>TIM3_IRQHandler</STRONG> (Thumb, 0 bytes, Stack size 0 bytes, startup_stm32f40_41xxx.o(.text))
|
||||
<BR>[Address Reference Count : 1]<UL><LI> startup_stm32f40_41xxx.o(RESET)
|
||||
</UL>
|
||||
<P><STRONG><a name="[2a]"></a>TIM4_IRQHandler</STRONG> (Thumb, 0 bytes, Stack size 0 bytes, startup_stm32f40_41xxx.o(.text))
|
||||
<BR>[Address Reference Count : 1]<UL><LI> startup_stm32f40_41xxx.o(RESET)
|
||||
</UL>
|
||||
|
|
@ -492,21 +484,6 @@ Global Symbols
|
|||
<P><STRONG><a name="[38]"></a>TIM8_UP_TIM13_IRQHandler</STRONG> (Thumb, 0 bytes, Stack size 0 bytes, startup_stm32f40_41xxx.o(.text))
|
||||
<BR>[Address Reference Count : 1]<UL><LI> startup_stm32f40_41xxx.o(RESET)
|
||||
</UL>
|
||||
<P><STRONG><a name="[40]"></a>UART4_IRQHandler</STRONG> (Thumb, 0 bytes, Stack size 0 bytes, startup_stm32f40_41xxx.o(.text))
|
||||
<BR>[Address Reference Count : 1]<UL><LI> startup_stm32f40_41xxx.o(RESET)
|
||||
</UL>
|
||||
<P><STRONG><a name="[41]"></a>UART5_IRQHandler</STRONG> (Thumb, 0 bytes, Stack size 0 bytes, startup_stm32f40_41xxx.o(.text))
|
||||
<BR>[Address Reference Count : 1]<UL><LI> startup_stm32f40_41xxx.o(RESET)
|
||||
</UL>
|
||||
<P><STRONG><a name="[32]"></a>USART2_IRQHandler</STRONG> (Thumb, 0 bytes, Stack size 0 bytes, startup_stm32f40_41xxx.o(.text))
|
||||
<BR>[Address Reference Count : 1]<UL><LI> startup_stm32f40_41xxx.o(RESET)
|
||||
</UL>
|
||||
<P><STRONG><a name="[33]"></a>USART3_IRQHandler</STRONG> (Thumb, 0 bytes, Stack size 0 bytes, startup_stm32f40_41xxx.o(.text))
|
||||
<BR>[Address Reference Count : 1]<UL><LI> startup_stm32f40_41xxx.o(RESET)
|
||||
</UL>
|
||||
<P><STRONG><a name="[53]"></a>USART6_IRQHandler</STRONG> (Thumb, 0 bytes, Stack size 0 bytes, startup_stm32f40_41xxx.o(.text))
|
||||
<BR>[Address Reference Count : 1]<UL><LI> startup_stm32f40_41xxx.o(RESET)
|
||||
</UL>
|
||||
<P><STRONG><a name="[c]"></a>WWDG_IRQHandler</STRONG> (Thumb, 0 bytes, Stack size 0 bytes, startup_stm32f40_41xxx.o(.text))
|
||||
<BR>[Address Reference Count : 1]<UL><LI> startup_stm32f40_41xxx.o(RESET)
|
||||
</UL>
|
||||
|
|
@ -571,11 +548,8 @@ Global Symbols
|
|||
<BR>[Called By]<UL><LI><a href="#[76]">>></a> _printf_char_common
|
||||
</UL>
|
||||
|
||||
<P><STRONG><a name="[6f]"></a>exit</STRONG> (Thumb, 18 bytes, Stack size 8 bytes, exit.o(.text))
|
||||
<BR><BR>[Stack]<UL><LI>Max Depth = 8 + Unknown Stack Size
|
||||
<LI>Call Chain = exit
|
||||
</UL>
|
||||
<BR>[Calls]<UL><LI><a href="#[7b]">>></a> __rt_exit
|
||||
<P><STRONG><a name="[6f]"></a>exit</STRONG> (Thumb, 12 bytes, Stack size 0 bytes, exit.o(.text))
|
||||
<BR><BR>[Calls]<UL><LI><a href="#[7b]">>></a> __rt_exit
|
||||
</UL>
|
||||
<BR>[Called By]<UL><LI><a href="#[6d]">>></a> __rt_entry_main
|
||||
</UL>
|
||||
|
|
@ -597,18 +571,23 @@ Global Symbols
|
|||
<P><STRONG><a name="[7e]"></a>GPIO_Init</STRONG> (Thumb, 144 bytes, Stack size 20 bytes, stm32f4xx_gpio.o(i.GPIO_Init))
|
||||
<BR><BR>[Stack]<UL><LI>Max Depth = 20<LI>Call Chain = GPIO_Init
|
||||
</UL>
|
||||
<BR>[Called By]<UL><LI><a href="#[8a]">>></a> uart_init
|
||||
<BR>[Called By]<UL><LI><a href="#[8b]">>></a> uart1_init
|
||||
<LI><a href="#[7c]">>></a> LED_Init
|
||||
</UL>
|
||||
|
||||
<P><STRONG><a name="[8e]"></a>GPIO_PinAFConfig</STRONG> (Thumb, 70 bytes, Stack size 20 bytes, stm32f4xx_gpio.o(i.GPIO_PinAFConfig))
|
||||
<P><STRONG><a name="[8f]"></a>GPIO_PinAFConfig</STRONG> (Thumb, 70 bytes, Stack size 20 bytes, stm32f4xx_gpio.o(i.GPIO_PinAFConfig))
|
||||
<BR><BR>[Stack]<UL><LI>Max Depth = 20<LI>Call Chain = GPIO_PinAFConfig
|
||||
</UL>
|
||||
<BR>[Called By]<UL><LI><a href="#[8a]">>></a> uart_init
|
||||
<BR>[Called By]<UL><LI><a href="#[8b]">>></a> uart1_init
|
||||
</UL>
|
||||
|
||||
<P><STRONG><a name="[83]"></a>GPIO_ResetBits</STRONG> (Thumb, 4 bytes, Stack size 0 bytes, stm32f4xx_gpio.o(i.GPIO_ResetBits))
|
||||
<BR><BR>[Called By]<UL><LI><a href="#[28]">>></a> TIM2_IRQHandler
|
||||
</UL>
|
||||
|
||||
<P><STRONG><a name="[7f]"></a>GPIO_SetBits</STRONG> (Thumb, 4 bytes, Stack size 0 bytes, stm32f4xx_gpio.o(i.GPIO_SetBits))
|
||||
<BR><BR>[Called By]<UL><LI><a href="#[7c]">>></a> LED_Init
|
||||
<BR><BR>[Called By]<UL><LI><a href="#[28]">>></a> TIM2_IRQHandler
|
||||
<LI><a href="#[7c]">>></a> LED_Init
|
||||
</UL>
|
||||
|
||||
<P><STRONG><a name="[4]"></a>HardFault_Handler</STRONG> (Thumb, 4 bytes, Stack size 0 bytes, stm32f4xx_it.o(i.HardFault_Handler))
|
||||
|
|
@ -630,13 +609,13 @@ Global Symbols
|
|||
<P><STRONG><a name="[3]"></a>NMI_Handler</STRONG> (Thumb, 2 bytes, Stack size 0 bytes, stm32f4xx_it.o(i.NMI_Handler))
|
||||
<BR>[Address Reference Count : 1]<UL><LI> startup_stm32f40_41xxx.o(RESET)
|
||||
</UL>
|
||||
<P><STRONG><a name="[91]"></a>NVIC_Init</STRONG> (Thumb, 106 bytes, Stack size 16 bytes, misc.o(i.NVIC_Init))
|
||||
<P><STRONG><a name="[92]"></a>NVIC_Init</STRONG> (Thumb, 106 bytes, Stack size 16 bytes, misc.o(i.NVIC_Init))
|
||||
<BR><BR>[Stack]<UL><LI>Max Depth = 16<LI>Call Chain = NVIC_Init
|
||||
</UL>
|
||||
<BR>[Called By]<UL><LI><a href="#[8a]">>></a> uart_init
|
||||
<BR>[Called By]<UL><LI><a href="#[8b]">>></a> uart1_init
|
||||
</UL>
|
||||
|
||||
<P><STRONG><a name="[89]"></a>NVIC_PriorityGroupConfig</STRONG> (Thumb, 10 bytes, Stack size 0 bytes, misc.o(i.NVIC_PriorityGroupConfig))
|
||||
<P><STRONG><a name="[8a]"></a>NVIC_PriorityGroupConfig</STRONG> (Thumb, 10 bytes, Stack size 0 bytes, misc.o(i.NVIC_PriorityGroupConfig))
|
||||
<BR><BR>[Called By]<UL><LI><a href="#[6e]">>></a> main
|
||||
</UL>
|
||||
|
||||
|
|
@ -644,25 +623,25 @@ Global Symbols
|
|||
<BR>[Address Reference Count : 1]<UL><LI> startup_stm32f40_41xxx.o(RESET)
|
||||
</UL>
|
||||
<P><STRONG><a name="[7d]"></a>RCC_AHB1PeriphClockCmd</STRONG> (Thumb, 26 bytes, Stack size 0 bytes, stm32f4xx_rcc.o(i.RCC_AHB1PeriphClockCmd))
|
||||
<BR><BR>[Called By]<UL><LI><a href="#[8a]">>></a> uart_init
|
||||
<BR><BR>[Called By]<UL><LI><a href="#[8b]">>></a> uart1_init
|
||||
<LI><a href="#[7c]">>></a> LED_Init
|
||||
</UL>
|
||||
|
||||
<P><STRONG><a name="[8d]"></a>RCC_APB2PeriphClockCmd</STRONG> (Thumb, 26 bytes, Stack size 0 bytes, stm32f4xx_rcc.o(i.RCC_APB2PeriphClockCmd))
|
||||
<BR><BR>[Called By]<UL><LI><a href="#[8a]">>></a> uart_init
|
||||
<P><STRONG><a name="[8e]"></a>RCC_APB2PeriphClockCmd</STRONG> (Thumb, 26 bytes, Stack size 0 bytes, stm32f4xx_rcc.o(i.RCC_APB2PeriphClockCmd))
|
||||
<BR><BR>[Called By]<UL><LI><a href="#[8b]">>></a> uart1_init
|
||||
</UL>
|
||||
|
||||
<P><STRONG><a name="[84]"></a>RCC_GetClocksFreq</STRONG> (Thumb, 214 bytes, Stack size 20 bytes, stm32f4xx_rcc.o(i.RCC_GetClocksFreq))
|
||||
<P><STRONG><a name="[85]"></a>RCC_GetClocksFreq</STRONG> (Thumb, 214 bytes, Stack size 20 bytes, stm32f4xx_rcc.o(i.RCC_GetClocksFreq))
|
||||
<BR><BR>[Stack]<UL><LI>Max Depth = 20<LI>Call Chain = RCC_GetClocksFreq
|
||||
</UL>
|
||||
<BR>[Called By]<UL><LI><a href="#[83]">>></a> USART_Init
|
||||
<BR>[Called By]<UL><LI><a href="#[84]">>></a> USART_Init
|
||||
</UL>
|
||||
|
||||
<P><STRONG><a name="[8]"></a>SVC_Handler</STRONG> (Thumb, 2 bytes, Stack size 0 bytes, stm32f4xx_it.o(i.SVC_Handler))
|
||||
<BR>[Address Reference Count : 1]<UL><LI> startup_stm32f40_41xxx.o(RESET)
|
||||
</UL>
|
||||
<P><STRONG><a name="[86]"></a>SysTick_CLKSourceConfig</STRONG> (Thumb, 40 bytes, Stack size 0 bytes, misc.o(i.SysTick_CLKSourceConfig))
|
||||
<BR><BR>[Called By]<UL><LI><a href="#[85]">>></a> delay_init
|
||||
<P><STRONG><a name="[87]"></a>SysTick_CLKSourceConfig</STRONG> (Thumb, 40 bytes, Stack size 0 bytes, misc.o(i.SysTick_CLKSourceConfig))
|
||||
<BR><BR>[Called By]<UL><LI><a href="#[86]">>></a> delay_init
|
||||
</UL>
|
||||
|
||||
<P><STRONG><a name="[b]"></a>SysTick_Handler</STRONG> (Thumb, 2 bytes, Stack size 0 bytes, stm32f4xx_it.o(i.SysTick_Handler))
|
||||
|
|
@ -675,47 +654,70 @@ Global Symbols
|
|||
</UL>
|
||||
<BR>[Address Reference Count : 1]<UL><LI> startup_stm32f40_41xxx.o(.text)
|
||||
</UL>
|
||||
<P><STRONG><a name="[31]"></a>USART1_IRQHandler</STRONG> (Thumb, 122 bytes, Stack size 8 bytes, usart.o(i.USART1_IRQHandler))
|
||||
<BR><BR>[Stack]<UL><LI>Max Depth = 24<LI>Call Chain = USART1_IRQHandler ⇒ USART_GetITStatus
|
||||
<P><STRONG><a name="[28]"></a>TIM2_IRQHandler</STRONG> (Thumb, 80 bytes, Stack size 8 bytes, timer.o(i.TIM2_IRQHandler))
|
||||
<BR><BR>[Stack]<UL><LI>Max Depth = 20<LI>Call Chain = TIM2_IRQHandler ⇒ TIM_GetITStatus
|
||||
</UL>
|
||||
<BR>[Calls]<UL><LI><a href="#[82]">>></a> USART_ReceiveData
|
||||
<LI><a href="#[81]">>></a> USART_GetITStatus
|
||||
<BR>[Calls]<UL><LI><a href="#[81]">>></a> TIM_GetITStatus
|
||||
<LI><a href="#[82]">>></a> TIM_ClearITPendingBit
|
||||
<LI><a href="#[83]">>></a> GPIO_ResetBits
|
||||
<LI><a href="#[7f]">>></a> GPIO_SetBits
|
||||
</UL>
|
||||
<BR>[Address Reference Count : 1]<UL><LI> startup_stm32f40_41xxx.o(RESET)
|
||||
</UL>
|
||||
<P><STRONG><a name="[8f]"></a>USART_Cmd</STRONG> (Thumb, 24 bytes, Stack size 0 bytes, stm32f4xx_usart.o(i.USART_Cmd))
|
||||
<BR><BR>[Called By]<UL><LI><a href="#[8a]">>></a> uart_init
|
||||
<P><STRONG><a name="[29]"></a>TIM3_IRQHandler</STRONG> (Thumb, 2 bytes, Stack size 0 bytes, timer.o(i.TIM3_IRQHandler))
|
||||
<BR>[Address Reference Count : 1]<UL><LI> startup_stm32f40_41xxx.o(RESET)
|
||||
</UL>
|
||||
<P><STRONG><a name="[82]"></a>TIM_ClearITPendingBit</STRONG> (Thumb, 6 bytes, Stack size 0 bytes, stm32f4xx_tim.o(i.TIM_ClearITPendingBit))
|
||||
<BR><BR>[Called By]<UL><LI><a href="#[28]">>></a> TIM2_IRQHandler
|
||||
</UL>
|
||||
|
||||
<P><STRONG><a name="[8c]"></a>USART_GetFlagStatus</STRONG> (Thumb, 26 bytes, Stack size 0 bytes, stm32f4xx_usart.o(i.USART_GetFlagStatus))
|
||||
<P><STRONG><a name="[81]"></a>TIM_GetITStatus</STRONG> (Thumb, 34 bytes, Stack size 12 bytes, stm32f4xx_tim.o(i.TIM_GetITStatus))
|
||||
<BR><BR>[Stack]<UL><LI>Max Depth = 12<LI>Call Chain = TIM_GetITStatus
|
||||
</UL>
|
||||
<BR>[Called By]<UL><LI><a href="#[28]">>></a> TIM2_IRQHandler
|
||||
</UL>
|
||||
|
||||
<P><STRONG><a name="[40]"></a>UART4_IRQHandler</STRONG> (Thumb, 2 bytes, Stack size 0 bytes, usart.o(i.UART4_IRQHandler))
|
||||
<BR>[Address Reference Count : 1]<UL><LI> startup_stm32f40_41xxx.o(RESET)
|
||||
</UL>
|
||||
<P><STRONG><a name="[41]"></a>UART5_IRQHandler</STRONG> (Thumb, 2 bytes, Stack size 0 bytes, usart.o(i.UART5_IRQHandler))
|
||||
<BR>[Address Reference Count : 1]<UL><LI> startup_stm32f40_41xxx.o(RESET)
|
||||
</UL>
|
||||
<P><STRONG><a name="[31]"></a>USART1_IRQHandler</STRONG> (Thumb, 2 bytes, Stack size 0 bytes, usart.o(i.USART1_IRQHandler))
|
||||
<BR>[Address Reference Count : 1]<UL><LI> startup_stm32f40_41xxx.o(RESET)
|
||||
</UL>
|
||||
<P><STRONG><a name="[32]"></a>USART2_IRQHandler</STRONG> (Thumb, 2 bytes, Stack size 0 bytes, usart.o(i.USART2_IRQHandler))
|
||||
<BR>[Address Reference Count : 1]<UL><LI> startup_stm32f40_41xxx.o(RESET)
|
||||
</UL>
|
||||
<P><STRONG><a name="[33]"></a>USART3_IRQHandler</STRONG> (Thumb, 2 bytes, Stack size 0 bytes, usart.o(i.USART3_IRQHandler))
|
||||
<BR>[Address Reference Count : 1]<UL><LI> startup_stm32f40_41xxx.o(RESET)
|
||||
</UL>
|
||||
<P><STRONG><a name="[53]"></a>USART6_IRQHandler</STRONG> (Thumb, 2 bytes, Stack size 0 bytes, usart.o(i.USART6_IRQHandler))
|
||||
<BR>[Address Reference Count : 1]<UL><LI> startup_stm32f40_41xxx.o(RESET)
|
||||
</UL>
|
||||
<P><STRONG><a name="[90]"></a>USART_Cmd</STRONG> (Thumb, 24 bytes, Stack size 0 bytes, stm32f4xx_usart.o(i.USART_Cmd))
|
||||
<BR><BR>[Called By]<UL><LI><a href="#[8b]">>></a> uart1_init
|
||||
</UL>
|
||||
|
||||
<P><STRONG><a name="[8d]"></a>USART_GetFlagStatus</STRONG> (Thumb, 26 bytes, Stack size 0 bytes, stm32f4xx_usart.o(i.USART_GetFlagStatus))
|
||||
<BR><BR>[Called By]<UL><LI><a href="#[6e]">>></a> main
|
||||
</UL>
|
||||
|
||||
<P><STRONG><a name="[81]"></a>USART_GetITStatus</STRONG> (Thumb, 84 bytes, Stack size 16 bytes, stm32f4xx_usart.o(i.USART_GetITStatus))
|
||||
<BR><BR>[Stack]<UL><LI>Max Depth = 16<LI>Call Chain = USART_GetITStatus
|
||||
</UL>
|
||||
<BR>[Called By]<UL><LI><a href="#[31]">>></a> USART1_IRQHandler
|
||||
</UL>
|
||||
|
||||
<P><STRONG><a name="[90]"></a>USART_ITConfig</STRONG> (Thumb, 74 bytes, Stack size 20 bytes, stm32f4xx_usart.o(i.USART_ITConfig))
|
||||
<P><STRONG><a name="[91]"></a>USART_ITConfig</STRONG> (Thumb, 74 bytes, Stack size 20 bytes, stm32f4xx_usart.o(i.USART_ITConfig))
|
||||
<BR><BR>[Stack]<UL><LI>Max Depth = 20<LI>Call Chain = USART_ITConfig
|
||||
</UL>
|
||||
<BR>[Called By]<UL><LI><a href="#[8a]">>></a> uart_init
|
||||
<BR>[Called By]<UL><LI><a href="#[8b]">>></a> uart1_init
|
||||
</UL>
|
||||
|
||||
<P><STRONG><a name="[83]"></a>USART_Init</STRONG> (Thumb, 204 bytes, Stack size 48 bytes, stm32f4xx_usart.o(i.USART_Init))
|
||||
<P><STRONG><a name="[84]"></a>USART_Init</STRONG> (Thumb, 204 bytes, Stack size 48 bytes, stm32f4xx_usart.o(i.USART_Init))
|
||||
<BR><BR>[Stack]<UL><LI>Max Depth = 68<LI>Call Chain = USART_Init ⇒ RCC_GetClocksFreq
|
||||
</UL>
|
||||
<BR>[Calls]<UL><LI><a href="#[84]">>></a> RCC_GetClocksFreq
|
||||
<BR>[Calls]<UL><LI><a href="#[85]">>></a> RCC_GetClocksFreq
|
||||
</UL>
|
||||
<BR>[Called By]<UL><LI><a href="#[8a]">>></a> uart_init
|
||||
<BR>[Called By]<UL><LI><a href="#[8b]">>></a> uart1_init
|
||||
</UL>
|
||||
|
||||
<P><STRONG><a name="[82]"></a>USART_ReceiveData</STRONG> (Thumb, 10 bytes, Stack size 0 bytes, stm32f4xx_usart.o(i.USART_ReceiveData))
|
||||
<BR><BR>[Called By]<UL><LI><a href="#[31]">>></a> USART1_IRQHandler
|
||||
</UL>
|
||||
|
||||
<P><STRONG><a name="[8b]"></a>USART_SendData</STRONG> (Thumb, 8 bytes, Stack size 0 bytes, stm32f4xx_usart.o(i.USART_SendData))
|
||||
<P><STRONG><a name="[8c]"></a>USART_SendData</STRONG> (Thumb, 8 bytes, Stack size 0 bytes, stm32f4xx_usart.o(i.USART_SendData))
|
||||
<BR><BR>[Called By]<UL><LI><a href="#[6e]">>></a> main
|
||||
</UL>
|
||||
|
||||
|
|
@ -726,24 +728,24 @@ Global Symbols
|
|||
<BR><BR>[Called By]<UL><LI><a href="#[72]">>></a> __rt_exit_exit
|
||||
</UL>
|
||||
|
||||
<P><STRONG><a name="[85]"></a>delay_init</STRONG> (Thumb, 52 bytes, Stack size 8 bytes, delay.o(i.delay_init))
|
||||
<P><STRONG><a name="[86]"></a>delay_init</STRONG> (Thumb, 52 bytes, Stack size 8 bytes, delay.o(i.delay_init))
|
||||
<BR><BR>[Stack]<UL><LI>Max Depth = 8<LI>Call Chain = delay_init
|
||||
</UL>
|
||||
<BR>[Calls]<UL><LI><a href="#[86]">>></a> SysTick_CLKSourceConfig
|
||||
<BR>[Calls]<UL><LI><a href="#[87]">>></a> SysTick_CLKSourceConfig
|
||||
</UL>
|
||||
<BR>[Called By]<UL><LI><a href="#[6e]">>></a> main
|
||||
</UL>
|
||||
|
||||
<P><STRONG><a name="[87]"></a>delay_ms</STRONG> (Thumb, 56 bytes, Stack size 16 bytes, delay.o(i.delay_ms))
|
||||
<P><STRONG><a name="[88]"></a>delay_ms</STRONG> (Thumb, 56 bytes, Stack size 16 bytes, delay.o(i.delay_ms))
|
||||
<BR><BR>[Stack]<UL><LI>Max Depth = 16<LI>Call Chain = delay_ms
|
||||
</UL>
|
||||
<BR>[Calls]<UL><LI><a href="#[88]">>></a> delay_xms
|
||||
<BR>[Calls]<UL><LI><a href="#[89]">>></a> delay_xms
|
||||
</UL>
|
||||
<BR>[Called By]<UL><LI><a href="#[6e]">>></a> main
|
||||
</UL>
|
||||
|
||||
<P><STRONG><a name="[88]"></a>delay_xms</STRONG> (Thumb, 72 bytes, Stack size 0 bytes, delay.o(i.delay_xms))
|
||||
<BR><BR>[Called By]<UL><LI><a href="#[87]">>></a> delay_ms
|
||||
<P><STRONG><a name="[89]"></a>delay_xms</STRONG> (Thumb, 72 bytes, Stack size 0 bytes, delay.o(i.delay_xms))
|
||||
<BR><BR>[Called By]<UL><LI><a href="#[88]">>></a> delay_ms
|
||||
</UL>
|
||||
|
||||
<P><STRONG><a name="[60]"></a>fputc</STRONG> (Thumb, 22 bytes, Stack size 0 bytes, usart.o(i.fputc))
|
||||
|
|
@ -752,29 +754,29 @@ Global Symbols
|
|||
<P><STRONG><a name="[6e]"></a>main</STRONG> (Thumb, 184 bytes, Stack size 0 bytes, main.o(i.main))
|
||||
<BR><BR>[Stack]<UL><LI>Max Depth = 128<LI>Call Chain = main ⇒ __2printf ⇒ _printf_char_file ⇒ _printf_char_common ⇒ __printf
|
||||
</UL>
|
||||
<BR>[Calls]<UL><LI><a href="#[8a]">>></a> uart_init
|
||||
<LI><a href="#[87]">>></a> delay_ms
|
||||
<LI><a href="#[85]">>></a> delay_init
|
||||
<LI><a href="#[8b]">>></a> USART_SendData
|
||||
<LI><a href="#[8c]">>></a> USART_GetFlagStatus
|
||||
<LI><a href="#[89]">>></a> NVIC_PriorityGroupConfig
|
||||
<BR>[Calls]<UL><LI><a href="#[8b]">>></a> uart1_init
|
||||
<LI><a href="#[88]">>></a> delay_ms
|
||||
<LI><a href="#[86]">>></a> delay_init
|
||||
<LI><a href="#[8c]">>></a> USART_SendData
|
||||
<LI><a href="#[8d]">>></a> USART_GetFlagStatus
|
||||
<LI><a href="#[8a]">>></a> NVIC_PriorityGroupConfig
|
||||
<LI><a href="#[7c]">>></a> LED_Init
|
||||
<LI><a href="#[74]">>></a> __2printf
|
||||
</UL>
|
||||
<BR>[Called By]<UL><LI><a href="#[6d]">>></a> __rt_entry_main
|
||||
</UL>
|
||||
|
||||
<P><STRONG><a name="[8a]"></a>uart_init</STRONG> (Thumb, 164 bytes, Stack size 40 bytes, usart.o(i.uart_init))
|
||||
<BR><BR>[Stack]<UL><LI>Max Depth = 108<LI>Call Chain = uart_init ⇒ USART_Init ⇒ RCC_GetClocksFreq
|
||||
<P><STRONG><a name="[8b]"></a>uart1_init</STRONG> (Thumb, 164 bytes, Stack size 40 bytes, usart.o(i.uart1_init))
|
||||
<BR><BR>[Stack]<UL><LI>Max Depth = 108<LI>Call Chain = uart1_init ⇒ USART_Init ⇒ RCC_GetClocksFreq
|
||||
</UL>
|
||||
<BR>[Calls]<UL><LI><a href="#[83]">>></a> USART_Init
|
||||
<LI><a href="#[90]">>></a> USART_ITConfig
|
||||
<LI><a href="#[8f]">>></a> USART_Cmd
|
||||
<LI><a href="#[8d]">>></a> RCC_APB2PeriphClockCmd
|
||||
<LI><a href="#[91]">>></a> NVIC_Init
|
||||
<LI><a href="#[8e]">>></a> GPIO_PinAFConfig
|
||||
<BR>[Calls]<UL><LI><a href="#[92]">>></a> NVIC_Init
|
||||
<LI><a href="#[8f]">>></a> GPIO_PinAFConfig
|
||||
<LI><a href="#[8e]">>></a> RCC_APB2PeriphClockCmd
|
||||
<LI><a href="#[7d]">>></a> RCC_AHB1PeriphClockCmd
|
||||
<LI><a href="#[7e]">>></a> GPIO_Init
|
||||
<LI><a href="#[84]">>></a> USART_Init
|
||||
<LI><a href="#[91]">>></a> USART_ITConfig
|
||||
<LI><a href="#[90]">>></a> USART_Cmd
|
||||
</UL>
|
||||
<BR>[Called By]<UL><LI><a href="#[6e]">>></a> main
|
||||
</UL>
|
||||
|
|
|
|||
|
|
@ -1,10 +1,14 @@
|
|||
--cpu=Cortex-M4.fp.sp
|
||||
--cpu=Cortex-M4.fp
|
||||
"..\obj\main.o"
|
||||
"..\obj\stm32f4xx_it.o"
|
||||
"..\obj\system_stm32f4xx.o"
|
||||
"..\obj\led.o"
|
||||
"..\obj\beep.o"
|
||||
"..\obj\key.o"
|
||||
"..\obj\adc.o"
|
||||
"..\obj\elemachinery.o"
|
||||
"..\obj\timer.o"
|
||||
"..\obj\spi.o"
|
||||
"..\obj\delay.o"
|
||||
"..\obj\sys.o"
|
||||
"..\obj\usart.o"
|
||||
|
|
@ -14,6 +18,9 @@
|
|||
"..\obj\stm32f4xx_rcc.o"
|
||||
"..\obj\stm32f4xx_syscfg.o"
|
||||
"..\obj\stm32f4xx_usart.o"
|
||||
"..\obj\stm32f4xx_adc.o"
|
||||
"..\obj\stm32f4xx_tim.o"
|
||||
"..\obj\stm32f4xx_spi.o"
|
||||
--strict --scatter "..\OBJ\USART.sct"
|
||||
--summary_stderr --info summarysizes --map --load_addr_map_info --xref --callgraph --symbols
|
||||
--info sizes --info totals --info unused --info veneers
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ LR_IROM1 0x08000000 0x00080000 { ; load region size_region
|
|||
*.o (RESET, +First)
|
||||
*(InRoot$$Sections)
|
||||
.ANY (+RO)
|
||||
.ANY (+XO)
|
||||
}
|
||||
RW_IRAM1 0x20000000 0x00020000 { ; RW data
|
||||
.ANY (+RW +ZI)
|
||||
|
|
|
|||
1286
OBJ/USART_USART.dep
1286
OBJ/USART_USART.dep
File diff suppressed because it is too large
Load Diff
Binary file not shown.
BIN
OBJ/beep.crf
BIN
OBJ/beep.crf
Binary file not shown.
BIN
OBJ/delay.crf
BIN
OBJ/delay.crf
Binary file not shown.
Binary file not shown.
BIN
OBJ/key.crf
BIN
OBJ/key.crf
Binary file not shown.
BIN
OBJ/led.crf
BIN
OBJ/led.crf
Binary file not shown.
BIN
OBJ/main.crf
BIN
OBJ/main.crf
Binary file not shown.
BIN
OBJ/misc.crf
BIN
OBJ/misc.crf
Binary file not shown.
Binary file not shown.
|
|
@ -867,12 +867,12 @@ ARM Macro Assembler Page 14
|
|||
00000400
|
||||
00000200
|
||||
00000000
|
||||
Command Line: --debug --xref --diag_suppress=9931 --cpu=Cortex-M4.fp.sp --apcs=
|
||||
interwork --depend=..\obj\startup_stm32f40_41xxx.d -o..\obj\startup_stm32f40_41
|
||||
xxx.o -IC:\Keil_v5\ARM\PACK\Keil\STM32F4xx_DFP\2.11.0\Drivers\CMSIS\Device\ST\S
|
||||
TM32F4xx\Include --predefine="__UVISION_VERSION SETA 538" --predefine="STM32F40
|
||||
7xx SETA 1" --list=..\obj\startup_stm32f40_41xxx.lst ..\CORE\startup_stm32f40_4
|
||||
1xxx.s
|
||||
Command Line: --debug --xref --diag_suppress=9931 --cpu=Cortex-M4.fp --apcs=int
|
||||
erwork --depend=..\obj\startup_stm32f40_41xxx.d -o..\obj\startup_stm32f40_41xxx
|
||||
.o -I.\RTE\_USART -IC:\Keil_v5\ARM\PACK\Keil\STM32F4xx_DFP\2.14.0\Drivers\CMSIS
|
||||
\Device\ST\STM32F4xx\Include -IC:\Keil_v5\ARM\CMSIS\Include --predefine="__UVIS
|
||||
ION_VERSION SETA 525" --predefine="STM32F407xx SETA 1" --list=..\obj\startup_st
|
||||
m32f40_41xxx.lst ..\CORE\startup_stm32f40_41xxx.s
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
OBJ/sys.crf
BIN
OBJ/sys.crf
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
OBJ/usart.crf
BIN
OBJ/usart.crf
Binary file not shown.
|
|
@ -57,7 +57,6 @@ int fputc(int ch, FILE *f)
|
|||
}
|
||||
#endif
|
||||
|
||||
#if EN_USART1_RX //如果使能了接收
|
||||
//串口1中断服务程序
|
||||
//注意,读取USARTx->SR能避免莫名其妙的错误
|
||||
u8 USART_RX_BUF[USART_REC_LEN]; //接收缓冲,最大USART_REC_LEN个字节.
|
||||
|
|
@ -69,7 +68,7 @@ u16 USART_RX_STA=0; //
|
|||
|
||||
//初始化IO 串口1
|
||||
//bound:波特率
|
||||
void uart_init(u32 bound){
|
||||
void uart1_init(u32 bound){
|
||||
//GPIO端口设置
|
||||
GPIO_InitTypeDef GPIO_InitStructure;
|
||||
USART_InitTypeDef USART_InitStructure;
|
||||
|
|
@ -103,7 +102,7 @@ void uart_init(u32 bound){
|
|||
|
||||
//USART_ClearFlag(USART1, USART_FLAG_TC);
|
||||
|
||||
#if EN_USART1_RX
|
||||
|
||||
USART_ITConfig(USART1, USART_IT_RXNE, ENABLE);//开启相关中断
|
||||
|
||||
//Usart1 NVIC 配置
|
||||
|
|
@ -113,46 +112,279 @@ void uart_init(u32 bound){
|
|||
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; //IRQ通道使能
|
||||
NVIC_Init(&NVIC_InitStructure); //根据指定的参数初始化VIC寄存器、
|
||||
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
|
||||
void USART1_IRQHandler(void) //串口1中断服务程序
|
||||
{
|
||||
u8 Res;
|
||||
#if SYSTEM_SUPPORT_OS //如果SYSTEM_SUPPORT_OS为真,则需要支持OS.
|
||||
OSIntEnter();
|
||||
#endif
|
||||
if(USART_GetITStatus(USART1, USART_IT_RXNE) != RESET) //接收中断(接收到的数据必须是0x0d 0x0a结尾)
|
||||
{
|
||||
Res =USART_ReceiveData(USART1);//(USART1->DR); //读取接收到的数据
|
||||
|
||||
if((USART_RX_STA&0x8000)==0)//接收未完成
|
||||
{
|
||||
if(USART_RX_STA&0x4000)//接收到了0x0d
|
||||
{
|
||||
if(Res!=0x0a)USART_RX_STA=0;//接收错误,重新开始
|
||||
else USART_RX_STA|=0x8000; //接收完成了
|
||||
}
|
||||
else //还没收到0X0D
|
||||
{
|
||||
if(Res==0x0d)USART_RX_STA|=0x4000;
|
||||
else
|
||||
{
|
||||
USART_RX_BUF[USART_RX_STA&0X3FFF]=Res ;
|
||||
USART_RX_STA++;
|
||||
if(USART_RX_STA>(USART_REC_LEN-1))USART_RX_STA=0;//接收数据错误,重新开始接收
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#if SYSTEM_SUPPORT_OS //如果SYSTEM_SUPPORT_OS为真,则需要支持OS.
|
||||
OSIntExit();
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
void uart2_init(u32 bound){
|
||||
//GPIO端口设置
|
||||
GPIO_InitTypeDef GPIO_InitStructure;
|
||||
USART_InitTypeDef USART_InitStructure;
|
||||
NVIC_InitTypeDef NVIC_InitStructure;
|
||||
|
||||
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOA,ENABLE); //使能GPIOA时钟
|
||||
RCC_APB2PeriphClockCmd(RCC_APB2Periph_USART1,ENABLE);//使能USART1时钟
|
||||
|
||||
//串口1对应引脚复用映射
|
||||
GPIO_PinAFConfig(GPIOA,GPIO_PinSource9,GPIO_AF_USART1); //GPIOA9复用为USART1
|
||||
GPIO_PinAFConfig(GPIOA,GPIO_PinSource10,GPIO_AF_USART1); //GPIOA10复用为USART1
|
||||
|
||||
//USART1端口配置
|
||||
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_9 | GPIO_Pin_10; //GPIOA9与GPIOA10
|
||||
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;//复用功能
|
||||
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; //速度50MHz
|
||||
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; //推挽复用输出
|
||||
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP; //上拉
|
||||
GPIO_Init(GPIOA,&GPIO_InitStructure); //初始化PA9,PA10
|
||||
|
||||
//USART1 初始化设置
|
||||
USART_InitStructure.USART_BaudRate = bound;//波特率设置
|
||||
USART_InitStructure.USART_WordLength = USART_WordLength_8b;//字长为8位数据格式
|
||||
USART_InitStructure.USART_StopBits = USART_StopBits_1;//一个停止位
|
||||
USART_InitStructure.USART_Parity = USART_Parity_No;//无奇偶校验位
|
||||
USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None;//无硬件数据流控制
|
||||
USART_InitStructure.USART_Mode = USART_Mode_Rx | USART_Mode_Tx; //收发模式
|
||||
USART_Init(USART2, &USART_InitStructure); //初始化串口1
|
||||
|
||||
USART_Cmd(USART2, ENABLE); //使能串口1
|
||||
|
||||
//USART_ClearFlag(USART1, USART_FLAG_TC);
|
||||
|
||||
|
||||
USART_ITConfig(USART1, USART_IT_RXNE, ENABLE);//开启相关中断
|
||||
|
||||
//Usart1 NVIC 配置
|
||||
NVIC_InitStructure.NVIC_IRQChannel = USART2_IRQn;//串口1中断通道
|
||||
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority=3;//抢占优先级3
|
||||
NVIC_InitStructure.NVIC_IRQChannelSubPriority =3; //子优先级3
|
||||
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; //IRQ通道使能
|
||||
NVIC_Init(&NVIC_InitStructure); //根据指定的参数初始化VIC寄存器、
|
||||
|
||||
}
|
||||
|
||||
|
||||
void USART2_IRQHandler(void) //串口1中断服务程序
|
||||
{
|
||||
u8 Res;
|
||||
}
|
||||
|
||||
|
||||
void uart3_init(u32 bound){
|
||||
//GPIO端口设置
|
||||
GPIO_InitTypeDef GPIO_InitStructure;
|
||||
USART_InitTypeDef USART_InitStructure;
|
||||
NVIC_InitTypeDef NVIC_InitStructure;
|
||||
|
||||
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOA,ENABLE); //使能GPIOA时钟
|
||||
RCC_APB2PeriphClockCmd(RCC_APB2Periph_USART1,ENABLE);//使能USART1时钟
|
||||
|
||||
//串口1对应引脚复用映射
|
||||
GPIO_PinAFConfig(GPIOA,GPIO_PinSource9,GPIO_AF_USART1); //GPIOA9复用为USART1
|
||||
GPIO_PinAFConfig(GPIOA,GPIO_PinSource10,GPIO_AF_USART1); //GPIOA10复用为USART1
|
||||
|
||||
//USART1端口配置
|
||||
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_9 | GPIO_Pin_10; //GPIOA9与GPIOA10
|
||||
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;//复用功能
|
||||
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; //速度50MHz
|
||||
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; //推挽复用输出
|
||||
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP; //上拉
|
||||
GPIO_Init(GPIOA,&GPIO_InitStructure); //初始化PA9,PA10
|
||||
|
||||
//USART1 初始化设置
|
||||
USART_InitStructure.USART_BaudRate = bound;//波特率设置
|
||||
USART_InitStructure.USART_WordLength = USART_WordLength_8b;//字长为8位数据格式
|
||||
USART_InitStructure.USART_StopBits = USART_StopBits_1;//一个停止位
|
||||
USART_InitStructure.USART_Parity = USART_Parity_No;//无奇偶校验位
|
||||
USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None;//无硬件数据流控制
|
||||
USART_InitStructure.USART_Mode = USART_Mode_Rx | USART_Mode_Tx; //收发模式
|
||||
USART_Init(USART3, &USART_InitStructure); //初始化串口1
|
||||
|
||||
USART_Cmd(USART3, ENABLE); //使能串口1
|
||||
|
||||
//USART_ClearFlag(USART1, USART_FLAG_TC);
|
||||
|
||||
|
||||
USART_ITConfig(USART1, USART_IT_RXNE, ENABLE);//开启相关中断
|
||||
|
||||
//Usart1 NVIC 配置
|
||||
NVIC_InitStructure.NVIC_IRQChannel = USART3_IRQn;//串口1中断通道
|
||||
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority=3;//抢占优先级3
|
||||
NVIC_InitStructure.NVIC_IRQChannelSubPriority =3; //子优先级3
|
||||
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; //IRQ通道使能
|
||||
NVIC_Init(&NVIC_InitStructure); //根据指定的参数初始化VIC寄存器、
|
||||
|
||||
}
|
||||
|
||||
|
||||
void USART3_IRQHandler(void) //串口1中断服务程序
|
||||
{
|
||||
u8 Res;
|
||||
}
|
||||
|
||||
|
||||
void uart4_init(u32 bound){
|
||||
//GPIO端口设置
|
||||
GPIO_InitTypeDef GPIO_InitStructure;
|
||||
USART_InitTypeDef USART_InitStructure;
|
||||
NVIC_InitTypeDef NVIC_InitStructure;
|
||||
|
||||
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOA,ENABLE); //使能GPIOA时钟
|
||||
RCC_APB2PeriphClockCmd(RCC_APB2Periph_USART1,ENABLE);//使能USART1时钟
|
||||
|
||||
//串口1对应引脚复用映射
|
||||
GPIO_PinAFConfig(GPIOA,GPIO_PinSource9,GPIO_AF_USART1); //GPIOA9复用为USART1
|
||||
GPIO_PinAFConfig(GPIOA,GPIO_PinSource10,GPIO_AF_USART1); //GPIOA10复用为USART1
|
||||
|
||||
//USART1端口配置
|
||||
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_9 | GPIO_Pin_10; //GPIOA9与GPIOA10
|
||||
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;//复用功能
|
||||
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; //速度50MHz
|
||||
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; //推挽复用输出
|
||||
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP; //上拉
|
||||
GPIO_Init(GPIOA,&GPIO_InitStructure); //初始化PA9,PA10
|
||||
|
||||
//USART1 初始化设置
|
||||
USART_InitStructure.USART_BaudRate = bound;//波特率设置
|
||||
USART_InitStructure.USART_WordLength = USART_WordLength_8b;//字长为8位数据格式
|
||||
USART_InitStructure.USART_StopBits = USART_StopBits_1;//一个停止位
|
||||
USART_InitStructure.USART_Parity = USART_Parity_No;//无奇偶校验位
|
||||
USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None;//无硬件数据流控制
|
||||
USART_InitStructure.USART_Mode = USART_Mode_Rx | USART_Mode_Tx; //收发模式
|
||||
USART_Init(USART1, &USART_InitStructure); //初始化串口1
|
||||
|
||||
USART_Cmd(USART1, ENABLE); //使能串口1
|
||||
|
||||
//USART_ClearFlag(USART1, USART_FLAG_TC);
|
||||
|
||||
|
||||
USART_ITConfig(USART1, USART_IT_RXNE, ENABLE);//开启相关中断
|
||||
|
||||
//Usart1 NVIC 配置
|
||||
NVIC_InitStructure.NVIC_IRQChannel = UART4_IRQn;//串口1中断通道
|
||||
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority=3;//抢占优先级3
|
||||
NVIC_InitStructure.NVIC_IRQChannelSubPriority =3; //子优先级3
|
||||
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; //IRQ通道使能
|
||||
NVIC_Init(&NVIC_InitStructure); //根据指定的参数初始化VIC寄存器、
|
||||
|
||||
}
|
||||
|
||||
|
||||
void UART4_IRQHandler(void) //串口1中断服务程序
|
||||
{
|
||||
u8 Res;
|
||||
}
|
||||
|
||||
|
||||
void uart5_init(u32 bound){
|
||||
//GPIO端口设置
|
||||
GPIO_InitTypeDef GPIO_InitStructure;
|
||||
USART_InitTypeDef USART_InitStructure;
|
||||
NVIC_InitTypeDef NVIC_InitStructure;
|
||||
|
||||
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOA,ENABLE); //使能GPIOA时钟
|
||||
RCC_APB2PeriphClockCmd(RCC_APB2Periph_USART1,ENABLE);//使能USART1时钟
|
||||
|
||||
//串口1对应引脚复用映射
|
||||
GPIO_PinAFConfig(GPIOA,GPIO_PinSource9,GPIO_AF_USART1); //GPIOA9复用为USART1
|
||||
GPIO_PinAFConfig(GPIOA,GPIO_PinSource10,GPIO_AF_USART1); //GPIOA10复用为USART1
|
||||
|
||||
//USART1端口配置
|
||||
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_9 | GPIO_Pin_10; //GPIOA9与GPIOA10
|
||||
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;//复用功能
|
||||
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; //速度50MHz
|
||||
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; //推挽复用输出
|
||||
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP; //上拉
|
||||
GPIO_Init(GPIOA,&GPIO_InitStructure); //初始化PA9,PA10
|
||||
|
||||
//USART1 初始化设置
|
||||
USART_InitStructure.USART_BaudRate = bound;//波特率设置
|
||||
USART_InitStructure.USART_WordLength = USART_WordLength_8b;//字长为8位数据格式
|
||||
USART_InitStructure.USART_StopBits = USART_StopBits_1;//一个停止位
|
||||
USART_InitStructure.USART_Parity = USART_Parity_No;//无奇偶校验位
|
||||
USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None;//无硬件数据流控制
|
||||
USART_InitStructure.USART_Mode = USART_Mode_Rx | USART_Mode_Tx; //收发模式
|
||||
USART_Init(USART1, &USART_InitStructure); //初始化串口1
|
||||
|
||||
USART_Cmd(USART1, ENABLE); //使能串口1
|
||||
|
||||
//USART_ClearFlag(USART1, USART_FLAG_TC);
|
||||
|
||||
|
||||
USART_ITConfig(USART1, USART_IT_RXNE, ENABLE);//开启相关中断
|
||||
|
||||
//Usart1 NVIC 配置
|
||||
NVIC_InitStructure.NVIC_IRQChannel = UART5_IRQn;//串口1中断通道
|
||||
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority=3;//抢占优先级3
|
||||
NVIC_InitStructure.NVIC_IRQChannelSubPriority =3; //子优先级3
|
||||
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; //IRQ通道使能
|
||||
NVIC_Init(&NVIC_InitStructure); //根据指定的参数初始化VIC寄存器、
|
||||
|
||||
}
|
||||
|
||||
|
||||
void UART5_IRQHandler(void) //串口1中断服务程序
|
||||
{
|
||||
u8 Res;
|
||||
}
|
||||
|
||||
|
||||
void uart6_init(u32 bound){
|
||||
//GPIO端口设置
|
||||
GPIO_InitTypeDef GPIO_InitStructure;
|
||||
USART_InitTypeDef USART_InitStructure;
|
||||
NVIC_InitTypeDef NVIC_InitStructure;
|
||||
|
||||
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOA,ENABLE); //使能GPIOA时钟
|
||||
RCC_APB2PeriphClockCmd(RCC_APB2Periph_USART1,ENABLE);//使能USART1时钟
|
||||
|
||||
//串口1对应引脚复用映射
|
||||
GPIO_PinAFConfig(GPIOA,GPIO_PinSource9,GPIO_AF_USART1); //GPIOA9复用为USART1
|
||||
GPIO_PinAFConfig(GPIOA,GPIO_PinSource10,GPIO_AF_USART1); //GPIOA10复用为USART1
|
||||
|
||||
//USART1端口配置
|
||||
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_9 | GPIO_Pin_10; //GPIOA9与GPIOA10
|
||||
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;//复用功能
|
||||
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; //速度50MHz
|
||||
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; //推挽复用输出
|
||||
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP; //上拉
|
||||
GPIO_Init(GPIOA,&GPIO_InitStructure); //初始化PA9,PA10
|
||||
|
||||
//USART1 初始化设置
|
||||
USART_InitStructure.USART_BaudRate = bound;//波特率设置
|
||||
USART_InitStructure.USART_WordLength = USART_WordLength_8b;//字长为8位数据格式
|
||||
USART_InitStructure.USART_StopBits = USART_StopBits_1;//一个停止位
|
||||
USART_InitStructure.USART_Parity = USART_Parity_No;//无奇偶校验位
|
||||
USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None;//无硬件数据流控制
|
||||
USART_InitStructure.USART_Mode = USART_Mode_Rx | USART_Mode_Tx; //收发模式
|
||||
USART_Init(USART1, &USART_InitStructure); //初始化串口1
|
||||
|
||||
USART_Cmd(USART1, ENABLE); //使能串口1
|
||||
|
||||
//USART_ClearFlag(USART1, USART_FLAG_TC);
|
||||
|
||||
|
||||
USART_ITConfig(USART1, USART_IT_RXNE, ENABLE);//开启相关中断
|
||||
|
||||
//Usart1 NVIC 配置
|
||||
NVIC_InitStructure.NVIC_IRQChannel = USART6_IRQn;//串口1中断通道
|
||||
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority=3;//抢占优先级3
|
||||
NVIC_InitStructure.NVIC_IRQChannelSubPriority =3; //子优先级3
|
||||
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; //IRQ通道使能
|
||||
NVIC_Init(&NVIC_InitStructure); //根据指定的参数初始化VIC寄存器、
|
||||
|
||||
}
|
||||
|
||||
|
||||
void USART6_IRQHandler(void) //串口1中断服务程序
|
||||
{
|
||||
u8 Res;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@
|
|||
extern u8 USART_RX_BUF[USART_REC_LEN]; //接收缓冲,最大USART_REC_LEN个字节.末字节为换行符
|
||||
extern u16 USART_RX_STA; //接收状态标记
|
||||
//如果想串口中断接收,请不要注释以下宏定义
|
||||
void uart_init(u32 bound);
|
||||
void uart1_init(u32 bound);
|
||||
#endif
|
||||
|
||||
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -103,7 +103,7 @@
|
|||
<bEvRecOn>1</bEvRecOn>
|
||||
<bSchkAxf>0</bSchkAxf>
|
||||
<bTchkAxf>0</bTchkAxf>
|
||||
<nTsel>5</nTsel>
|
||||
<nTsel>11</nTsel>
|
||||
<sDll></sDll>
|
||||
<sDllPa></sDllPa>
|
||||
<sDlgDll></sDlgDll>
|
||||
|
|
@ -173,7 +173,6 @@
|
|||
<pMultCmdsp></pMultCmdsp>
|
||||
<DebugDescription>
|
||||
<Enable>1</Enable>
|
||||
<EnableFlashSeq>0</EnableFlashSeq>
|
||||
<EnableLog>0</EnableLog>
|
||||
<Protocol>2</Protocol>
|
||||
<DbgClock>10000000</DbgClock>
|
||||
|
|
@ -227,7 +226,7 @@
|
|||
|
||||
<Group>
|
||||
<GroupName>HARDWARE</GroupName>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExp>1</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<cbSel>0</cbSel>
|
||||
<RteFlg>0</RteFlg>
|
||||
|
|
@ -267,6 +266,54 @@
|
|||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>2</GroupNumber>
|
||||
<FileNumber>7</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\HARDWARE\ADC\adc.c</PathWithFileName>
|
||||
<FilenameWithoutPath>adc.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>2</GroupNumber>
|
||||
<FileNumber>8</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\HARDWARE\elemachinery\elemachinery.c</PathWithFileName>
|
||||
<FilenameWithoutPath>elemachinery.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>2</GroupNumber>
|
||||
<FileNumber>9</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\HARDWARE\TIMER\timer.c</PathWithFileName>
|
||||
<FilenameWithoutPath>timer.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>2</GroupNumber>
|
||||
<FileNumber>10</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\HARDWARE\SPI\spi.c</PathWithFileName>
|
||||
<FilenameWithoutPath>spi.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
</Group>
|
||||
|
||||
<Group>
|
||||
|
|
@ -277,7 +324,7 @@
|
|||
<RteFlg>0</RteFlg>
|
||||
<File>
|
||||
<GroupNumber>3</GroupNumber>
|
||||
<FileNumber>7</FileNumber>
|
||||
<FileNumber>11</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
|
|
@ -289,9 +336,9 @@
|
|||
</File>
|
||||
<File>
|
||||
<GroupNumber>3</GroupNumber>
|
||||
<FileNumber>8</FileNumber>
|
||||
<FileNumber>12</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExp>1</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\SYSTEM\sys\sys.c</PathWithFileName>
|
||||
|
|
@ -301,7 +348,7 @@
|
|||
</File>
|
||||
<File>
|
||||
<GroupNumber>3</GroupNumber>
|
||||
<FileNumber>9</FileNumber>
|
||||
<FileNumber>13</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
|
|
@ -321,7 +368,7 @@
|
|||
<RteFlg>0</RteFlg>
|
||||
<File>
|
||||
<GroupNumber>4</GroupNumber>
|
||||
<FileNumber>10</FileNumber>
|
||||
<FileNumber>14</FileNumber>
|
||||
<FileType>2</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
|
|
@ -335,13 +382,13 @@
|
|||
|
||||
<Group>
|
||||
<GroupName>FWLIB</GroupName>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExp>1</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<cbSel>0</cbSel>
|
||||
<RteFlg>0</RteFlg>
|
||||
<File>
|
||||
<GroupNumber>5</GroupNumber>
|
||||
<FileNumber>11</FileNumber>
|
||||
<FileNumber>15</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
|
|
@ -353,7 +400,7 @@
|
|||
</File>
|
||||
<File>
|
||||
<GroupNumber>5</GroupNumber>
|
||||
<FileNumber>12</FileNumber>
|
||||
<FileNumber>16</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
|
|
@ -365,7 +412,7 @@
|
|||
</File>
|
||||
<File>
|
||||
<GroupNumber>5</GroupNumber>
|
||||
<FileNumber>13</FileNumber>
|
||||
<FileNumber>17</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
|
|
@ -377,7 +424,7 @@
|
|||
</File>
|
||||
<File>
|
||||
<GroupNumber>5</GroupNumber>
|
||||
<FileNumber>14</FileNumber>
|
||||
<FileNumber>18</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
|
|
@ -389,7 +436,7 @@
|
|||
</File>
|
||||
<File>
|
||||
<GroupNumber>5</GroupNumber>
|
||||
<FileNumber>15</FileNumber>
|
||||
<FileNumber>19</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
|
|
@ -399,6 +446,42 @@
|
|||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>5</GroupNumber>
|
||||
<FileNumber>20</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\FWLIB\src\stm32f4xx_adc.c</PathWithFileName>
|
||||
<FilenameWithoutPath>stm32f4xx_adc.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>5</GroupNumber>
|
||||
<FileNumber>21</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\FWLIB\src\stm32f4xx_tim.c</PathWithFileName>
|
||||
<FilenameWithoutPath>stm32f4xx_tim.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>5</GroupNumber>
|
||||
<FileNumber>22</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\FWLIB\src\stm32f4xx_spi.c</PathWithFileName>
|
||||
<FilenameWithoutPath>stm32f4xx_spi.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
</Group>
|
||||
|
||||
<Group>
|
||||
|
|
@ -409,7 +492,7 @@
|
|||
<RteFlg>0</RteFlg>
|
||||
<File>
|
||||
<GroupNumber>6</GroupNumber>
|
||||
<FileNumber>16</FileNumber>
|
||||
<FileNumber>23</FileNumber>
|
||||
<FileType>5</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
|
|
|
|||
|
|
@ -10,14 +10,14 @@
|
|||
<TargetName>USART</TargetName>
|
||||
<ToolsetNumber>0x4</ToolsetNumber>
|
||||
<ToolsetName>ARM-ADS</ToolsetName>
|
||||
<pCCUsed>5060422::V5.06 update 4 (build 422)::ARMCC</pCCUsed>
|
||||
<pCCUsed>5050169::V5.05 update 2 (build 169)::ARMCC</pCCUsed>
|
||||
<uAC6>0</uAC6>
|
||||
<TargetOption>
|
||||
<TargetCommonOption>
|
||||
<Device>STM32F407ZETx</Device>
|
||||
<Vendor>STMicroelectronics</Vendor>
|
||||
<PackID>Keil.STM32F4xx_DFP.2.11.0</PackID>
|
||||
<PackURL>http://www.keil.com/pack</PackURL>
|
||||
<PackID>Keil.STM32F4xx_DFP.2.14.0</PackID>
|
||||
<PackURL>http://www.keil.com/pack/</PackURL>
|
||||
<Cpu>IRAM(0x20000000,0x20000) IRAM2(0x10000000,0x10000) IROM(0x08000000,0x80000) CPUTYPE("Cortex-M4") FPU2 CLOCK(12000000) ELITTLE</Cpu>
|
||||
<FlashUtilSpec></FlashUtilSpec>
|
||||
<StartupFile></StartupFile>
|
||||
|
|
@ -184,9 +184,6 @@
|
|||
<hadXRAM>0</hadXRAM>
|
||||
<uocXRam>0</uocXRam>
|
||||
<RvdsVP>2</RvdsVP>
|
||||
<RvdsMve>0</RvdsMve>
|
||||
<RvdsCdeCp>0</RvdsCdeCp>
|
||||
<nBranchProt>0</nBranchProt>
|
||||
<hadIRAM2>1</hadIRAM2>
|
||||
<hadIROM2>0</hadIROM2>
|
||||
<StupSel>8</StupSel>
|
||||
|
|
@ -323,7 +320,7 @@
|
|||
<PlainCh>0</PlainCh>
|
||||
<Ropi>0</Ropi>
|
||||
<Rwpi>0</Rwpi>
|
||||
<wLevel>0</wLevel>
|
||||
<wLevel>1</wLevel>
|
||||
<uThumb>0</uThumb>
|
||||
<uSurpInc>0</uSurpInc>
|
||||
<uC99>0</uC99>
|
||||
|
|
@ -340,7 +337,7 @@
|
|||
<MiscControls></MiscControls>
|
||||
<Define>STM32F40_41xxx,USE_STDPERIPH_DRIVER</Define>
|
||||
<Undefine></Undefine>
|
||||
<IncludePath>..\CORE;..\SYSTEM\delay;..\SYSTEM\sys;..\SYSTEM\usart;..\FWLIB\STM32F4xx_StdPeriph_Driver\inc;..\USER;..\HARDWARE\LED;..\HARDWARE\BEEP;..\HARDWARE\KEY;..\FWLIB\inc</IncludePath>
|
||||
<IncludePath>..\CORE;..\SYSTEM\delay;..\SYSTEM\sys;..\SYSTEM\usart;..\FWLIB\STM32F4xx_StdPeriph_Driver\inc;..\USER;..\HARDWARE\LED;..\HARDWARE\BEEP;..\HARDWARE\KEY;..\FWLIB\inc;..\HARDWARE</IncludePath>
|
||||
</VariousControls>
|
||||
</Cads>
|
||||
<Aads>
|
||||
|
|
@ -353,7 +350,7 @@
|
|||
<NoWarn>0</NoWarn>
|
||||
<uSurpInc>0</uSurpInc>
|
||||
<useXO>0</useXO>
|
||||
<ClangAsOpt>4</ClangAsOpt>
|
||||
<uClangAs>0</uClangAs>
|
||||
<VariousControls>
|
||||
<MiscControls></MiscControls>
|
||||
<Define></Define>
|
||||
|
|
@ -419,6 +416,26 @@
|
|||
<FileType>1</FileType>
|
||||
<FilePath>..\HARDWARE\KEY\key.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>adc.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\HARDWARE\ADC\adc.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>elemachinery.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\HARDWARE\elemachinery\elemachinery.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>timer.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\HARDWARE\TIMER\timer.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>spi.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\HARDWARE\SPI\spi.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
|
|
@ -479,6 +496,21 @@
|
|||
<FileType>1</FileType>
|
||||
<FilePath>..\FWLIB\src\stm32f4xx_usart.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>stm32f4xx_adc.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\FWLIB\src\stm32f4xx_adc.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>stm32f4xx_tim.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\FWLIB\src\stm32f4xx_tim.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>stm32f4xx_spi.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\FWLIB\src\stm32f4xx_spi.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
|
|
@ -501,13 +533,4 @@
|
|||
<files/>
|
||||
</RTE>
|
||||
|
||||
<LayerInfo>
|
||||
<Layers>
|
||||
<Layer>
|
||||
<LayName>USART</LayName>
|
||||
<LayPrjMark>1</LayPrjMark>
|
||||
</Layer>
|
||||
</Layers>
|
||||
</LayerInfo>
|
||||
|
||||
</Project>
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ int main(void)
|
|||
u16 times=0;
|
||||
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2);//设置系统中断优先级分组2
|
||||
delay_init(168); //延时初始化
|
||||
uart_init(115200); //串口初始化波特率为115200
|
||||
uart1_init(115200); //串口初始化波特率为115200
|
||||
LED_Init(); //初始化与LED连接的硬件接口
|
||||
while(1)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue