use adc calibrate and adc analog watch dog
parent
8fd856588a
commit
42afa920d2
|
@ -54,7 +54,7 @@
|
|||
#define configUSE_PREEMPTION 1
|
||||
#define configSUPPORT_STATIC_ALLOCATION 1
|
||||
#define configSUPPORT_DYNAMIC_ALLOCATION 1
|
||||
#define configUSE_IDLE_HOOK 0
|
||||
#define configUSE_IDLE_HOOK 1
|
||||
#define configUSE_TICK_HOOK 0
|
||||
#define configCPU_CLOCK_HZ ( SystemCoreClock )
|
||||
#define configTICK_RATE_HZ ((TickType_t)1000)
|
||||
|
@ -66,6 +66,7 @@
|
|||
#define configUSE_16_BIT_TICKS 0
|
||||
#define configUSE_MUTEXES 1
|
||||
#define configQUEUE_REGISTRY_SIZE 8
|
||||
#define configCHECK_FOR_STACK_OVERFLOW 1
|
||||
#define configUSE_RECURSIVE_MUTEXES 1
|
||||
#define configUSE_COUNTING_SEMAPHORES 1
|
||||
#define configUSE_PORT_OPTIMISED_TASK_SELECTION 0
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
#include "adc.h"
|
||||
#include "gpio.h"
|
||||
|
||||
#define ADC_CH_COUNT 5
|
||||
#define ADC_CH_COUNT 5+2 //number of adc channels (include temp sensor and vrefint adc_in17)
|
||||
|
||||
|
||||
|
||||
|
@ -26,21 +26,12 @@ typedef struct
|
|||
sleep, //SOCs and FANs are stop
|
||||
dfu, //device firmware update for SOM
|
||||
isp //in system program for BIOS
|
||||
}sta,next_sta;
|
||||
bool power_btn; //开关是否被按下
|
||||
bool custom_btn;
|
||||
bool pwr_led;
|
||||
bool run_led;
|
||||
}sta,next_sta; //power state machine
|
||||
bool power_btn; //power button
|
||||
bool custom_btn;//custom button
|
||||
bool pwr_led;//power led (on switch)
|
||||
bool run_led;//run led (on board)
|
||||
}sys;
|
||||
|
||||
// struct{
|
||||
|
||||
// bool fan_1;
|
||||
// bool fan_2;
|
||||
// bool fan_3;
|
||||
// }status;
|
||||
|
||||
|
||||
struct{
|
||||
bool mod_sleep;
|
||||
bool power_en;
|
||||
|
@ -50,21 +41,22 @@ typedef struct
|
|||
bool sleep_wake;
|
||||
}som;//som power management
|
||||
|
||||
struct{
|
||||
struct{
|
||||
uint32_t adc[ADC_CH_COUNT];
|
||||
|
||||
float out_24v_div16;
|
||||
float out_5v_div8;
|
||||
float out_12v_div8;
|
||||
float bkp_bat_div8;
|
||||
float main_pwr_div16;
|
||||
|
||||
float out_24v;//_div16
|
||||
float out_5v;//_div8
|
||||
float out_12v;//_div8
|
||||
float bkp_bat;//_div8
|
||||
float main_pwr;//_div16
|
||||
}rails;//power rails
|
||||
struct{
|
||||
bool temp_sen_en;
|
||||
bool temp_sen_alt;
|
||||
bool coulomb_alcc;
|
||||
bool chrg_stat2;
|
||||
bool chrg_stat1;
|
||||
|
||||
}sta;
|
||||
struct{
|
||||
float voltage;
|
||||
float current;
|
||||
|
@ -73,46 +65,57 @@ typedef struct
|
|||
}coulomb;
|
||||
}pmb;//power management board
|
||||
|
||||
struct{
|
||||
bool u2_vbus_1;
|
||||
bool u2_vbus_2;
|
||||
bool u2_vbus_3;
|
||||
bool u2_vbus_4;
|
||||
bool u2_vbus_5;
|
||||
bool u2_vbus_6;
|
||||
// struct{
|
||||
// bool u2_vbus_1;
|
||||
// bool u2_vbus_2;
|
||||
// bool u2_vbus_3;
|
||||
// bool u2_vbus_4;
|
||||
// bool u2_vbus_5;
|
||||
// bool u2_vbus_6;
|
||||
|
||||
bool u3_vbus_1;
|
||||
bool u3_vbus_2;
|
||||
bool u3_vbus_3;
|
||||
bool u3_vbus_4;
|
||||
bool u3_vbus_5;
|
||||
bool u3_vbus_6;
|
||||
}port;
|
||||
struct{
|
||||
bool u2_hub_pwr;
|
||||
bool u3_hub_pwr;
|
||||
bool u3_host_pwr;
|
||||
bool u3_gec_pwr;
|
||||
bool ge_sw_pwr;
|
||||
}soc;
|
||||
struct{
|
||||
bool fan_valid_1;
|
||||
bool fan_valid_2;
|
||||
bool fan_valid_3;
|
||||
}fan;
|
||||
// bool u3_vbus_1;
|
||||
// bool u3_vbus_2;
|
||||
// bool u3_vbus_3;
|
||||
// bool u3_vbus_4;
|
||||
// bool u3_vbus_5;
|
||||
// bool u3_vbus_6;
|
||||
// }port;
|
||||
// struct{
|
||||
// bool u2_hub_pwr;
|
||||
// bool u3_hub_pwr;
|
||||
// bool u3_host_pwr;
|
||||
// bool u3_gec_pwr;
|
||||
// bool ge_sw_pwr;
|
||||
// }soc;
|
||||
// struct{
|
||||
// bool fan_valid_1;
|
||||
// bool fan_valid_2;
|
||||
// bool fan_valid_3;
|
||||
// }fan;
|
||||
// struct{
|
||||
|
||||
|
||||
|
||||
struct {
|
||||
float sensor_1;
|
||||
float sensor_2;
|
||||
float sensor_3;
|
||||
}temp;
|
||||
// bool fan_1;
|
||||
// bool fan_2;
|
||||
// bool fan_3;
|
||||
// }status;
|
||||
// struct {
|
||||
// float sensor_1;
|
||||
// float sensor_2;
|
||||
// float sensor_3;
|
||||
// }temp;
|
||||
|
||||
}NaviKit_t;
|
||||
extern NaviKit_t NaviKit;
|
||||
|
||||
void NaviKit_var_init();
|
||||
|
||||
//power state machine switch function
|
||||
void enter_isp_state();
|
||||
void enter_runing_state();
|
||||
void enter_shutdown_state();
|
||||
void enter_sleep_state();
|
||||
void enter_dfu_state();
|
||||
|
||||
void Beep(uint32_t time_ms);
|
||||
|
||||
void HAL_ADC_ConvCpltCallback(ADC_HandleTypeDef* hadc);
|
||||
|
|
|
@ -54,6 +54,7 @@ void BusFault_Handler(void);
|
|||
void UsageFault_Handler(void);
|
||||
void DebugMon_Handler(void);
|
||||
void PVD_IRQHandler(void);
|
||||
void RTC_IRQHandler(void);
|
||||
void FLASH_IRQHandler(void);
|
||||
void RCC_IRQHandler(void);
|
||||
void EXTI0_IRQHandler(void);
|
||||
|
|
|
@ -21,6 +21,9 @@
|
|||
#include "adc.h"
|
||||
|
||||
/* USER CODE BEGIN 0 */
|
||||
//watch dog threshold setting:
|
||||
//1828--35°C
|
||||
//1721--15°C
|
||||
|
||||
/* USER CODE END 0 */
|
||||
|
||||
|
@ -30,6 +33,7 @@ DMA_HandleTypeDef hdma_adc1;
|
|||
/* ADC1 init function */
|
||||
void MX_ADC1_Init(void)
|
||||
{
|
||||
ADC_AnalogWDGConfTypeDef AnalogWDGConfig = {0};
|
||||
ADC_ChannelConfTypeDef sConfig = {0};
|
||||
|
||||
/** Common config
|
||||
|
@ -40,14 +44,25 @@ void MX_ADC1_Init(void)
|
|||
hadc1.Init.DiscontinuousConvMode = DISABLE;
|
||||
hadc1.Init.ExternalTrigConv = ADC_SOFTWARE_START;
|
||||
hadc1.Init.DataAlign = ADC_DATAALIGN_RIGHT;
|
||||
hadc1.Init.NbrOfConversion = 5;
|
||||
hadc1.Init.NbrOfConversion = 7;
|
||||
if (HAL_ADC_Init(&hadc1) != HAL_OK)
|
||||
{
|
||||
Error_Handler();
|
||||
}
|
||||
/** Configure Analog WatchDog 1
|
||||
*/
|
||||
AnalogWDGConfig.WatchdogMode = ADC_ANALOGWATCHDOG_SINGLE_REG;
|
||||
AnalogWDGConfig.HighThreshold = 1828;
|
||||
AnalogWDGConfig.LowThreshold = 1721;
|
||||
AnalogWDGConfig.Channel = ADC_CHANNEL_TEMPSENSOR;
|
||||
AnalogWDGConfig.ITMode = ENABLE;
|
||||
if (HAL_ADC_AnalogWDGConfig(&hadc1, &AnalogWDGConfig) != HAL_OK)
|
||||
{
|
||||
Error_Handler();
|
||||
}
|
||||
/** Configure Regular Channel
|
||||
*/
|
||||
sConfig.Channel = ADC_CHANNEL_3;
|
||||
sConfig.Channel = ADC_CHANNEL_TEMPSENSOR;
|
||||
sConfig.Rank = ADC_REGULAR_RANK_1;
|
||||
sConfig.SamplingTime = ADC_SAMPLETIME_239CYCLES_5;
|
||||
if (HAL_ADC_ConfigChannel(&hadc1, &sConfig) != HAL_OK)
|
||||
|
@ -56,7 +71,7 @@ void MX_ADC1_Init(void)
|
|||
}
|
||||
/** Configure Regular Channel
|
||||
*/
|
||||
sConfig.Channel = ADC_CHANNEL_4;
|
||||
sConfig.Channel = ADC_CHANNEL_VREFINT;
|
||||
sConfig.Rank = ADC_REGULAR_RANK_2;
|
||||
if (HAL_ADC_ConfigChannel(&hadc1, &sConfig) != HAL_OK)
|
||||
{
|
||||
|
@ -64,7 +79,7 @@ void MX_ADC1_Init(void)
|
|||
}
|
||||
/** Configure Regular Channel
|
||||
*/
|
||||
sConfig.Channel = ADC_CHANNEL_5;
|
||||
sConfig.Channel = ADC_CHANNEL_3;
|
||||
sConfig.Rank = ADC_REGULAR_RANK_3;
|
||||
if (HAL_ADC_ConfigChannel(&hadc1, &sConfig) != HAL_OK)
|
||||
{
|
||||
|
@ -72,7 +87,7 @@ void MX_ADC1_Init(void)
|
|||
}
|
||||
/** Configure Regular Channel
|
||||
*/
|
||||
sConfig.Channel = ADC_CHANNEL_6;
|
||||
sConfig.Channel = ADC_CHANNEL_4;
|
||||
sConfig.Rank = ADC_REGULAR_RANK_4;
|
||||
if (HAL_ADC_ConfigChannel(&hadc1, &sConfig) != HAL_OK)
|
||||
{
|
||||
|
@ -80,12 +95,28 @@ void MX_ADC1_Init(void)
|
|||
}
|
||||
/** Configure Regular Channel
|
||||
*/
|
||||
sConfig.Channel = ADC_CHANNEL_7;
|
||||
sConfig.Channel = ADC_CHANNEL_5;
|
||||
sConfig.Rank = ADC_REGULAR_RANK_5;
|
||||
if (HAL_ADC_ConfigChannel(&hadc1, &sConfig) != HAL_OK)
|
||||
{
|
||||
Error_Handler();
|
||||
}
|
||||
/** Configure Regular Channel
|
||||
*/
|
||||
sConfig.Channel = ADC_CHANNEL_6;
|
||||
sConfig.Rank = ADC_REGULAR_RANK_6;
|
||||
if (HAL_ADC_ConfigChannel(&hadc1, &sConfig) != HAL_OK)
|
||||
{
|
||||
Error_Handler();
|
||||
}
|
||||
/** Configure Regular Channel
|
||||
*/
|
||||
sConfig.Channel = ADC_CHANNEL_7;
|
||||
sConfig.Rank = ADC_REGULAR_RANK_7;
|
||||
if (HAL_ADC_ConfigChannel(&hadc1, &sConfig) != HAL_OK)
|
||||
{
|
||||
Error_Handler();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -104,6 +104,16 @@ const osThreadAttr_t PowerMonitTask_attributes = {
|
|||
.priority = (osPriority_t) osPriorityLow,
|
||||
.stack_size = 128 * 4
|
||||
};
|
||||
/* Definitions for uartQueue */
|
||||
osMessageQueueId_t uartQueueHandle;
|
||||
const osMessageQueueAttr_t uartQueue_attributes = {
|
||||
.name = "uartQueue"
|
||||
};
|
||||
/* Definitions for uartMutex */
|
||||
osMutexId_t uartMutexHandle;
|
||||
const osMutexAttr_t uartMutex_attributes = {
|
||||
.name = "uartMutex"
|
||||
};
|
||||
|
||||
/* Private function prototypes -----------------------------------------------*/
|
||||
/* USER CODE BEGIN FunctionPrototypes */
|
||||
|
@ -120,6 +130,34 @@ void StartPowerMonitTask(void *argument);
|
|||
extern void MX_USB_DEVICE_Init(void);
|
||||
void MX_FREERTOS_Init(void); /* (MISRA C 2004 rule 8.1) */
|
||||
|
||||
/* Hook prototypes */
|
||||
void vApplicationIdleHook(void);
|
||||
void vApplicationStackOverflowHook(xTaskHandle xTask, signed char *pcTaskName);
|
||||
|
||||
/* USER CODE BEGIN 2 */
|
||||
__weak void vApplicationIdleHook( void )
|
||||
{
|
||||
/* vApplicationIdleHook() will only be called if configUSE_IDLE_HOOK is set
|
||||
to 1 in FreeRTOSConfig.h. It will be called on each iteration of the idle
|
||||
task. It is essential that code added to this hook function never attempts
|
||||
to block in any way (for example, call xQueueReceive() with a block time
|
||||
specified, or call vTaskDelay()). If the application makes use of the
|
||||
vTaskDelete() API function (as this demo application does) then it is also
|
||||
important that vApplicationIdleHook() is permitted to return to its calling
|
||||
function, because it is the responsibility of the idle task to clean up
|
||||
memory allocated by the kernel to any task that has since been deleted. */
|
||||
}
|
||||
/* USER CODE END 2 */
|
||||
|
||||
/* USER CODE BEGIN 4 */
|
||||
__weak void vApplicationStackOverflowHook(xTaskHandle xTask, signed char *pcTaskName)
|
||||
{
|
||||
/* Run time stack overflow checking is performed if
|
||||
configCHECK_FOR_STACK_OVERFLOW is defined to 1 or 2. This hook function is
|
||||
called if a stack overflow is detected. */
|
||||
}
|
||||
/* USER CODE END 4 */
|
||||
|
||||
/**
|
||||
* @brief FreeRTOS initialization
|
||||
* @param None
|
||||
|
@ -129,6 +167,9 @@ void MX_FREERTOS_Init(void) {
|
|||
/* USER CODE BEGIN Init */
|
||||
|
||||
/* USER CODE END Init */
|
||||
/* Create the mutex(es) */
|
||||
/* creation of uartMutex */
|
||||
uartMutexHandle = osMutexNew(&uartMutex_attributes);
|
||||
|
||||
/* USER CODE BEGIN RTOS_MUTEX */
|
||||
/* add mutexes, ... */
|
||||
|
@ -142,6 +183,10 @@ void MX_FREERTOS_Init(void) {
|
|||
/* start timers, add new ones, ... */
|
||||
/* USER CODE END RTOS_TIMERS */
|
||||
|
||||
/* Create the queue(s) */
|
||||
/* creation of uartQueue */
|
||||
uartQueueHandle = osMessageQueueNew (256, sizeof(uint8_t), &uartQueue_attributes);
|
||||
|
||||
/* USER CODE BEGIN RTOS_QUEUES */
|
||||
/* add queues, ... */
|
||||
/* USER CODE END RTOS_QUEUES */
|
||||
|
@ -189,11 +234,13 @@ void StartDefaultTask(void *argument)
|
|||
/* USER CODE BEGIN StartDefaultTask */
|
||||
HAL_GPIO_WritePin(USB2_FS_ENUM_CTL_GPIO_Port,USB2_FS_ENUM_CTL_Pin, GPIO_PIN_SET);
|
||||
Beep(50);
|
||||
|
||||
|
||||
/* Infinite loop */
|
||||
for(;;)
|
||||
{
|
||||
osDelay(1000);
|
||||
printf("Time:[%f s]; OUT_24:[%f V]; OUT_5:[%f V]; OUT_12:[%f V]; BKP_BAT:[%f V]; MAIN_PWR:[%f V]\n",(float)(osKernelGetTickCount()/1000.0),NaviKit.pmb.out_24v_div16,NaviKit.pmb.out_5v_div8,NaviKit.pmb.out_12v_div8,NaviKit.pmb.bkp_bat_div8,NaviKit.pmb.main_pwr_div16);
|
||||
printf("Time:[%f s]; OUT_24:[%f V]; OUT_5:[%f V]; OUT_12:[%f V]; BKP_BAT:[%f V]; MAIN_PWR:[%f V]\n",(float)(osKernelGetTickCount()/1000.0),NaviKit.pmb.rails.out_24v,NaviKit.pmb.rails.out_5v,NaviKit.pmb.rails.out_12v,NaviKit.pmb.rails.bkp_bat,NaviKit.pmb.rails.main_pwr);
|
||||
|
||||
}
|
||||
/* USER CODE END StartDefaultTask */
|
||||
|
@ -335,8 +382,12 @@ void StartEventDetect(void *argument)
|
|||
|
||||
if(NaviKit.sys.power_btn == true)
|
||||
{//power btn has been pushed
|
||||
osDelay(1000);
|
||||
if(NaviKit.sys.power_btn == true)
|
||||
uint8_t count =0;
|
||||
while(NaviKit.sys.power_btn && count<=10){
|
||||
osDelay(100);
|
||||
count ++;
|
||||
}
|
||||
if(count >10)
|
||||
{//power btn has been pushed more than 1000 ms
|
||||
// while(NaviKit.sys.power_btn == true);//wait to release button
|
||||
switch(NaviKit.sys.sta){
|
||||
|
@ -365,8 +416,12 @@ void StartEventDetect(void *argument)
|
|||
}
|
||||
if(NaviKit.sys.custom_btn == true )
|
||||
{//custom button has been pushed
|
||||
osDelay(2000);
|
||||
if(NaviKit.sys.custom_btn == true )
|
||||
uint8_t count =0;
|
||||
while(NaviKit.sys.custom_btn && count<=10){
|
||||
osDelay(100);
|
||||
count ++;
|
||||
}
|
||||
if(count > 20 )
|
||||
{//custom button has been pushed over 1000 ms
|
||||
if((NaviKit.sys.power_btn == true) && (NaviKit.sys.sta == shutdown))//into dfu state
|
||||
NaviKit.sys.next_sta = dfu;
|
||||
|
@ -408,7 +463,7 @@ void StartCoulombRead(void *argument)
|
|||
{
|
||||
coulomb_read_status_and_config();
|
||||
coulomb_read_status_raw_to_actual();
|
||||
if(NaviKit.sys.sta)
|
||||
if(NaviKit.sys.sta == runing)
|
||||
osDelay(500);
|
||||
else
|
||||
osDelay(5000);
|
||||
|
@ -474,7 +529,8 @@ void StartStateSwitchTask(void *argument)
|
|||
void StartPowerMonitTask(void *argument)
|
||||
{
|
||||
/* USER CODE BEGIN StartPowerMonitTask */
|
||||
HAL_ADC_Start_DMA(&hadc1, &(NaviKit.pmb.adc), ADC_CH_COUNT);
|
||||
HAL_ADCEx_Calibration_Start(&hadc1);
|
||||
HAL_ADC_Start_DMA(&hadc1, &(NaviKit.pmb.rails.adc), ADC_CH_COUNT);
|
||||
/* Infinite loop */
|
||||
for(;;)
|
||||
{
|
||||
|
@ -507,191 +563,7 @@ void StartPowerMonitTask(void *argument)
|
|||
/* USER CODE BEGIN Application */
|
||||
|
||||
|
||||
//write "bios update flag" to bkp register, and reset system
|
||||
void enter_isp_state()
|
||||
{
|
||||
RTC_HandleTypeDef hrtc;
|
||||
|
||||
hrtc.Instance = RTC;
|
||||
|
||||
__HAL_RCC_PWR_CLK_ENABLE();
|
||||
__HAL_RCC_BKP_CLK_ENABLE();
|
||||
__HAL_RCC_RTC_CONFIG(RCC_RTCCLKSOURCE_HSE_DIV128);
|
||||
__HAL_RCC_RTC_ENABLE();
|
||||
HAL_PWR_EnableBkUpAccess();
|
||||
|
||||
HAL_RTCEx_BKUPWrite(&hrtc,RTC_BKP_DR1,0x32f2);
|
||||
|
||||
HAL_Delay(10);
|
||||
if(HAL_RTCEx_BKUPRead(&hrtc,RTC_BKP_DR1) == 0x32f2)
|
||||
{//write successful
|
||||
Beep(500);
|
||||
Beep(500);
|
||||
Beep(500);
|
||||
printf("Enter to BIOS update state.\n");
|
||||
printf("System will reboot ,then run ISP automatic.\n");
|
||||
HAL_NVIC_SystemReset();
|
||||
}
|
||||
else{
|
||||
printf("Backup Register Writen error, can not enter BIOS update state \n");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void enter_shutdown_state()
|
||||
{
|
||||
printf("Enter to shutdown state \n");
|
||||
Beep(50);
|
||||
|
||||
HAL_GPIO_WritePin(SOM_POWER_EN_GPIO_Port ,SOM_POWER_EN_Pin, GPIO_PIN_RESET); osDelay(100);
|
||||
|
||||
HAL_GPIO_WritePin(SOC_U3_HUB_PWR_CTL_GPIO_Port,SOC_U3_HUB_PWR_CTL_Pin, GPIO_PIN_RESET); osDelay(100);
|
||||
HAL_GPIO_WritePin(SOC_U2_HUB_PWR_CTL_GPIO_Port,SOC_U2_HUB_PWR_CTL_Pin, GPIO_PIN_RESET); osDelay(100);
|
||||
// HAL_GPIO_WritePin(SOC_U3_HOST_PWR_CTL_GPIO_Port,SOC_U3_HOST_PWR_CTL_Pin, GPIO_PIN_RESET); osDelay(100);
|
||||
HAL_GPIO_WritePin(SOC_GE_SW_PWR_CTL_GPIO_Port,SOC_GE_SW_PWR_CTL_Pin, GPIO_PIN_RESET); osDelay(100);
|
||||
HAL_GPIO_WritePin(SOC_U3_GEC_PWR_CTL_GPIO_Port,SOC_U3_GEC_PWR_CTL_Pin, GPIO_PIN_RESET); osDelay(100);
|
||||
|
||||
|
||||
HAL_GPIO_WritePin(USB3_VBUS_CTL_4_GPIO_Port,USB3_VBUS_CTL_4_Pin, GPIO_PIN_RESET); osDelay(100);
|
||||
HAL_GPIO_WritePin(USB3_VBUS_CTL_3_GPIO_Port,USB3_VBUS_CTL_3_Pin, GPIO_PIN_RESET); osDelay(100);
|
||||
HAL_GPIO_WritePin(USB3_VBUS_CTL_2_GPIO_Port,USB3_VBUS_CTL_2_Pin, GPIO_PIN_RESET); osDelay(100);
|
||||
HAL_GPIO_WritePin(USB3_VBUS_CTL_1_GPIO_Port,USB3_VBUS_CTL_1_Pin, GPIO_PIN_RESET); osDelay(100);
|
||||
HAL_GPIO_WritePin(USB3_VBUS_CTL_6_GPIO_Port,USB3_VBUS_CTL_6_Pin, GPIO_PIN_RESET); osDelay(100);
|
||||
HAL_GPIO_WritePin(USB3_VBUS_CTL_5_GPIO_Port,USB3_VBUS_CTL_5_Pin, GPIO_PIN_RESET); osDelay(100);
|
||||
|
||||
HAL_GPIO_WritePin(USB2_VBUS_CTL_6_GPIO_Port,USB2_VBUS_CTL_6_Pin, GPIO_PIN_RESET); osDelay(100);
|
||||
HAL_GPIO_WritePin(USB2_VBUS_CTL_5_GPIO_Port,USB2_VBUS_CTL_5_Pin, GPIO_PIN_RESET); osDelay(100);
|
||||
HAL_GPIO_WritePin(USB2_VBUS_CTL_4_GPIO_Port,USB2_VBUS_CTL_4_Pin, GPIO_PIN_RESET); osDelay(100);
|
||||
HAL_GPIO_WritePin(USB2_VBUS_CTL_3_GPIO_Port,USB2_VBUS_CTL_3_Pin, GPIO_PIN_RESET); osDelay(100);
|
||||
HAL_GPIO_WritePin(USB2_VBUS_CTL_2_GPIO_Port,USB2_VBUS_CTL_2_Pin, GPIO_PIN_RESET); osDelay(100);
|
||||
HAL_GPIO_WritePin(USB2_VBUS_CTL_1_GPIO_Port,USB2_VBUS_CTL_1_Pin, GPIO_PIN_RESET); osDelay(100);
|
||||
|
||||
HAL_GPIO_WritePin(SYS_FAN_CTL_1_GPIO_Port,SYS_FAN_CTL_1_Pin,GPIO_PIN_RESET); osDelay(100);
|
||||
HAL_GPIO_WritePin(SYS_FAN_CTL_2_GPIO_Port,SYS_FAN_CTL_2_Pin,GPIO_PIN_RESET); osDelay(100);
|
||||
HAL_GPIO_WritePin(SYS_FAN_CTL_3_GPIO_Port,SYS_FAN_CTL_3_Pin,GPIO_PIN_RESET); osDelay(100);
|
||||
|
||||
HAL_GPIO_WritePin(PMB_PS_ON_GPIO_Port ,PMB_PS_ON_Pin, GPIO_PIN_RESET); osDelay(100);
|
||||
|
||||
}
|
||||
void enter_sleep_state()
|
||||
{
|
||||
printf("Enter to sleep state \n");
|
||||
Beep(50);
|
||||
|
||||
// HAL_GPIO_WritePin(SOC_U3_HUB_PWR_CTL_GPIO_Port,SOC_U3_HUB_PWR_CTL_Pin, GPIO_PIN_RESET); osDelay(100);
|
||||
HAL_GPIO_WritePin(SOC_U2_HUB_PWR_CTL_GPIO_Port,SOC_U2_HUB_PWR_CTL_Pin, GPIO_PIN_RESET); osDelay(100);
|
||||
// HAL_GPIO_WritePin(SOC_U3_HOST_PWR_CTL_GPIO_Port,SOC_U3_HOST_PWR_CTL_Pin, GPIO_PIN_RESET); osDelay(100);
|
||||
HAL_GPIO_WritePin(SOC_GE_SW_PWR_CTL_GPIO_Port,SOC_GE_SW_PWR_CTL_Pin, GPIO_PIN_RESET); osDelay(100);
|
||||
// HAL_GPIO_WritePin(SOC_U3_GEC_PWR_CTL_GPIO_Port,SOC_U3_GEC_PWR_CTL_Pin, GPIO_PIN_RESET); osDelay(100);
|
||||
|
||||
|
||||
HAL_GPIO_WritePin(USB3_VBUS_CTL_4_GPIO_Port,USB3_VBUS_CTL_4_Pin, GPIO_PIN_RESET); osDelay(100);
|
||||
HAL_GPIO_WritePin(USB3_VBUS_CTL_3_GPIO_Port,USB3_VBUS_CTL_3_Pin, GPIO_PIN_RESET); osDelay(100);
|
||||
HAL_GPIO_WritePin(USB3_VBUS_CTL_2_GPIO_Port,USB3_VBUS_CTL_2_Pin, GPIO_PIN_RESET); osDelay(100);
|
||||
HAL_GPIO_WritePin(USB3_VBUS_CTL_1_GPIO_Port,USB3_VBUS_CTL_1_Pin, GPIO_PIN_RESET); osDelay(100);
|
||||
// HAL_GPIO_WritePin(USB3_VBUS_CTL_6_GPIO_Port,USB3_VBUS_CTL_6_Pin, GPIO_PIN_RESET); osDelay(100);
|
||||
// HAL_GPIO_WritePin(USB3_VBUS_CTL_5_GPIO_Port,USB3_VBUS_CTL_5_Pin, GPIO_PIN_RESET); osDelay(100);
|
||||
|
||||
HAL_GPIO_WritePin(USB2_VBUS_CTL_6_GPIO_Port,USB2_VBUS_CTL_6_Pin, GPIO_PIN_RESET); osDelay(100);
|
||||
HAL_GPIO_WritePin(USB2_VBUS_CTL_5_GPIO_Port,USB2_VBUS_CTL_5_Pin, GPIO_PIN_RESET); osDelay(100);
|
||||
HAL_GPIO_WritePin(USB2_VBUS_CTL_4_GPIO_Port,USB2_VBUS_CTL_4_Pin, GPIO_PIN_RESET); osDelay(100);
|
||||
HAL_GPIO_WritePin(USB2_VBUS_CTL_3_GPIO_Port,USB2_VBUS_CTL_3_Pin, GPIO_PIN_RESET); osDelay(100);
|
||||
HAL_GPIO_WritePin(USB2_VBUS_CTL_2_GPIO_Port,USB2_VBUS_CTL_2_Pin, GPIO_PIN_RESET); osDelay(100);
|
||||
HAL_GPIO_WritePin(USB2_VBUS_CTL_1_GPIO_Port,USB2_VBUS_CTL_1_Pin, GPIO_PIN_RESET); osDelay(100);
|
||||
|
||||
HAL_GPIO_WritePin(SYS_FAN_CTL_1_GPIO_Port,SYS_FAN_CTL_1_Pin,GPIO_PIN_RESET); osDelay(100);
|
||||
HAL_GPIO_WritePin(SYS_FAN_CTL_2_GPIO_Port,SYS_FAN_CTL_2_Pin,GPIO_PIN_RESET); osDelay(100);
|
||||
HAL_GPIO_WritePin(SYS_FAN_CTL_3_GPIO_Port,SYS_FAN_CTL_3_Pin,GPIO_PIN_RESET); osDelay(100);
|
||||
}
|
||||
|
||||
void enter_runing_state()
|
||||
{
|
||||
|
||||
printf("Enter to runing state \n");
|
||||
Beep(200);
|
||||
|
||||
HAL_GPIO_WritePin(SOM_FORCE_RECOVERY_GPIO_Port ,SOM_FORCE_RECOVERY_Pin, GPIO_PIN_SET); osDelay(100);
|
||||
HAL_GPIO_WritePin(PMB_PS_ON_GPIO_Port ,PMB_PS_ON_Pin, GPIO_PIN_SET); osDelay(100);
|
||||
|
||||
HAL_GPIO_WritePin(SYS_FAN_CTL_1_GPIO_Port,SYS_FAN_CTL_1_Pin,GPIO_PIN_SET); osDelay(100);
|
||||
HAL_GPIO_WritePin(SYS_FAN_CTL_2_GPIO_Port,SYS_FAN_CTL_2_Pin,GPIO_PIN_SET); osDelay(100);
|
||||
HAL_GPIO_WritePin(SYS_FAN_CTL_3_GPIO_Port,SYS_FAN_CTL_3_Pin,GPIO_PIN_SET); osDelay(100);
|
||||
|
||||
HAL_GPIO_WritePin(SOC_U3_HUB_PWR_CTL_GPIO_Port,SOC_U3_HUB_PWR_CTL_Pin, GPIO_PIN_SET); osDelay(100);
|
||||
HAL_GPIO_WritePin(SOC_U2_HUB_PWR_CTL_GPIO_Port,SOC_U2_HUB_PWR_CTL_Pin, GPIO_PIN_SET); osDelay(100);
|
||||
// HAL_GPIO_WritePin(SOC_U3_HOST_PWR_CTL_GPIO_Port,SOC_U3_HOST_PWR_CTL_Pin, GPIO_PIN_SET); osDelay(100);
|
||||
HAL_GPIO_WritePin(SOC_GE_SW_PWR_CTL_GPIO_Port,SOC_GE_SW_PWR_CTL_Pin, GPIO_PIN_SET); osDelay(100);
|
||||
HAL_GPIO_WritePin(SOC_U3_GEC_PWR_CTL_GPIO_Port,SOC_U3_GEC_PWR_CTL_Pin, GPIO_PIN_SET); osDelay(100);
|
||||
|
||||
HAL_GPIO_WritePin(USB2_VBUS_CTL_1_GPIO_Port,USB2_VBUS_CTL_1_Pin, GPIO_PIN_SET); osDelay(100);
|
||||
HAL_GPIO_WritePin(USB2_VBUS_CTL_2_GPIO_Port,USB2_VBUS_CTL_2_Pin, GPIO_PIN_SET); osDelay(100);
|
||||
HAL_GPIO_WritePin(USB2_VBUS_CTL_3_GPIO_Port,USB2_VBUS_CTL_3_Pin, GPIO_PIN_SET); osDelay(100);
|
||||
HAL_GPIO_WritePin(USB2_VBUS_CTL_4_GPIO_Port,USB2_VBUS_CTL_4_Pin, GPIO_PIN_SET); osDelay(100);
|
||||
HAL_GPIO_WritePin(USB2_VBUS_CTL_5_GPIO_Port,USB2_VBUS_CTL_5_Pin, GPIO_PIN_SET); osDelay(100);
|
||||
HAL_GPIO_WritePin(USB2_VBUS_CTL_6_GPIO_Port,USB2_VBUS_CTL_6_Pin, GPIO_PIN_SET); osDelay(100);
|
||||
|
||||
HAL_GPIO_WritePin(USB3_VBUS_CTL_5_GPIO_Port,USB3_VBUS_CTL_5_Pin, GPIO_PIN_SET); osDelay(100);
|
||||
HAL_GPIO_WritePin(USB3_VBUS_CTL_6_GPIO_Port,USB3_VBUS_CTL_6_Pin, GPIO_PIN_SET); osDelay(100);
|
||||
// HAL_GPIO_WritePin(USB3_VBUS_CTL_1_GPIO_Port,USB3_VBUS_CTL_1_Pin, GPIO_PIN_SET); osDelay(100);
|
||||
// HAL_GPIO_WritePin(USB3_VBUS_CTL_2_GPIO_Port,USB3_VBUS_CTL_2_Pin, GPIO_PIN_SET); osDelay(100);
|
||||
// HAL_GPIO_WritePin(USB3_VBUS_CTL_3_GPIO_Port,USB3_VBUS_CTL_3_Pin, GPIO_PIN_SET); osDelay(100);
|
||||
// HAL_GPIO_WritePin(USB3_VBUS_CTL_4_GPIO_Port,USB3_VBUS_CTL_4_Pin, GPIO_PIN_SET); osDelay(100);
|
||||
|
||||
HAL_GPIO_WritePin(SOM_POWER_EN_GPIO_Port ,SOM_POWER_EN_Pin, GPIO_PIN_SET); osDelay(100);
|
||||
|
||||
}
|
||||
|
||||
void enter_dfu_state()
|
||||
{
|
||||
|
||||
printf("Enter to dfu state \n");
|
||||
Beep(200);
|
||||
Beep(200);
|
||||
Beep(200);
|
||||
Beep(200);
|
||||
Beep(200);
|
||||
|
||||
HAL_GPIO_WritePin(SOM_FORCE_RECOVERY_GPIO_Port ,SOM_FORCE_RECOVERY_Pin, GPIO_PIN_RESET); osDelay(100);
|
||||
|
||||
HAL_GPIO_WritePin(PMB_PS_ON_GPIO_Port ,PMB_PS_ON_Pin, GPIO_PIN_SET); osDelay(100);
|
||||
|
||||
HAL_GPIO_WritePin(SYS_FAN_CTL_1_GPIO_Port,SYS_FAN_CTL_1_Pin,GPIO_PIN_SET); osDelay(100);
|
||||
HAL_GPIO_WritePin(SYS_FAN_CTL_2_GPIO_Port,SYS_FAN_CTL_2_Pin,GPIO_PIN_SET); osDelay(100);
|
||||
HAL_GPIO_WritePin(SYS_FAN_CTL_3_GPIO_Port,SYS_FAN_CTL_3_Pin,GPIO_PIN_SET); osDelay(100);
|
||||
|
||||
HAL_GPIO_WritePin(SOC_U3_HUB_PWR_CTL_GPIO_Port,SOC_U3_HUB_PWR_CTL_Pin, GPIO_PIN_SET); osDelay(100);
|
||||
HAL_GPIO_WritePin(SOC_U2_HUB_PWR_CTL_GPIO_Port,SOC_U2_HUB_PWR_CTL_Pin, GPIO_PIN_SET); osDelay(100);
|
||||
// HAL_GPIO_WritePin(SOC_U3_HOST_PWR_CTL_GPIO_Port,SOC_U3_HOST_PWR_CTL_Pin, GPIO_PIN_SET); osDelay(100);
|
||||
HAL_GPIO_WritePin(SOC_GE_SW_PWR_CTL_GPIO_Port,SOC_GE_SW_PWR_CTL_Pin, GPIO_PIN_SET); osDelay(100);
|
||||
HAL_GPIO_WritePin(SOC_U3_GEC_PWR_CTL_GPIO_Port,SOC_U3_GEC_PWR_CTL_Pin, GPIO_PIN_SET); osDelay(100);
|
||||
|
||||
HAL_GPIO_WritePin(USB2_VBUS_CTL_1_GPIO_Port,USB2_VBUS_CTL_1_Pin, GPIO_PIN_SET); osDelay(100);
|
||||
HAL_GPIO_WritePin(USB2_VBUS_CTL_2_GPIO_Port,USB2_VBUS_CTL_2_Pin, GPIO_PIN_SET); osDelay(100);
|
||||
HAL_GPIO_WritePin(USB2_VBUS_CTL_3_GPIO_Port,USB2_VBUS_CTL_3_Pin, GPIO_PIN_SET); osDelay(100);
|
||||
HAL_GPIO_WritePin(USB2_VBUS_CTL_4_GPIO_Port,USB2_VBUS_CTL_4_Pin, GPIO_PIN_SET); osDelay(100);
|
||||
HAL_GPIO_WritePin(USB2_VBUS_CTL_5_GPIO_Port,USB2_VBUS_CTL_5_Pin, GPIO_PIN_SET); osDelay(100);
|
||||
HAL_GPIO_WritePin(USB2_VBUS_CTL_6_GPIO_Port,USB2_VBUS_CTL_6_Pin, GPIO_PIN_SET); osDelay(100);
|
||||
|
||||
HAL_GPIO_WritePin(USB3_VBUS_CTL_5_GPIO_Port,USB3_VBUS_CTL_5_Pin, GPIO_PIN_SET); osDelay(100);
|
||||
HAL_GPIO_WritePin(USB3_VBUS_CTL_6_GPIO_Port,USB3_VBUS_CTL_6_Pin, GPIO_PIN_SET); osDelay(100);
|
||||
// HAL_GPIO_WritePin(USB3_VBUS_CTL_1_GPIO_Port,USB3_VBUS_CTL_1_Pin, GPIO_PIN_SET); osDelay(100);
|
||||
// HAL_GPIO_WritePin(USB3_VBUS_CTL_2_GPIO_Port,USB3_VBUS_CTL_2_Pin, GPIO_PIN_SET); osDelay(100);
|
||||
// HAL_GPIO_WritePin(USB3_VBUS_CTL_3_GPIO_Port,USB3_VBUS_CTL_3_Pin, GPIO_PIN_SET); osDelay(100);
|
||||
// HAL_GPIO_WritePin(USB3_VBUS_CTL_4_GPIO_Port,USB3_VBUS_CTL_4_Pin, GPIO_PIN_SET); osDelay(100);
|
||||
|
||||
|
||||
HAL_GPIO_WritePin(SOM_POWER_EN_GPIO_Port ,SOM_POWER_EN_Pin, GPIO_PIN_SET); osDelay(1000);
|
||||
//
|
||||
// HAL_GPIO_WritePin(SOM_FORCE_RECOVERY_GPIO_Port ,SOM_FORCE_RECOVERY_Pin, GPIO_PIN_RESET); osDelay(100);
|
||||
// HAL_GPIO_WritePin(SOM_SYS_RESET_GPIO_Port ,SOM_SYS_RESET_Pin, GPIO_PIN_RESET); osDelay(100);
|
||||
//
|
||||
// osDelay(5000);
|
||||
// HAL_GPIO_WritePin(SOM_SYS_RESET_GPIO_Port ,SOM_SYS_RESET_Pin, GPIO_PIN_SET); osDelay(100);
|
||||
// HAL_GPIO_WritePin(SOM_FORCE_RECOVERY_GPIO_Port ,SOM_FORCE_RECOVERY_Pin, GPIO_PIN_SET); osDelay(100);
|
||||
|
||||
|
||||
}
|
||||
|
||||
//printf redefine
|
||||
#ifdef __GNUC__
|
||||
|
|
|
@ -109,8 +109,14 @@ int main(void)
|
|||
MX_NVIC_Init();
|
||||
/* USER CODE BEGIN 2 */
|
||||
//HAL_IWDG_Refresh(&hiwdg);
|
||||
printf("------------------------------------\n");
|
||||
printf("Core initial successfully\n");
|
||||
printf("BIOS Version: V0.9 ,build: %s ,%s\n",__DATE__ ,__TIME__ );
|
||||
printf("BIOS SW Version: V0.9, build: %s %s\n",__DATE__ ,__TIME__ );
|
||||
printf("HAL Version: %d \n", HAL_GetHalVersion());
|
||||
printf("Revision ID: %d \n", HAL_GetREVID());
|
||||
printf("Device ID: %d \n", HAL_GetDEVID());
|
||||
printf("UID: %d%d%d \n", HAL_GetUIDw0(),HAL_GetUIDw1(),HAL_GetUIDw2);
|
||||
printf("------------------------------------\n");
|
||||
/* USER CODE END 2 */
|
||||
|
||||
/* Init scheduler */
|
||||
|
@ -193,30 +199,30 @@ void SystemClock_Config(void)
|
|||
*/
|
||||
static void MX_NVIC_Init(void)
|
||||
{
|
||||
/* ADC1_2_IRQn interrupt configuration */
|
||||
HAL_NVIC_SetPriority(ADC1_2_IRQn, 5, 0);
|
||||
HAL_NVIC_EnableIRQ(ADC1_2_IRQn);
|
||||
/* RCC_IRQn interrupt configuration */
|
||||
HAL_NVIC_SetPriority(RCC_IRQn, 5, 0);
|
||||
HAL_NVIC_EnableIRQ(RCC_IRQn);
|
||||
/* FLASH_IRQn interrupt configuration */
|
||||
HAL_NVIC_SetPriority(FLASH_IRQn, 5, 0);
|
||||
HAL_NVIC_EnableIRQ(FLASH_IRQn);
|
||||
/* PVD_IRQn interrupt configuration */
|
||||
HAL_NVIC_SetPriority(PVD_IRQn, 5, 0);
|
||||
HAL_NVIC_EnableIRQ(PVD_IRQn);
|
||||
/* I2C1_EV_IRQn interrupt configuration */
|
||||
HAL_NVIC_SetPriority(I2C1_EV_IRQn, 5, 0);
|
||||
HAL_NVIC_EnableIRQ(I2C1_EV_IRQn);
|
||||
/* I2C1_ER_IRQn interrupt configuration */
|
||||
HAL_NVIC_SetPriority(I2C1_ER_IRQn, 5, 0);
|
||||
HAL_NVIC_EnableIRQ(I2C1_ER_IRQn);
|
||||
/* FLASH_IRQn interrupt configuration */
|
||||
HAL_NVIC_SetPriority(FLASH_IRQn, 5, 0);
|
||||
HAL_NVIC_EnableIRQ(FLASH_IRQn);
|
||||
/* RCC_IRQn interrupt configuration */
|
||||
HAL_NVIC_SetPriority(RCC_IRQn, 5, 0);
|
||||
HAL_NVIC_EnableIRQ(RCC_IRQn);
|
||||
/* UART4_IRQn interrupt configuration */
|
||||
HAL_NVIC_SetPriority(UART4_IRQn, 5, 0);
|
||||
HAL_NVIC_EnableIRQ(UART4_IRQn);
|
||||
/* OTG_FS_IRQn interrupt configuration */
|
||||
HAL_NVIC_SetPriority(OTG_FS_IRQn, 5, 0);
|
||||
HAL_NVIC_EnableIRQ(OTG_FS_IRQn);
|
||||
/* I2C1_EV_IRQn interrupt configuration */
|
||||
HAL_NVIC_SetPriority(I2C1_EV_IRQn, 5, 0);
|
||||
HAL_NVIC_EnableIRQ(I2C1_EV_IRQn);
|
||||
/* I2C1_ER_IRQn interrupt configuration */
|
||||
HAL_NVIC_SetPriority(I2C1_ER_IRQn, 5, 0);
|
||||
HAL_NVIC_EnableIRQ(I2C1_ER_IRQn);
|
||||
/* ADC1_2_IRQn interrupt configuration */
|
||||
HAL_NVIC_SetPriority(ADC1_2_IRQn, 5, 0);
|
||||
HAL_NVIC_EnableIRQ(ADC1_2_IRQn);
|
||||
/* DMA1_Channel1_IRQn interrupt configuration */
|
||||
HAL_NVIC_SetPriority(DMA1_Channel1_IRQn, 5, 0);
|
||||
HAL_NVIC_EnableIRQ(DMA1_Channel1_IRQn);
|
||||
|
|
|
@ -27,14 +27,27 @@ void HAL_ADC_ConvCpltCallback(ADC_HandleTypeDef* hadc)
|
|||
{
|
||||
if(hadc->Instance == ADC1)
|
||||
{
|
||||
NaviKit.pmb.out_24v_div16 = (float)((NaviKit.pmb.adc[0]*16.0) / 1200.0);
|
||||
NaviKit.pmb.out_5v_div8 = (float)((NaviKit.pmb.adc[1]*8.0 ) / 1200.0);
|
||||
NaviKit.pmb.out_12v_div8 = (float)((NaviKit.pmb.adc[2]*8.0 ) / 1200.0);
|
||||
NaviKit.pmb.bkp_bat_div8 = (float)((NaviKit.pmb.adc[3]*8.0 ) / 1200.0);
|
||||
NaviKit.pmb.main_pwr_div16 = (float)((NaviKit.pmb.adc[4]*16.0) / 1200.0);
|
||||
// NaviKit.pmb.rails.out_24v = (float)((NaviKit.pmb.rails.adc[1]*16.0) / 1241.21);
|
||||
// NaviKit.pmb.rails.out_5v = (float)((NaviKit.pmb.rails.adc[2]*8.0 ) / 1241.21);
|
||||
// NaviKit.pmb.rails.out_12v = (float)((NaviKit.pmb.rails.adc[3]*8.0 ) / 1241.21);
|
||||
// NaviKit.pmb.rails.bkp_bat = (float)((NaviKit.pmb.rails.adc[4]*8.0 ) / 1241.21);
|
||||
// NaviKit.pmb.rails.main_pwr = (float)((NaviKit.pmb.rails.adc[5]*16.0) / 1241.21);
|
||||
|
||||
|
||||
float adc_17_voltage = 1.2 / NaviKit.pmb.rails.adc[1];
|
||||
|
||||
NaviKit.pmb.rails.out_24v = (float)(adc_17_voltage * NaviKit.pmb.rails.adc[2] * 16);
|
||||
NaviKit.pmb.rails.out_5v = (float)(adc_17_voltage * NaviKit.pmb.rails.adc[3] * 8);
|
||||
NaviKit.pmb.rails.out_12v = (float)(adc_17_voltage * NaviKit.pmb.rails.adc[4] * 8);
|
||||
NaviKit.pmb.rails.bkp_bat = (float)(adc_17_voltage * NaviKit.pmb.rails.adc[5] * 8);
|
||||
NaviKit.pmb.rails.main_pwr = (float)(adc_17_voltage * NaviKit.pmb.rails.adc[6] * 16);
|
||||
}
|
||||
}
|
||||
|
||||
void HAL_ADC_LevelOutOfWindowCallback(ADC_HandleTypeDef* hadc)
|
||||
{
|
||||
HAL_ADCEx_Calibration_Start(&hadc1);
|
||||
}
|
||||
void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
|
||||
{
|
||||
if(GPIO_Pin == SOM_SHUTDOWN_REQ_Pin)
|
||||
|
@ -82,3 +95,189 @@ void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
//write "bios update flag" to bkp register, and reset system
|
||||
void enter_isp_state()
|
||||
{
|
||||
RTC_HandleTypeDef hrtc;
|
||||
|
||||
hrtc.Instance = RTC;
|
||||
|
||||
__HAL_RCC_PWR_CLK_ENABLE();
|
||||
__HAL_RCC_BKP_CLK_ENABLE();
|
||||
__HAL_RCC_RTC_CONFIG(RCC_RTCCLKSOURCE_HSE_DIV128);
|
||||
__HAL_RCC_RTC_ENABLE();
|
||||
HAL_PWR_EnableBkUpAccess();
|
||||
|
||||
HAL_RTCEx_BKUPWrite(&hrtc,RTC_BKP_DR1,0x32f2);
|
||||
|
||||
HAL_Delay(10);
|
||||
if(HAL_RTCEx_BKUPRead(&hrtc,RTC_BKP_DR1) == 0x32f2)
|
||||
{//write successful
|
||||
Beep(500);
|
||||
Beep(500);
|
||||
Beep(500);
|
||||
printf("Enter to BIOS update state.\n");
|
||||
printf("System will reboot ,then run ISP automatic.\n");
|
||||
HAL_NVIC_SystemReset();
|
||||
}
|
||||
else{
|
||||
printf("Backup Register Writen error, can not enter BIOS update state \n");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void enter_shutdown_state()
|
||||
{
|
||||
printf("Enter to shutdown state \n");
|
||||
Beep(50);
|
||||
|
||||
HAL_GPIO_WritePin(SOM_POWER_EN_GPIO_Port ,SOM_POWER_EN_Pin, GPIO_PIN_RESET); osDelay(100);
|
||||
|
||||
HAL_GPIO_WritePin(SOC_U3_HUB_PWR_CTL_GPIO_Port,SOC_U3_HUB_PWR_CTL_Pin, GPIO_PIN_RESET); osDelay(100);
|
||||
HAL_GPIO_WritePin(SOC_U2_HUB_PWR_CTL_GPIO_Port,SOC_U2_HUB_PWR_CTL_Pin, GPIO_PIN_RESET); osDelay(100);
|
||||
// HAL_GPIO_WritePin(SOC_U3_HOST_PWR_CTL_GPIO_Port,SOC_U3_HOST_PWR_CTL_Pin, GPIO_PIN_RESET); osDelay(100);
|
||||
HAL_GPIO_WritePin(SOC_GE_SW_PWR_CTL_GPIO_Port,SOC_GE_SW_PWR_CTL_Pin, GPIO_PIN_RESET); osDelay(100);
|
||||
HAL_GPIO_WritePin(SOC_U3_GEC_PWR_CTL_GPIO_Port,SOC_U3_GEC_PWR_CTL_Pin, GPIO_PIN_RESET); osDelay(100);
|
||||
|
||||
|
||||
HAL_GPIO_WritePin(USB3_VBUS_CTL_4_GPIO_Port,USB3_VBUS_CTL_4_Pin, GPIO_PIN_RESET); osDelay(100);
|
||||
HAL_GPIO_WritePin(USB3_VBUS_CTL_3_GPIO_Port,USB3_VBUS_CTL_3_Pin, GPIO_PIN_RESET); osDelay(100);
|
||||
HAL_GPIO_WritePin(USB3_VBUS_CTL_2_GPIO_Port,USB3_VBUS_CTL_2_Pin, GPIO_PIN_RESET); osDelay(100);
|
||||
HAL_GPIO_WritePin(USB3_VBUS_CTL_1_GPIO_Port,USB3_VBUS_CTL_1_Pin, GPIO_PIN_RESET); osDelay(100);
|
||||
HAL_GPIO_WritePin(USB3_VBUS_CTL_6_GPIO_Port,USB3_VBUS_CTL_6_Pin, GPIO_PIN_RESET); osDelay(100);
|
||||
HAL_GPIO_WritePin(USB3_VBUS_CTL_5_GPIO_Port,USB3_VBUS_CTL_5_Pin, GPIO_PIN_RESET); osDelay(100);
|
||||
|
||||
HAL_GPIO_WritePin(USB2_VBUS_CTL_6_GPIO_Port,USB2_VBUS_CTL_6_Pin, GPIO_PIN_RESET); osDelay(100);
|
||||
HAL_GPIO_WritePin(USB2_VBUS_CTL_5_GPIO_Port,USB2_VBUS_CTL_5_Pin, GPIO_PIN_RESET); osDelay(100);
|
||||
HAL_GPIO_WritePin(USB2_VBUS_CTL_4_GPIO_Port,USB2_VBUS_CTL_4_Pin, GPIO_PIN_RESET); osDelay(100);
|
||||
HAL_GPIO_WritePin(USB2_VBUS_CTL_3_GPIO_Port,USB2_VBUS_CTL_3_Pin, GPIO_PIN_RESET); osDelay(100);
|
||||
HAL_GPIO_WritePin(USB2_VBUS_CTL_2_GPIO_Port,USB2_VBUS_CTL_2_Pin, GPIO_PIN_RESET); osDelay(100);
|
||||
HAL_GPIO_WritePin(USB2_VBUS_CTL_1_GPIO_Port,USB2_VBUS_CTL_1_Pin, GPIO_PIN_RESET); osDelay(100);
|
||||
|
||||
HAL_GPIO_WritePin(SYS_FAN_CTL_1_GPIO_Port,SYS_FAN_CTL_1_Pin,GPIO_PIN_RESET); osDelay(100);
|
||||
HAL_GPIO_WritePin(SYS_FAN_CTL_2_GPIO_Port,SYS_FAN_CTL_2_Pin,GPIO_PIN_RESET); osDelay(100);
|
||||
HAL_GPIO_WritePin(SYS_FAN_CTL_3_GPIO_Port,SYS_FAN_CTL_3_Pin,GPIO_PIN_RESET); osDelay(100);
|
||||
|
||||
HAL_GPIO_WritePin(PMB_PS_ON_GPIO_Port ,PMB_PS_ON_Pin, GPIO_PIN_RESET); osDelay(100);
|
||||
|
||||
}
|
||||
void enter_sleep_state()
|
||||
{
|
||||
printf("Enter to sleep state \n");
|
||||
Beep(50);
|
||||
|
||||
// HAL_GPIO_WritePin(SOC_U3_HUB_PWR_CTL_GPIO_Port,SOC_U3_HUB_PWR_CTL_Pin, GPIO_PIN_RESET); osDelay(100);
|
||||
HAL_GPIO_WritePin(SOC_U2_HUB_PWR_CTL_GPIO_Port,SOC_U2_HUB_PWR_CTL_Pin, GPIO_PIN_RESET); osDelay(100);
|
||||
// HAL_GPIO_WritePin(SOC_U3_HOST_PWR_CTL_GPIO_Port,SOC_U3_HOST_PWR_CTL_Pin, GPIO_PIN_RESET); osDelay(100);
|
||||
HAL_GPIO_WritePin(SOC_GE_SW_PWR_CTL_GPIO_Port,SOC_GE_SW_PWR_CTL_Pin, GPIO_PIN_RESET); osDelay(100);
|
||||
// HAL_GPIO_WritePin(SOC_U3_GEC_PWR_CTL_GPIO_Port,SOC_U3_GEC_PWR_CTL_Pin, GPIO_PIN_RESET); osDelay(100);
|
||||
|
||||
|
||||
HAL_GPIO_WritePin(USB3_VBUS_CTL_4_GPIO_Port,USB3_VBUS_CTL_4_Pin, GPIO_PIN_RESET); osDelay(100);
|
||||
HAL_GPIO_WritePin(USB3_VBUS_CTL_3_GPIO_Port,USB3_VBUS_CTL_3_Pin, GPIO_PIN_RESET); osDelay(100);
|
||||
HAL_GPIO_WritePin(USB3_VBUS_CTL_2_GPIO_Port,USB3_VBUS_CTL_2_Pin, GPIO_PIN_RESET); osDelay(100);
|
||||
HAL_GPIO_WritePin(USB3_VBUS_CTL_1_GPIO_Port,USB3_VBUS_CTL_1_Pin, GPIO_PIN_RESET); osDelay(100);
|
||||
// HAL_GPIO_WritePin(USB3_VBUS_CTL_6_GPIO_Port,USB3_VBUS_CTL_6_Pin, GPIO_PIN_RESET); osDelay(100);
|
||||
// HAL_GPIO_WritePin(USB3_VBUS_CTL_5_GPIO_Port,USB3_VBUS_CTL_5_Pin, GPIO_PIN_RESET); osDelay(100);
|
||||
|
||||
HAL_GPIO_WritePin(USB2_VBUS_CTL_6_GPIO_Port,USB2_VBUS_CTL_6_Pin, GPIO_PIN_RESET); osDelay(100);
|
||||
HAL_GPIO_WritePin(USB2_VBUS_CTL_5_GPIO_Port,USB2_VBUS_CTL_5_Pin, GPIO_PIN_RESET); osDelay(100);
|
||||
HAL_GPIO_WritePin(USB2_VBUS_CTL_4_GPIO_Port,USB2_VBUS_CTL_4_Pin, GPIO_PIN_RESET); osDelay(100);
|
||||
HAL_GPIO_WritePin(USB2_VBUS_CTL_3_GPIO_Port,USB2_VBUS_CTL_3_Pin, GPIO_PIN_RESET); osDelay(100);
|
||||
HAL_GPIO_WritePin(USB2_VBUS_CTL_2_GPIO_Port,USB2_VBUS_CTL_2_Pin, GPIO_PIN_RESET); osDelay(100);
|
||||
HAL_GPIO_WritePin(USB2_VBUS_CTL_1_GPIO_Port,USB2_VBUS_CTL_1_Pin, GPIO_PIN_RESET); osDelay(100);
|
||||
|
||||
HAL_GPIO_WritePin(SYS_FAN_CTL_1_GPIO_Port,SYS_FAN_CTL_1_Pin,GPIO_PIN_RESET); osDelay(100);
|
||||
HAL_GPIO_WritePin(SYS_FAN_CTL_2_GPIO_Port,SYS_FAN_CTL_2_Pin,GPIO_PIN_RESET); osDelay(100);
|
||||
HAL_GPIO_WritePin(SYS_FAN_CTL_3_GPIO_Port,SYS_FAN_CTL_3_Pin,GPIO_PIN_RESET); osDelay(100);
|
||||
}
|
||||
|
||||
void enter_runing_state()
|
||||
{
|
||||
|
||||
printf("Enter to runing state \n");
|
||||
Beep(200);
|
||||
|
||||
HAL_GPIO_WritePin(SOM_FORCE_RECOVERY_GPIO_Port ,SOM_FORCE_RECOVERY_Pin, GPIO_PIN_SET); osDelay(100);
|
||||
HAL_GPIO_WritePin(PMB_PS_ON_GPIO_Port ,PMB_PS_ON_Pin, GPIO_PIN_SET); osDelay(100);
|
||||
|
||||
HAL_GPIO_WritePin(SYS_FAN_CTL_1_GPIO_Port,SYS_FAN_CTL_1_Pin,GPIO_PIN_SET); osDelay(100);
|
||||
HAL_GPIO_WritePin(SYS_FAN_CTL_2_GPIO_Port,SYS_FAN_CTL_2_Pin,GPIO_PIN_SET); osDelay(100);
|
||||
HAL_GPIO_WritePin(SYS_FAN_CTL_3_GPIO_Port,SYS_FAN_CTL_3_Pin,GPIO_PIN_SET); osDelay(100);
|
||||
|
||||
HAL_GPIO_WritePin(SOC_U3_HUB_PWR_CTL_GPIO_Port,SOC_U3_HUB_PWR_CTL_Pin, GPIO_PIN_SET); osDelay(100);
|
||||
HAL_GPIO_WritePin(SOC_U2_HUB_PWR_CTL_GPIO_Port,SOC_U2_HUB_PWR_CTL_Pin, GPIO_PIN_SET); osDelay(100);
|
||||
// HAL_GPIO_WritePin(SOC_U3_HOST_PWR_CTL_GPIO_Port,SOC_U3_HOST_PWR_CTL_Pin, GPIO_PIN_SET); osDelay(100);
|
||||
HAL_GPIO_WritePin(SOC_GE_SW_PWR_CTL_GPIO_Port,SOC_GE_SW_PWR_CTL_Pin, GPIO_PIN_SET); osDelay(100);
|
||||
HAL_GPIO_WritePin(SOC_U3_GEC_PWR_CTL_GPIO_Port,SOC_U3_GEC_PWR_CTL_Pin, GPIO_PIN_SET); osDelay(100);
|
||||
|
||||
HAL_GPIO_WritePin(USB2_VBUS_CTL_1_GPIO_Port,USB2_VBUS_CTL_1_Pin, GPIO_PIN_SET); osDelay(100);
|
||||
HAL_GPIO_WritePin(USB2_VBUS_CTL_2_GPIO_Port,USB2_VBUS_CTL_2_Pin, GPIO_PIN_SET); osDelay(100);
|
||||
HAL_GPIO_WritePin(USB2_VBUS_CTL_3_GPIO_Port,USB2_VBUS_CTL_3_Pin, GPIO_PIN_SET); osDelay(100);
|
||||
HAL_GPIO_WritePin(USB2_VBUS_CTL_4_GPIO_Port,USB2_VBUS_CTL_4_Pin, GPIO_PIN_SET); osDelay(100);
|
||||
HAL_GPIO_WritePin(USB2_VBUS_CTL_5_GPIO_Port,USB2_VBUS_CTL_5_Pin, GPIO_PIN_SET); osDelay(100);
|
||||
HAL_GPIO_WritePin(USB2_VBUS_CTL_6_GPIO_Port,USB2_VBUS_CTL_6_Pin, GPIO_PIN_SET); osDelay(100);
|
||||
|
||||
HAL_GPIO_WritePin(USB3_VBUS_CTL_5_GPIO_Port,USB3_VBUS_CTL_5_Pin, GPIO_PIN_SET); osDelay(100);
|
||||
HAL_GPIO_WritePin(USB3_VBUS_CTL_6_GPIO_Port,USB3_VBUS_CTL_6_Pin, GPIO_PIN_SET); osDelay(100);
|
||||
// HAL_GPIO_WritePin(USB3_VBUS_CTL_1_GPIO_Port,USB3_VBUS_CTL_1_Pin, GPIO_PIN_SET); osDelay(100);
|
||||
// HAL_GPIO_WritePin(USB3_VBUS_CTL_2_GPIO_Port,USB3_VBUS_CTL_2_Pin, GPIO_PIN_SET); osDelay(100);
|
||||
// HAL_GPIO_WritePin(USB3_VBUS_CTL_3_GPIO_Port,USB3_VBUS_CTL_3_Pin, GPIO_PIN_SET); osDelay(100);
|
||||
// HAL_GPIO_WritePin(USB3_VBUS_CTL_4_GPIO_Port,USB3_VBUS_CTL_4_Pin, GPIO_PIN_SET); osDelay(100);
|
||||
|
||||
HAL_GPIO_WritePin(SOM_POWER_EN_GPIO_Port ,SOM_POWER_EN_Pin, GPIO_PIN_SET); osDelay(100);
|
||||
|
||||
}
|
||||
|
||||
void enter_dfu_state()
|
||||
{
|
||||
|
||||
printf("Enter to dfu state \n");
|
||||
Beep(200);
|
||||
Beep(200);
|
||||
Beep(200);
|
||||
Beep(200);
|
||||
Beep(200);
|
||||
|
||||
HAL_GPIO_WritePin(SOM_FORCE_RECOVERY_GPIO_Port ,SOM_FORCE_RECOVERY_Pin, GPIO_PIN_RESET); osDelay(100);
|
||||
|
||||
HAL_GPIO_WritePin(PMB_PS_ON_GPIO_Port ,PMB_PS_ON_Pin, GPIO_PIN_SET); osDelay(100);
|
||||
|
||||
HAL_GPIO_WritePin(SYS_FAN_CTL_1_GPIO_Port,SYS_FAN_CTL_1_Pin,GPIO_PIN_SET); osDelay(100);
|
||||
HAL_GPIO_WritePin(SYS_FAN_CTL_2_GPIO_Port,SYS_FAN_CTL_2_Pin,GPIO_PIN_SET); osDelay(100);
|
||||
HAL_GPIO_WritePin(SYS_FAN_CTL_3_GPIO_Port,SYS_FAN_CTL_3_Pin,GPIO_PIN_SET); osDelay(100);
|
||||
|
||||
HAL_GPIO_WritePin(SOC_U3_HUB_PWR_CTL_GPIO_Port,SOC_U3_HUB_PWR_CTL_Pin, GPIO_PIN_SET); osDelay(100);
|
||||
HAL_GPIO_WritePin(SOC_U2_HUB_PWR_CTL_GPIO_Port,SOC_U2_HUB_PWR_CTL_Pin, GPIO_PIN_SET); osDelay(100);
|
||||
// HAL_GPIO_WritePin(SOC_U3_HOST_PWR_CTL_GPIO_Port,SOC_U3_HOST_PWR_CTL_Pin, GPIO_PIN_SET); osDelay(100);
|
||||
HAL_GPIO_WritePin(SOC_GE_SW_PWR_CTL_GPIO_Port,SOC_GE_SW_PWR_CTL_Pin, GPIO_PIN_SET); osDelay(100);
|
||||
HAL_GPIO_WritePin(SOC_U3_GEC_PWR_CTL_GPIO_Port,SOC_U3_GEC_PWR_CTL_Pin, GPIO_PIN_SET); osDelay(100);
|
||||
|
||||
HAL_GPIO_WritePin(USB2_VBUS_CTL_1_GPIO_Port,USB2_VBUS_CTL_1_Pin, GPIO_PIN_SET); osDelay(100);
|
||||
HAL_GPIO_WritePin(USB2_VBUS_CTL_2_GPIO_Port,USB2_VBUS_CTL_2_Pin, GPIO_PIN_SET); osDelay(100);
|
||||
HAL_GPIO_WritePin(USB2_VBUS_CTL_3_GPIO_Port,USB2_VBUS_CTL_3_Pin, GPIO_PIN_SET); osDelay(100);
|
||||
HAL_GPIO_WritePin(USB2_VBUS_CTL_4_GPIO_Port,USB2_VBUS_CTL_4_Pin, GPIO_PIN_SET); osDelay(100);
|
||||
HAL_GPIO_WritePin(USB2_VBUS_CTL_5_GPIO_Port,USB2_VBUS_CTL_5_Pin, GPIO_PIN_SET); osDelay(100);
|
||||
HAL_GPIO_WritePin(USB2_VBUS_CTL_6_GPIO_Port,USB2_VBUS_CTL_6_Pin, GPIO_PIN_SET); osDelay(100);
|
||||
|
||||
HAL_GPIO_WritePin(USB3_VBUS_CTL_5_GPIO_Port,USB3_VBUS_CTL_5_Pin, GPIO_PIN_SET); osDelay(100);
|
||||
HAL_GPIO_WritePin(USB3_VBUS_CTL_6_GPIO_Port,USB3_VBUS_CTL_6_Pin, GPIO_PIN_SET); osDelay(100);
|
||||
// HAL_GPIO_WritePin(USB3_VBUS_CTL_1_GPIO_Port,USB3_VBUS_CTL_1_Pin, GPIO_PIN_SET); osDelay(100);
|
||||
// HAL_GPIO_WritePin(USB3_VBUS_CTL_2_GPIO_Port,USB3_VBUS_CTL_2_Pin, GPIO_PIN_SET); osDelay(100);
|
||||
// HAL_GPIO_WritePin(USB3_VBUS_CTL_3_GPIO_Port,USB3_VBUS_CTL_3_Pin, GPIO_PIN_SET); osDelay(100);
|
||||
// HAL_GPIO_WritePin(USB3_VBUS_CTL_4_GPIO_Port,USB3_VBUS_CTL_4_Pin, GPIO_PIN_SET); osDelay(100);
|
||||
|
||||
|
||||
HAL_GPIO_WritePin(SOM_POWER_EN_GPIO_Port ,SOM_POWER_EN_Pin, GPIO_PIN_SET); osDelay(1000);
|
||||
//
|
||||
// HAL_GPIO_WritePin(SOM_FORCE_RECOVERY_GPIO_Port ,SOM_FORCE_RECOVERY_Pin, GPIO_PIN_RESET); osDelay(100);
|
||||
// HAL_GPIO_WritePin(SOM_SYS_RESET_GPIO_Port ,SOM_SYS_RESET_Pin, GPIO_PIN_RESET); osDelay(100);
|
||||
//
|
||||
// osDelay(5000);
|
||||
// HAL_GPIO_WritePin(SOM_SYS_RESET_GPIO_Port ,SOM_SYS_RESET_Pin, GPIO_PIN_SET); osDelay(100);
|
||||
// HAL_GPIO_WritePin(SOM_FORCE_RECOVERY_GPIO_Port ,SOM_FORCE_RECOVERY_Pin, GPIO_PIN_SET); osDelay(100);
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -55,6 +55,10 @@ void HAL_RTC_MspInit(RTC_HandleTypeDef* rtcHandle)
|
|||
__HAL_RCC_BKP_CLK_ENABLE();
|
||||
/* RTC clock enable */
|
||||
__HAL_RCC_RTC_ENABLE();
|
||||
|
||||
/* RTC interrupt Init */
|
||||
HAL_NVIC_SetPriority(RTC_IRQn, 5, 0);
|
||||
HAL_NVIC_EnableIRQ(RTC_IRQn);
|
||||
/* USER CODE BEGIN RTC_MspInit 1 */
|
||||
|
||||
/* USER CODE END RTC_MspInit 1 */
|
||||
|
@ -71,6 +75,9 @@ void HAL_RTC_MspDeInit(RTC_HandleTypeDef* rtcHandle)
|
|||
/* USER CODE END RTC_MspDeInit 0 */
|
||||
/* Peripheral clock disable */
|
||||
__HAL_RCC_RTC_DISABLE();
|
||||
|
||||
/* RTC interrupt Deinit */
|
||||
HAL_NVIC_DisableIRQ(RTC_IRQn);
|
||||
/* USER CODE BEGIN RTC_MspDeInit 1 */
|
||||
|
||||
/* USER CODE END RTC_MspDeInit 1 */
|
||||
|
|
|
@ -71,6 +71,16 @@ void HAL_MspInit(void)
|
|||
__HAL_RCC_PWR_CLK_ENABLE();
|
||||
|
||||
/* System interrupt init*/
|
||||
/* MemoryManagement_IRQn interrupt configuration */
|
||||
HAL_NVIC_SetPriority(MemoryManagement_IRQn, 5, 0);
|
||||
/* BusFault_IRQn interrupt configuration */
|
||||
HAL_NVIC_SetPriority(BusFault_IRQn, 5, 0);
|
||||
/* UsageFault_IRQn interrupt configuration */
|
||||
HAL_NVIC_SetPriority(UsageFault_IRQn, 5, 0);
|
||||
/* SVCall_IRQn interrupt configuration */
|
||||
HAL_NVIC_SetPriority(SVCall_IRQn, 5, 0);
|
||||
/* DebugMonitor_IRQn interrupt configuration */
|
||||
HAL_NVIC_SetPriority(DebugMonitor_IRQn, 5, 0);
|
||||
/* PendSV_IRQn interrupt configuration */
|
||||
HAL_NVIC_SetPriority(PendSV_IRQn, 15, 0);
|
||||
|
||||
|
|
|
@ -62,6 +62,7 @@ extern PCD_HandleTypeDef hpcd_USB_OTG_FS;
|
|||
extern DMA_HandleTypeDef hdma_adc1;
|
||||
extern ADC_HandleTypeDef hadc1;
|
||||
extern I2C_HandleTypeDef hi2c1;
|
||||
extern RTC_HandleTypeDef hrtc;
|
||||
extern UART_HandleTypeDef huart4;
|
||||
extern UART_HandleTypeDef huart1;
|
||||
extern TIM_HandleTypeDef htim1;
|
||||
|
@ -181,6 +182,20 @@ void PVD_IRQHandler(void)
|
|||
/* USER CODE END PVD_IRQn 1 */
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function handles RTC global interrupt.
|
||||
*/
|
||||
void RTC_IRQHandler(void)
|
||||
{
|
||||
/* USER CODE BEGIN RTC_IRQn 0 */
|
||||
|
||||
/* USER CODE END RTC_IRQn 0 */
|
||||
HAL_RTCEx_RTCIRQHandler(&hrtc);
|
||||
/* USER CODE BEGIN RTC_IRQn 1 */
|
||||
|
||||
/* USER CODE END RTC_IRQn 1 */
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function handles Flash global interrupt.
|
||||
*/
|
||||
|
|
|
@ -1,23 +1,36 @@
|
|||
#MicroXplorer Configuration settings - do not modify
|
||||
ADC1.Channel-0\#ChannelRegularConversion=ADC_CHANNEL_3
|
||||
ADC1.Channel-1\#ChannelRegularConversion=ADC_CHANNEL_4
|
||||
ADC1.Channel-2\#ChannelRegularConversion=ADC_CHANNEL_5
|
||||
ADC1.Channel-3\#ChannelRegularConversion=ADC_CHANNEL_6
|
||||
ADC1.Channel-4\#ChannelRegularConversion=ADC_CHANNEL_7
|
||||
ADC1.AWD1HighThreshold=1828
|
||||
ADC1.AWD1ITMode=ENABLE
|
||||
ADC1.AWD1LowThreshold=1721
|
||||
ADC1.Channel-0\#ChannelRegularConversion=ADC_CHANNEL_TEMPSENSOR
|
||||
ADC1.Channel-1\#ChannelRegularConversion=ADC_CHANNEL_VREFINT
|
||||
ADC1.Channel-2\#ChannelRegularConversion=ADC_CHANNEL_3
|
||||
ADC1.Channel-3\#ChannelRegularConversion=ADC_CHANNEL_4
|
||||
ADC1.Channel-4\#ChannelRegularConversion=ADC_CHANNEL_5
|
||||
ADC1.Channel-5\#ChannelRegularConversion=ADC_CHANNEL_6
|
||||
ADC1.Channel-6\#ChannelRegularConversion=ADC_CHANNEL_7
|
||||
ADC1.ContinuousConvMode=ENABLE
|
||||
ADC1.IPParameters=Rank-0\#ChannelRegularConversion,Channel-0\#ChannelRegularConversion,SamplingTime-0\#ChannelRegularConversion,NbrOfConversionFlag,master,ContinuousConvMode,Rank-1\#ChannelRegularConversion,Channel-1\#ChannelRegularConversion,SamplingTime-1\#ChannelRegularConversion,Rank-2\#ChannelRegularConversion,Channel-2\#ChannelRegularConversion,SamplingTime-2\#ChannelRegularConversion,Rank-3\#ChannelRegularConversion,Channel-3\#ChannelRegularConversion,SamplingTime-3\#ChannelRegularConversion,NbrOfConversion,Rank-4\#ChannelRegularConversion,Channel-4\#ChannelRegularConversion,SamplingTime-4\#ChannelRegularConversion
|
||||
ADC1.NbrOfConversion=5
|
||||
ADC1.EnableAnalogWatchDog=true
|
||||
ADC1.ExternalTrigConv=ADC_SOFTWARE_START
|
||||
ADC1.IPParameters=Rank-0\#ChannelRegularConversion,Channel-0\#ChannelRegularConversion,SamplingTime-0\#ChannelRegularConversion,NbrOfConversionFlag,ContinuousConvMode,Rank-1\#ChannelRegularConversion,Channel-1\#ChannelRegularConversion,SamplingTime-1\#ChannelRegularConversion,Rank-2\#ChannelRegularConversion,Channel-2\#ChannelRegularConversion,SamplingTime-2\#ChannelRegularConversion,Rank-3\#ChannelRegularConversion,Channel-3\#ChannelRegularConversion,SamplingTime-3\#ChannelRegularConversion,NbrOfConversion,Rank-4\#ChannelRegularConversion,Channel-4\#ChannelRegularConversion,SamplingTime-4\#ChannelRegularConversion,Rank-5\#ChannelRegularConversion,Channel-5\#ChannelRegularConversion,SamplingTime-5\#ChannelRegularConversion,ExternalTrigConv,master,EnableAnalogWatchDog,Rank-6\#ChannelRegularConversion,Channel-6\#ChannelRegularConversion,SamplingTime-6\#ChannelRegularConversion,WatchdogMode,AWD1ITMode,WatchdogChannel,AWD1HighThreshold,AWD1LowThreshold
|
||||
ADC1.NbrOfConversion=7
|
||||
ADC1.NbrOfConversionFlag=1
|
||||
ADC1.Rank-0\#ChannelRegularConversion=1
|
||||
ADC1.Rank-1\#ChannelRegularConversion=2
|
||||
ADC1.Rank-2\#ChannelRegularConversion=3
|
||||
ADC1.Rank-3\#ChannelRegularConversion=4
|
||||
ADC1.Rank-4\#ChannelRegularConversion=5
|
||||
ADC1.Rank-5\#ChannelRegularConversion=6
|
||||
ADC1.Rank-6\#ChannelRegularConversion=7
|
||||
ADC1.SamplingTime-0\#ChannelRegularConversion=ADC_SAMPLETIME_239CYCLES_5
|
||||
ADC1.SamplingTime-1\#ChannelRegularConversion=ADC_SAMPLETIME_239CYCLES_5
|
||||
ADC1.SamplingTime-2\#ChannelRegularConversion=ADC_SAMPLETIME_239CYCLES_5
|
||||
ADC1.SamplingTime-3\#ChannelRegularConversion=ADC_SAMPLETIME_239CYCLES_5
|
||||
ADC1.SamplingTime-4\#ChannelRegularConversion=ADC_SAMPLETIME_239CYCLES_5
|
||||
ADC1.SamplingTime-5\#ChannelRegularConversion=ADC_SAMPLETIME_239CYCLES_5
|
||||
ADC1.SamplingTime-6\#ChannelRegularConversion=ADC_SAMPLETIME_239CYCLES_5
|
||||
ADC1.WatchdogChannel=ADC_CHANNEL_TEMPSENSOR
|
||||
ADC1.WatchdogMode=ADC_ANALOGWATCHDOG_SINGLE_REG
|
||||
ADC1.master=1
|
||||
ARM.CMSIS.5.6.0.CMSISJjCORE=true
|
||||
ARM.CMSIS.5.6.0.CMSISJjDSP=Library
|
||||
|
@ -57,13 +70,16 @@ FREERTOS.FootprintOK=true
|
|||
FREERTOS.HEAP_NUMBER=4
|
||||
FREERTOS.INCLUDE_xTaskGetCurrentTaskHandle=1
|
||||
FREERTOS.INCLUDE_xTaskGetHandle=1
|
||||
FREERTOS.IPParameters=Tasks01,configMAX_TASK_NAME_LEN,configUSE_TICKLESS_IDLE,INCLUDE_xTaskGetCurrentTaskHandle,INCLUDE_xTaskGetHandle,configUSE_APPLICATION_TASK_TAG,FootprintOK,configUSE_IDLE_HOOK,configUSE_TICK_HOOK,configUSE_MALLOC_FAILED_HOOK,configGENERATE_RUN_TIME_STATS,configUSE_STATS_FORMATTING_FUNCTIONS,configUSE_TRACE_FACILITY,HEAP_NUMBER,configTOTAL_HEAP_SIZE
|
||||
FREERTOS.IPParameters=Tasks01,configMAX_TASK_NAME_LEN,configUSE_TICKLESS_IDLE,INCLUDE_xTaskGetCurrentTaskHandle,INCLUDE_xTaskGetHandle,configUSE_APPLICATION_TASK_TAG,FootprintOK,configUSE_IDLE_HOOK,configUSE_TICK_HOOK,configUSE_MALLOC_FAILED_HOOK,configGENERATE_RUN_TIME_STATS,configUSE_STATS_FORMATTING_FUNCTIONS,configUSE_TRACE_FACILITY,HEAP_NUMBER,configTOTAL_HEAP_SIZE,configCHECK_FOR_STACK_OVERFLOW,Queues01,Mutexes01
|
||||
FREERTOS.Mutexes01=uartMutex,Dynamic,NULL
|
||||
FREERTOS.Queues01=uartQueue,256,uint8_t,0,Dynamic,NULL,NULL
|
||||
FREERTOS.Tasks01=defaultTask,24,128,StartDefaultTask,Default,NULL,Dynamic,NULL,NULL;LedBlinkTask,8,128,StartLedBlinkTask,Default,NULL,Dynamic,NULL,NULL;IWDGRefreshTask,40,128,StartIWDGRefreshTask,Default,NULL,Dynamic,NULL,NULL;EventDetect,8,128,StartEventDetect,Default,NULL,Dynamic,NULL,NULL;CoulombRead,8,128,StartCoulombRead,Default,NULL,Dynamic,NULL,NULL;StateSwitchTask,8,128,StartStateSwitchTask,Default,NULL,Dynamic,NULL,NULL;PowerMonitTask,8,128,StartPowerMonitTask,Default,NULL,Dynamic,NULL,NULL
|
||||
FREERTOS.configCHECK_FOR_STACK_OVERFLOW=1
|
||||
FREERTOS.configGENERATE_RUN_TIME_STATS=0
|
||||
FREERTOS.configMAX_TASK_NAME_LEN=32
|
||||
FREERTOS.configTOTAL_HEAP_SIZE=8192
|
||||
FREERTOS.configUSE_APPLICATION_TASK_TAG=0
|
||||
FREERTOS.configUSE_IDLE_HOOK=0
|
||||
FREERTOS.configUSE_IDLE_HOOK=1
|
||||
FREERTOS.configUSE_MALLOC_FAILED_HOOK=0
|
||||
FREERTOS.configUSE_STATS_FORMATTING_FUNCTIONS=0
|
||||
FREERTOS.configUSE_TICKLESS_IDLE=0
|
||||
|
@ -154,48 +170,51 @@ Mcu.Pin61=PB4
|
|||
Mcu.Pin62=PB5
|
||||
Mcu.Pin63=PB8
|
||||
Mcu.Pin64=PB9
|
||||
Mcu.Pin65=VP_FREERTOS_VS_CMSIS_V2
|
||||
Mcu.Pin66=VP_IWDG_VS_IWDG
|
||||
Mcu.Pin67=VP_RTC_VS_RTC_Activate
|
||||
Mcu.Pin68=VP_SYS_VS_tim1
|
||||
Mcu.Pin69=VP_USB_DEVICE_VS_USB_DEVICE_CDC_FS
|
||||
Mcu.Pin65=VP_ADC1_TempSens_Input
|
||||
Mcu.Pin66=VP_ADC1_Vref_Input
|
||||
Mcu.Pin67=VP_FREERTOS_VS_CMSIS_V2
|
||||
Mcu.Pin68=VP_IWDG_VS_IWDG
|
||||
Mcu.Pin69=VP_RTC_VS_RTC_Activate
|
||||
Mcu.Pin7=PC0
|
||||
Mcu.Pin70=VP_SYS_VS_tim1
|
||||
Mcu.Pin71=VP_USB_DEVICE_VS_USB_DEVICE_CDC_FS
|
||||
Mcu.Pin8=PC1
|
||||
Mcu.Pin9=PC2
|
||||
Mcu.PinsNb=70
|
||||
Mcu.PinsNb=72
|
||||
Mcu.ThirdParty0=ARM.CMSIS.5.6.0
|
||||
Mcu.ThirdPartyNb=1
|
||||
Mcu.UserConstants=
|
||||
Mcu.UserName=STM32F107VCTx
|
||||
MxCube.Version=5.6.1
|
||||
MxDb.Version=DB.5.0.60
|
||||
NVIC.ADC1_2_IRQn=true\:5\:0\:false\:true\:true\:1\:true\:true\:true
|
||||
NVIC.BusFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
|
||||
NVIC.ADC1_2_IRQn=true\:5\:0\:false\:true\:true\:8\:true\:true\:true
|
||||
NVIC.BusFault_IRQn=true\:5\:0\:false\:false\:true\:true\:false\:false
|
||||
NVIC.DMA1_Channel1_IRQn=true\:5\:0\:false\:true\:true\:9\:true\:false\:true
|
||||
NVIC.DebugMonitor_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
|
||||
NVIC.DebugMonitor_IRQn=true\:5\:0\:true\:false\:true\:true\:false\:false
|
||||
NVIC.EXTI0_IRQn=true\:5\:0\:false\:false\:true\:true\:true\:true
|
||||
NVIC.EXTI3_IRQn=true\:5\:0\:false\:false\:true\:true\:true\:true
|
||||
NVIC.EXTI9_5_IRQn=true\:5\:0\:false\:false\:true\:true\:true\:true
|
||||
NVIC.FLASH_IRQn=true\:5\:0\:false\:true\:true\:3\:true\:true\:true
|
||||
NVIC.EXTI9_5_IRQn=true\:5\:0\:true\:false\:true\:true\:true\:true
|
||||
NVIC.FLASH_IRQn=true\:5\:0\:false\:true\:true\:2\:true\:true\:true
|
||||
NVIC.ForceEnableDMAVector=true
|
||||
NVIC.HardFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
|
||||
NVIC.I2C1_ER_IRQn=true\:5\:0\:false\:true\:true\:6\:true\:true\:true
|
||||
NVIC.I2C1_EV_IRQn=true\:5\:0\:false\:true\:true\:5\:true\:true\:true
|
||||
NVIC.MemoryManagement_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
|
||||
NVIC.I2C1_ER_IRQn=true\:5\:0\:true\:true\:true\:7\:true\:true\:true
|
||||
NVIC.I2C1_EV_IRQn=true\:5\:0\:false\:true\:true\:6\:true\:true\:true
|
||||
NVIC.MemoryManagement_IRQn=true\:5\:0\:false\:false\:true\:true\:false\:false
|
||||
NVIC.NonMaskableInt_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:true
|
||||
NVIC.OTG_FS_IRQn=true\:5\:0\:false\:true\:true\:8\:true\:false\:true
|
||||
NVIC.PVD_IRQn=true\:5\:0\:false\:true\:true\:4\:true\:true\:true
|
||||
NVIC.OTG_FS_IRQn=true\:5\:0\:false\:true\:true\:5\:true\:false\:true
|
||||
NVIC.PVD_IRQn=true\:5\:0\:true\:true\:true\:1\:true\:true\:true
|
||||
NVIC.PendSV_IRQn=true\:15\:0\:false\:false\:false\:true\:false\:false
|
||||
NVIC.PriorityGroup=NVIC_PRIORITYGROUP_4
|
||||
NVIC.RCC_IRQn=true\:5\:0\:false\:true\:true\:2\:true\:true\:false
|
||||
NVIC.SVCall_IRQn=true\:0\:0\:false\:false\:false\:false\:false\:false
|
||||
NVIC.RCC_IRQn=true\:5\:0\:false\:true\:true\:3\:true\:true\:false
|
||||
NVIC.RTC_IRQn=true\:5\:0\:true\:false\:true\:true\:true\:true
|
||||
NVIC.SVCall_IRQn=true\:5\:0\:false\:false\:false\:true\:false\:false
|
||||
NVIC.SysTick_IRQn=true\:15\:0\:false\:false\:false\:true\:false\:false
|
||||
NVIC.TIM1_UP_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:true
|
||||
NVIC.TimeBase=TIM1_UP_IRQn
|
||||
NVIC.TimeBaseIP=TIM1
|
||||
NVIC.UART4_IRQn=true\:5\:0\:false\:true\:true\:7\:true\:true\:true
|
||||
NVIC.UART4_IRQn=true\:5\:0\:false\:true\:true\:4\:true\:true\:true
|
||||
NVIC.USART1_IRQn=true\:5\:0\:false\:false\:true\:true\:true\:true
|
||||
NVIC.UsageFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
|
||||
NVIC.UsageFault_IRQn=true\:5\:0\:false\:false\:true\:true\:false\:false
|
||||
OSC_IN.Mode=HSE-External-Oscillator
|
||||
OSC_IN.Signal=RCC_OSC_IN
|
||||
OSC_OUT.Mode=HSE-External-Oscillator
|
||||
|
@ -560,6 +579,10 @@ USB_DEVICE.VirtualMode=Cdc
|
|||
USB_DEVICE.VirtualModeFS=Cdc_FS
|
||||
USB_OTG_FS.IPParameters=VirtualMode
|
||||
USB_OTG_FS.VirtualMode=Device_Only
|
||||
VP_ADC1_TempSens_Input.Mode=IN-TempSens
|
||||
VP_ADC1_TempSens_Input.Signal=ADC1_TempSens_Input
|
||||
VP_ADC1_Vref_Input.Mode=IN-Vrefint
|
||||
VP_ADC1_Vref_Input.Signal=ADC1_Vref_Input
|
||||
VP_FREERTOS_VS_CMSIS_V2.Mode=CMSIS_V2
|
||||
VP_FREERTOS_VS_CMSIS_V2.Signal=FREERTOS_VS_CMSIS_V2
|
||||
VP_IWDG_VS_IWDG.Mode=IWDG_Activate
|
||||
|
|
Loading…
Reference in New Issue