解决自动更新bootloader死机的问题
软件版本2.00 解决检测任务中重试失败后不会填充返回值的bug
This commit is contained in:
@@ -4,14 +4,14 @@
|
||||
#include "timer_cfg.h"
|
||||
#include "base/utility.h"
|
||||
#include "power.h"
|
||||
uint16_t ad0_adc_sample[AD_SCAN_SAMPLE*AD_SCAN_COUNT];
|
||||
volatile uint16_t ad0_adc_sample[AD_SCAN_SAMPLE*AD_SCAN_COUNT];
|
||||
#define ADC1_SAMPLE_BUF_LEN 200
|
||||
#define ADC1_SAMPLE_BUF_LEN2 20
|
||||
|
||||
volatile uint16_t FireBus_ADC_Buf[FIREBUS_ADC_BUF_LEN];
|
||||
|
||||
|
||||
uint16_t adc1_sample_buf[ADC1_SAMPLE_BUF_LEN];
|
||||
volatile uint16_t adc1_sample_buf[ADC1_SAMPLE_BUF_LEN];
|
||||
void AdcDef_Init(void)
|
||||
{
|
||||
|
||||
@@ -185,7 +185,7 @@ uint32_t GetADC2_Value(uint32_t channel)
|
||||
void GetADC1_Value(uint32_t channel,uint16_t* buf,uint16_t len)
|
||||
{
|
||||
uint8_t i = 0;
|
||||
uint16_t* buf_head = 0;
|
||||
volatile uint16_t* buf_head = 0;
|
||||
switch(channel)
|
||||
{
|
||||
case VCC_2V5_CH: buf_head = ad0_adc_sample;break;
|
||||
@@ -251,7 +251,7 @@ uint16_t ADC_GetBaseStableCur(void)
|
||||
ul_base = (ul_base*8 + adc1_sample_buf[us_count]*2 )/10;
|
||||
adc1_sample_buf[us_count] = ul_base;
|
||||
}
|
||||
Bubble_Sort_u16(adc1_sample_buf,us_count);
|
||||
Bubble_Sort_u16((uint16_t *)adc1_sample_buf,us_count);
|
||||
|
||||
us_count = (ADC1_SAMPLE_BUF_LEN>>2);
|
||||
us_temp = ADC1_SAMPLE_BUF_LEN - (ADC1_SAMPLE_BUF_LEN>>2);
|
||||
@@ -297,7 +297,7 @@ uint16_t ADC_Comm1p6mA_EndCur(void)
|
||||
ul_base = (ul_base*8 + adc1_sample_buf[us_count]*2 )/10;
|
||||
adc1_sample_buf[us_count] = ul_base;
|
||||
}
|
||||
Bubble_Sort_u16(adc1_sample_buf,us_count);
|
||||
Bubble_Sort_u16((uint16_t *)adc1_sample_buf,us_count);
|
||||
|
||||
us_count = (ADC1_SAMPLE_BUF_LEN2>>2);
|
||||
us_temp = ADC1_SAMPLE_BUF_LEN2 - (ADC1_SAMPLE_BUF_LEN2>>2);
|
||||
|
@@ -1,5 +1,6 @@
|
||||
#include "dac_cfg.h"
|
||||
#include "gpio_cfg.h"
|
||||
#include "base/delay.h"
|
||||
/*
|
||||
@brief 默认初始化
|
||||
*/
|
||||
@@ -43,13 +44,16 @@ void DAC_Definit(void)
|
||||
*/
|
||||
void C_H_DAC_Set(uint16_t dac_val)
|
||||
{
|
||||
uint16_t read=0;
|
||||
read=DAC_GetDataOutputValue(DAC_Channel_1);
|
||||
if(dac_val==read) return;
|
||||
DAC_SetChannel1Data(DAC_Align_12b_R, dac_val);
|
||||
DAC_SoftwareTriggerCmd(DAC_Channel_1,ENABLE);
|
||||
// dac_output_buffer_enable(DAC0);
|
||||
// dac_data_set(DAC0,DAC_ALIGN_12B_R,dac_val);
|
||||
// dac_trigger_enable(DAC0);
|
||||
// dac_enable(DAC0);
|
||||
// dac_software_trigger_enable(DAC0);
|
||||
|
||||
do{
|
||||
DAC_SoftwareTriggerCmd(DAC_Channel_1,ENABLE);
|
||||
read=DAC_GetDataOutputValue(DAC_Channel_1);
|
||||
}while(read!=dac_val);
|
||||
|
||||
}
|
||||
/*
|
||||
@brief 设置高电平电压
|
||||
@@ -57,13 +61,15 @@ void C_H_DAC_Set(uint16_t dac_val)
|
||||
*/
|
||||
void C_M_DAC_Set(uint16_t dac_val)
|
||||
{
|
||||
uint16_t read=0;
|
||||
read=DAC_GetDataOutputValue(DAC_Channel_2);
|
||||
if(dac_val==read) return;
|
||||
DAC_SetChannel2Data(DAC_Align_12b_R, dac_val);
|
||||
DAC_SoftwareTriggerCmd(DAC_Channel_2,ENABLE);
|
||||
// dac_output_buffer_enable(DAC1);
|
||||
// dac_data_set(DAC1,DAC_ALIGN_12B_R,dac_val);
|
||||
// dac_trigger_enable(DAC1);
|
||||
// dac_enable(DAC1);
|
||||
// dac_software_trigger_enable(DAC1);
|
||||
do{
|
||||
DAC_SoftwareTriggerCmd(DAC_Channel_2,ENABLE);
|
||||
delay_us(2);
|
||||
read=DAC_GetDataOutputValue(DAC_Channel_2);
|
||||
}while(read!=dac_val);
|
||||
}
|
||||
|
||||
|
||||
|
@@ -10,8 +10,8 @@
|
||||
#include "base/utility.h"
|
||||
//#include "yecan.h"
|
||||
#include "hardware/jw3425iic.h"
|
||||
BoartCheck_st board_st;
|
||||
BoardInfo_un boardinfo_un;
|
||||
volatile BoartCheck_st board_st;
|
||||
volatile BoardInfo_un boardinfo_un;
|
||||
|
||||
void test_timer_function()
|
||||
{
|
||||
@@ -71,7 +71,7 @@ void Ye_BoardCheck(void)
|
||||
LED1_Out = 0;
|
||||
}
|
||||
PowerCalibration_set(POWER_DEF_V,45);
|
||||
delay_ms(100);
|
||||
delay_ms(5);
|
||||
board_st.bus_5p5v = Power_GetHPowerV();
|
||||
//
|
||||
#ifdef CHECKER_DEV
|
||||
|
@@ -4,13 +4,13 @@
|
||||
#include "base/delay.h"
|
||||
#define PowerCurr_AD_BUF_LEN 40
|
||||
#define POWER_SET_COUNT 20
|
||||
static CurrentSample_Range_eu latest_range = Current_Max;
|
||||
static PowerInfo_st def_power_st;
|
||||
static volatile CurrentSample_Range_eu latest_range = Current_Max;
|
||||
static volatile PowerInfo_st def_power_st;
|
||||
//static uint16_t PowerCurr_AD_buf[PowerCurr_AD_BUF_LEN];
|
||||
static float f_cur_k;
|
||||
static float f_cur_b;
|
||||
static uint8_t uc_power_cal_flag = 0;
|
||||
PowerInfo_st powerinfo_arrayst[POWER_SET_COUNT] ;
|
||||
static volatile float f_cur_k;
|
||||
static volatile float f_cur_b;
|
||||
static volatile uint8_t uc_power_cal_flag = 0;
|
||||
volatile PowerInfo_st powerinfo_arrayst[POWER_SET_COUNT] ;
|
||||
|
||||
/*
|
||||
@brief 获取内部基准1.2V电压对应的AD
|
||||
@@ -106,13 +106,13 @@ uint32_t Power_GetBousV()
|
||||
abus_v = Power_ADVGetCalVal_106(abus_v);
|
||||
abus_v = abus_v*11/100000;
|
||||
|
||||
hbus_v=Power_GetHPowerV();
|
||||
// hbus_v=Power_GetHPowerV();
|
||||
|
||||
//? 验证电压失调
|
||||
// 电压相差过大的时候输出一个离谱的值
|
||||
if((hbus_v>abus_v+10)||(abus_v>hbus_v+10)){
|
||||
abus_v=500;
|
||||
}
|
||||
// if((hbus_v>abus_v+10)||(abus_v>hbus_v+10)){
|
||||
// abus_v=500;
|
||||
// }
|
||||
|
||||
return abus_v;
|
||||
}
|
||||
@@ -451,15 +451,15 @@ void PowerCalibration(PowerInfo_st* info_st)
|
||||
//设置总线电压
|
||||
void PowerSetVoltage(PowerInfo_st* info_st)
|
||||
{
|
||||
memcpy(&def_power_st,info_st,sizeof(PowerInfo_st));
|
||||
memcpy((void *)&def_power_st,info_st,sizeof(PowerInfo_st));
|
||||
PowerUpFilter(info_st->V_LAH_DAC);
|
||||
C_H_DAC_Set(info_st->V_LAH_DAC);
|
||||
C_M_DAC_Set(info_st->V_LAM_DAC);
|
||||
POWER_ON;
|
||||
//? 验证电压失调
|
||||
delay_ms(5);
|
||||
C_H_DAC_Set(info_st->V_LAH_DAC);
|
||||
C_M_DAC_Set(info_st->V_LAM_DAC);
|
||||
// delay_ms(5);
|
||||
// C_H_DAC_Set(info_st->V_LAH_DAC);
|
||||
// C_M_DAC_Set(info_st->V_LAM_DAC);
|
||||
}
|
||||
//获取当前电压配置值
|
||||
void PowerGetSet(PowerInfo_st* info_st)
|
||||
@@ -503,7 +503,7 @@ uint8_t PowerCalibration_set(uint16_t h_v,uint16_t m_v)
|
||||
//在现有电压列表中能够查询到校准后的电压
|
||||
if(ul_index < POWER_SET_COUNT)
|
||||
{
|
||||
memcpy(&powerinfo_st,&powerinfo_arrayst[ul_index],sizeof(PowerInfo_st));
|
||||
memcpy((void *)&powerinfo_st,(void *)&powerinfo_arrayst[ul_index],sizeof(PowerInfo_st));
|
||||
PowerSetVoltage(&powerinfo_st);
|
||||
return 0;
|
||||
}
|
||||
@@ -524,7 +524,7 @@ uint8_t PowerCalibration_set(uint16_t h_v,uint16_t m_v)
|
||||
{
|
||||
if( powerinfo_arrayst[ul_index].V_LAH_DAC == 0 || powerinfo_arrayst[ul_index].V_LAM_DAC == 0)
|
||||
{
|
||||
memcpy(&powerinfo_arrayst[ul_index],&powerinfo_st,sizeof(PowerInfo_st));
|
||||
memcpy((void *)&powerinfo_arrayst[ul_index],&powerinfo_st,sizeof(PowerInfo_st));
|
||||
break;
|
||||
}
|
||||
ul_index++;
|
||||
|
@@ -1,7 +1,7 @@
|
||||
#include "base/define.h"
|
||||
#include "timer_cfg.h"
|
||||
#include "base/delay.h"
|
||||
Timerupdatefunc p_timer4update_func = NULL;
|
||||
volatile Timerupdatefunc p_timer4update_func = NULL;
|
||||
|
||||
|
||||
/*
|
||||
@@ -11,7 +11,7 @@ Timerupdatefunc p_timer4update_func = NULL;
|
||||
*/
|
||||
static volatile uint16_t amend_plus_count = 0;
|
||||
|
||||
TimerTriger p_timertriger = NULL;
|
||||
volatile TimerTriger p_timertriger = NULL;
|
||||
void FireBus_ClkAmend(uint16_t pre_us,uint16_t trigger_us,uint16_t count,void *p_fun)
|
||||
{
|
||||
|
||||
|
Reference in New Issue
Block a user