shutdown signal detect

master
bookshiyi 2020-09-01 18:38:53 +08:00
parent 42afa920d2
commit 690ad2d4be
10 changed files with 91 additions and 90 deletions

View File

@ -54,7 +54,7 @@
#define configUSE_PREEMPTION 1 #define configUSE_PREEMPTION 1
#define configSUPPORT_STATIC_ALLOCATION 1 #define configSUPPORT_STATIC_ALLOCATION 1
#define configSUPPORT_DYNAMIC_ALLOCATION 1 #define configSUPPORT_DYNAMIC_ALLOCATION 1
#define configUSE_IDLE_HOOK 1 #define configUSE_IDLE_HOOK 0
#define configUSE_TICK_HOOK 0 #define configUSE_TICK_HOOK 0
#define configCPU_CLOCK_HZ ( SystemCoreClock ) #define configCPU_CLOCK_HZ ( SystemCoreClock )
#define configTICK_RATE_HZ ((TickType_t)1000) #define configTICK_RATE_HZ ((TickType_t)1000)
@ -62,11 +62,9 @@
#define configMINIMAL_STACK_SIZE ((uint16_t)128) #define configMINIMAL_STACK_SIZE ((uint16_t)128)
#define configTOTAL_HEAP_SIZE ((size_t)8192) #define configTOTAL_HEAP_SIZE ((size_t)8192)
#define configMAX_TASK_NAME_LEN ( 32 ) #define configMAX_TASK_NAME_LEN ( 32 )
#define configUSE_TRACE_FACILITY 1
#define configUSE_16_BIT_TICKS 0 #define configUSE_16_BIT_TICKS 0
#define configUSE_MUTEXES 1 #define configUSE_MUTEXES 1
#define configQUEUE_REGISTRY_SIZE 8 #define configQUEUE_REGISTRY_SIZE 8
#define configCHECK_FOR_STACK_OVERFLOW 1
#define configUSE_RECURSIVE_MUTEXES 1 #define configUSE_RECURSIVE_MUTEXES 1
#define configUSE_COUNTING_SEMAPHORES 1 #define configUSE_COUNTING_SEMAPHORES 1
#define configUSE_PORT_OPTIMISED_TASK_SELECTION 0 #define configUSE_PORT_OPTIMISED_TASK_SELECTION 0

View File

@ -104,16 +104,18 @@ const osThreadAttr_t PowerMonitTask_attributes = {
.priority = (osPriority_t) osPriorityLow, .priority = (osPriority_t) osPriorityLow,
.stack_size = 128 * 4 .stack_size = 128 * 4
}; };
/* Definitions for uartQueueTask */
osThreadId_t uartQueueTaskHandle;
const osThreadAttr_t uartQueueTask_attributes = {
.name = "uartQueueTask",
.priority = (osPriority_t) osPriorityLow,
.stack_size = 128 * 4
};
/* Definitions for uartQueue */ /* Definitions for uartQueue */
osMessageQueueId_t uartQueueHandle; osMessageQueueId_t uartQueueHandle;
const osMessageQueueAttr_t uartQueue_attributes = { const osMessageQueueAttr_t uartQueue_attributes = {
.name = "uartQueue" .name = "uartQueue"
}; };
/* Definitions for uartMutex */
osMutexId_t uartMutexHandle;
const osMutexAttr_t uartMutex_attributes = {
.name = "uartMutex"
};
/* Private function prototypes -----------------------------------------------*/ /* Private function prototypes -----------------------------------------------*/
/* USER CODE BEGIN FunctionPrototypes */ /* USER CODE BEGIN FunctionPrototypes */
@ -126,38 +128,11 @@ void StartEventDetect(void *argument);
void StartCoulombRead(void *argument); void StartCoulombRead(void *argument);
void StartStateSwitchTask(void *argument); void StartStateSwitchTask(void *argument);
void StartPowerMonitTask(void *argument); void StartPowerMonitTask(void *argument);
void StartUartQueueTask(void *argument);
extern void MX_USB_DEVICE_Init(void); extern void MX_USB_DEVICE_Init(void);
void MX_FREERTOS_Init(void); /* (MISRA C 2004 rule 8.1) */ 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 * @brief FreeRTOS initialization
* @param None * @param None
@ -167,9 +142,6 @@ void MX_FREERTOS_Init(void) {
/* USER CODE BEGIN Init */ /* USER CODE BEGIN Init */
/* USER CODE END Init */ /* USER CODE END Init */
/* Create the mutex(es) */
/* creation of uartMutex */
uartMutexHandle = osMutexNew(&uartMutex_attributes);
/* USER CODE BEGIN RTOS_MUTEX */ /* USER CODE BEGIN RTOS_MUTEX */
/* add mutexes, ... */ /* add mutexes, ... */
@ -185,7 +157,7 @@ void MX_FREERTOS_Init(void) {
/* Create the queue(s) */ /* Create the queue(s) */
/* creation of uartQueue */ /* creation of uartQueue */
uartQueueHandle = osMessageQueueNew (256, sizeof(uint8_t), &uartQueue_attributes); uartQueueHandle = osMessageQueueNew (128, sizeof(uint8_t), &uartQueue_attributes);
/* USER CODE BEGIN RTOS_QUEUES */ /* USER CODE BEGIN RTOS_QUEUES */
/* add queues, ... */ /* add queues, ... */
@ -213,6 +185,9 @@ void MX_FREERTOS_Init(void) {
/* creation of PowerMonitTask */ /* creation of PowerMonitTask */
PowerMonitTaskHandle = osThreadNew(StartPowerMonitTask, NULL, &PowerMonitTask_attributes); PowerMonitTaskHandle = osThreadNew(StartPowerMonitTask, NULL, &PowerMonitTask_attributes);
/* creation of uartQueueTask */
uartQueueTaskHandle = osThreadNew(StartUartQueueTask, NULL, &uartQueueTask_attributes);
/* USER CODE BEGIN RTOS_THREADS */ /* USER CODE BEGIN RTOS_THREADS */
/* add threads, ... */ /* add threads, ... */
@ -232,6 +207,7 @@ void StartDefaultTask(void *argument)
/* init code for USB_DEVICE */ /* init code for USB_DEVICE */
MX_USB_DEVICE_Init(); MX_USB_DEVICE_Init();
/* USER CODE BEGIN StartDefaultTask */ /* USER CODE BEGIN StartDefaultTask */
uint8_t count,temp[256];
HAL_GPIO_WritePin(USB2_FS_ENUM_CTL_GPIO_Port,USB2_FS_ENUM_CTL_Pin, GPIO_PIN_SET); HAL_GPIO_WritePin(USB2_FS_ENUM_CTL_GPIO_Port,USB2_FS_ENUM_CTL_Pin, GPIO_PIN_SET);
Beep(50); Beep(50);
@ -239,8 +215,16 @@ void StartDefaultTask(void *argument)
/* Infinite loop */ /* Infinite loop */
for(;;) for(;;)
{ {
osDelay(1000); osDelay(100);
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); // count = osMessageQueueGetCount(uartQueueHandle);
// if(count){
// for(uint8_t i=0;i<count;i++){
// osMessageQueueGet(uartQueueHandle,&temp[i],0,10);
// }
// HAL_UART_Transmit(&huart1,(uint8_t *)&temp,count,0xffff);
// }
// printf("test");
// 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 */ /* USER CODE END StartDefaultTask */
@ -417,7 +401,7 @@ void StartEventDetect(void *argument)
if(NaviKit.sys.custom_btn == true ) if(NaviKit.sys.custom_btn == true )
{//custom button has been pushed {//custom button has been pushed
uint8_t count =0; uint8_t count =0;
while(NaviKit.sys.custom_btn && count<=10){ while(NaviKit.sys.custom_btn && count<=20){
osDelay(100); osDelay(100);
count ++; count ++;
} }
@ -530,11 +514,11 @@ void StartPowerMonitTask(void *argument)
{ {
/* USER CODE BEGIN StartPowerMonitTask */ /* USER CODE BEGIN StartPowerMonitTask */
HAL_ADCEx_Calibration_Start(&hadc1); HAL_ADCEx_Calibration_Start(&hadc1);
HAL_ADC_Start_DMA(&hadc1, &(NaviKit.pmb.rails.adc), ADC_CH_COUNT); HAL_ADC_Start_DMA(&hadc1, (uint32_t*)&(NaviKit.pmb.rails.adc), ADC_CH_COUNT);
/* Infinite loop */ /* Infinite loop */
for(;;) for(;;)
{ {
// osDelay(1000); osDelay(1000);
// printf("out_24v: %f \n",NaviKit.pmb.out_24v_div16); // printf("out_24v: %f \n",NaviKit.pmb.out_24v_div16);
// printf("out_5v: %f \n",NaviKit.pmb.out_5v_div8); // printf("out_5v: %f \n",NaviKit.pmb.out_5v_div8);
// printf("out_12v: %f \n",NaviKit.pmb.out_12v_div8); // printf("out_12v: %f \n",NaviKit.pmb.out_12v_div8);
@ -559,12 +543,29 @@ void StartPowerMonitTask(void *argument)
/* USER CODE END StartPowerMonitTask */ /* USER CODE END StartPowerMonitTask */
} }
/* USER CODE BEGIN Header_StartUartQueueTask */
/**
* @brief Function implementing the uartQueueTask thread.
* @param argument: Not used
* @retval None
*/
/* USER CODE END Header_StartUartQueueTask */
void StartUartQueueTask(void *argument)
{
/* USER CODE BEGIN StartUartQueueTask */
/* Infinite loop */
for(;;)
{
osDelay(1);
}
/* USER CODE END StartUartQueueTask */
}
/* Private application code --------------------------------------------------*/ /* Private application code --------------------------------------------------*/
/* USER CODE BEGIN Application */ /* USER CODE BEGIN Application */
//printf redefine //printf redefine
#ifdef __GNUC__ #ifdef __GNUC__
#define PUTCHAR_PROTOTYPE int __io_putchar(int ch) #define PUTCHAR_PROTOTYPE int __io_putchar(int ch)
@ -573,6 +574,8 @@ PUTCHAR_PROTOTYPE
while(HAL_UART_GetState(&huart1) == HAL_UART_STATE_BUSY_TX){} while(HAL_UART_GetState(&huart1) == HAL_UART_STATE_BUSY_TX){}
HAL_UART_Transmit(&huart1,(uint8_t *)&ch,1,0xffff); HAL_UART_Transmit(&huart1,(uint8_t *)&ch,1,0xffff);
// osMessageQueuePut(uartQueueHandle,(uint8_t *)&ch,0,100);
return ch; return ch;
} }
#endif #endif

View File

@ -166,7 +166,7 @@ void MX_GPIO_Init(void)
/*Configure GPIO pin : PtPin */ /*Configure GPIO pin : PtPin */
GPIO_InitStruct.Pin = SOM_SHUTDOWN_REQ_Pin; GPIO_InitStruct.Pin = SOM_SHUTDOWN_REQ_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_IT_RISING; GPIO_InitStruct.Mode = GPIO_MODE_IT_RISING_FALLING;
GPIO_InitStruct.Pull = GPIO_NOPULL; GPIO_InitStruct.Pull = GPIO_NOPULL;
HAL_GPIO_Init(SOM_SHUTDOWN_REQ_GPIO_Port, &GPIO_InitStruct); HAL_GPIO_Init(SOM_SHUTDOWN_REQ_GPIO_Port, &GPIO_InitStruct);

View File

@ -109,14 +109,15 @@ int main(void)
MX_NVIC_Init(); MX_NVIC_Init();
/* USER CODE BEGIN 2 */ /* USER CODE BEGIN 2 */
//HAL_IWDG_Refresh(&hiwdg); //HAL_IWDG_Refresh(&hiwdg);
printf("------------------------------------\n"); printf("\nCore initial successfully\n");
printf("Core initial successfully\n"); printf("---------------------------------------------\n");
printf("Copyright (c) Powered by www.autolabor.com.cn\n");
printf("BIOS SW 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("HAL Version: %d \n", HAL_GetHalVersion());
printf("Revision ID: %d \n", HAL_GetREVID()); printf("Revision ID: %d \n", HAL_GetREVID());
printf("Device ID: %d \n", HAL_GetDEVID()); printf("Device ID: %d \n", HAL_GetDEVID());
printf("UID: %d%d%d \n", HAL_GetUIDw0(),HAL_GetUIDw1(),HAL_GetUIDw2); printf("Chip UID: %d%d%d \n", HAL_GetUIDw0(),HAL_GetUIDw1(),HAL_GetUIDw2);
printf("------------------------------------\n"); printf("----------------------------------------------\n");
/* USER CODE END 2 */ /* USER CODE END 2 */
/* Init scheduler */ /* Init scheduler */

View File

@ -54,16 +54,16 @@ void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
{ {
if(HAL_GPIO_ReadPin(SOM_SHUTDOWN_REQ_GPIO_Port, SOM_SHUTDOWN_REQ_Pin)==GPIO_PIN_SET) if(HAL_GPIO_ReadPin(SOM_SHUTDOWN_REQ_GPIO_Port, SOM_SHUTDOWN_REQ_Pin)==GPIO_PIN_SET)
{//Rising edge trigger {//Rising edge trigger
NaviKit.som.shutdown_req = true; // NaviKit.som.shutdown_req = true;
if(NaviKit.sys.sta == runing)
{
NaviKit.sys.next_sta = shutdown;
printf("enter shutdown mode... \n");
}
} }
if(HAL_GPIO_ReadPin(SOM_SHUTDOWN_REQ_GPIO_Port, SOM_SHUTDOWN_REQ_Pin)==GPIO_PIN_RESET) if(HAL_GPIO_ReadPin(SOM_SHUTDOWN_REQ_GPIO_Port, SOM_SHUTDOWN_REQ_Pin)==GPIO_PIN_RESET)
{//falling edge trigger {//falling edge trigger
NaviKit.som.shutdown_req = false; // NaviKit.som.shutdown_req = false;
if(NaviKit.sys.sta == runing)
{
NaviKit.sys.next_sta = shutdown;
}
} }
} }
@ -115,6 +115,8 @@ void enter_isp_state()
HAL_Delay(10); HAL_Delay(10);
if(HAL_RTCEx_BKUPRead(&hrtc,RTC_BKP_DR1) == 0x32f2) if(HAL_RTCEx_BKUPRead(&hrtc,RTC_BKP_DR1) == 0x32f2)
{//write successful {//write successful
Beep(500);
Beep(500);
Beep(500); Beep(500);
Beep(500); Beep(500);
Beep(500); Beep(500);
@ -137,7 +139,7 @@ void enter_shutdown_state()
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_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_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_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_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(SOC_U3_GEC_PWR_CTL_GPIO_Port,SOC_U3_GEC_PWR_CTL_Pin, GPIO_PIN_RESET); osDelay(100);
@ -209,7 +211,7 @@ void enter_runing_state()
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_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_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_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_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(SOC_U3_GEC_PWR_CTL_GPIO_Port,SOC_U3_GEC_PWR_CTL_Pin, GPIO_PIN_SET); osDelay(100);
@ -222,10 +224,10 @@ void enter_runing_state()
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_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_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_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_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_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(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); HAL_GPIO_WritePin(SOM_POWER_EN_GPIO_Port ,SOM_POWER_EN_Pin, GPIO_PIN_SET); osDelay(100);
@ -235,11 +237,9 @@ void enter_dfu_state()
{ {
printf("Enter to dfu state \n"); printf("Enter to dfu state \n");
Beep(200); Beep(500);
Beep(200); Beep(500);
Beep(200); Beep(500);
Beep(200);
Beep(200);
HAL_GPIO_WritePin(SOM_FORCE_RECOVERY_GPIO_Port ,SOM_FORCE_RECOVERY_Pin, GPIO_PIN_RESET); osDelay(100); HAL_GPIO_WritePin(SOM_FORCE_RECOVERY_GPIO_Port ,SOM_FORCE_RECOVERY_Pin, GPIO_PIN_RESET); osDelay(100);

View File

@ -77,8 +77,6 @@ void HAL_MspInit(void)
HAL_NVIC_SetPriority(BusFault_IRQn, 5, 0); HAL_NVIC_SetPriority(BusFault_IRQn, 5, 0);
/* UsageFault_IRQn interrupt configuration */ /* UsageFault_IRQn interrupt configuration */
HAL_NVIC_SetPriority(UsageFault_IRQn, 5, 0); HAL_NVIC_SetPriority(UsageFault_IRQn, 5, 0);
/* SVCall_IRQn interrupt configuration */
HAL_NVIC_SetPriority(SVCall_IRQn, 5, 0);
/* DebugMonitor_IRQn interrupt configuration */ /* DebugMonitor_IRQn interrupt configuration */
HAL_NVIC_SetPriority(DebugMonitor_IRQn, 5, 0); HAL_NVIC_SetPriority(DebugMonitor_IRQn, 5, 0);
/* PendSV_IRQn interrupt configuration */ /* PendSV_IRQn interrupt configuration */

View File

@ -40,19 +40,19 @@
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.frequency" value="0"/> <stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.frequency" value="0"/>
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.halt_all_on_reset" value="false"/> <booleanAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.halt_all_on_reset" value="false"/>
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.log_file" value="E:\source\NaviKit_stm32\Debug\st-link_gdbserver_log.txt"/> <stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.log_file" value="E:\source\NaviKit_stm32\Debug\st-link_gdbserver_log.txt"/>
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.low_power_debug" value="enable"/> <stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.low_power_debug" value="none"/>
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.max_halt_delay" value="2"/> <stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.max_halt_delay" value="2"/>
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.reset_strategy" value="system_reset"/> <stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.reset_strategy" value="connect_under_reset"/>
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.stlink_check_serial_number" value="false"/> <booleanAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.stlink_check_serial_number" value="false"/>
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.stlink_txt_serial_number" value=""/> <stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.stlink_txt_serial_number" value=""/>
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.watchdog_config" value="none"/> <stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.watchdog_config" value="enable"/>
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.doHalt" value="false"/> <booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.doHalt" value="false"/>
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.doReset" value="false"/> <booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.doReset" value="false"/>
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.initCommands" value=""/> <stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.initCommands" value=""/>
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.ipAddress" value="localhost"/> <stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.ipAddress" value="localhost"/>
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.jtagDevice" value="ST-LINK (ST-LINK GDB server)"/> <stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.jtagDevice" value="ST-LINK (ST-LINK GDB server)"/>
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.pcRegister" value=""/> <stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.pcRegister" value=""/>
<intAttribute key="org.eclipse.cdt.debug.gdbjtag.core.portNumber" value="51234"/> <intAttribute key="org.eclipse.cdt.debug.gdbjtag.core.portNumber" value="61234"/>
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.runCommands" value=""/> <stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.runCommands" value=""/>
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.setPcRegister" value="false"/> <booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.setPcRegister" value="false"/>
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.setResume" value="true"/> <booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.setResume" value="true"/>

View File

@ -70,21 +70,21 @@ FREERTOS.FootprintOK=true
FREERTOS.HEAP_NUMBER=4 FREERTOS.HEAP_NUMBER=4
FREERTOS.INCLUDE_xTaskGetCurrentTaskHandle=1 FREERTOS.INCLUDE_xTaskGetCurrentTaskHandle=1
FREERTOS.INCLUDE_xTaskGetHandle=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,configCHECK_FOR_STACK_OVERFLOW,Queues01,Mutexes01 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,configUSE_TASK_NOTIFICATIONS
FREERTOS.Mutexes01=uartMutex,Dynamic,NULL FREERTOS.Queues01=uartQueue,128,uint8_t,0,Dynamic,NULL,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;uartQueueTask,8,128,StartUartQueueTask,Default,NULL,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=0
FREERTOS.configCHECK_FOR_STACK_OVERFLOW=1
FREERTOS.configGENERATE_RUN_TIME_STATS=0 FREERTOS.configGENERATE_RUN_TIME_STATS=0
FREERTOS.configMAX_TASK_NAME_LEN=32 FREERTOS.configMAX_TASK_NAME_LEN=32
FREERTOS.configTOTAL_HEAP_SIZE=8192 FREERTOS.configTOTAL_HEAP_SIZE=8192
FREERTOS.configUSE_APPLICATION_TASK_TAG=0 FREERTOS.configUSE_APPLICATION_TASK_TAG=0
FREERTOS.configUSE_IDLE_HOOK=1 FREERTOS.configUSE_IDLE_HOOK=0
FREERTOS.configUSE_MALLOC_FAILED_HOOK=0 FREERTOS.configUSE_MALLOC_FAILED_HOOK=0
FREERTOS.configUSE_STATS_FORMATTING_FUNCTIONS=0 FREERTOS.configUSE_STATS_FORMATTING_FUNCTIONS=0
FREERTOS.configUSE_TASK_NOTIFICATIONS=1
FREERTOS.configUSE_TICKLESS_IDLE=0 FREERTOS.configUSE_TICKLESS_IDLE=0
FREERTOS.configUSE_TICK_HOOK=0 FREERTOS.configUSE_TICK_HOOK=0
FREERTOS.configUSE_TRACE_FACILITY=1 FREERTOS.configUSE_TRACE_FACILITY=0
File.Version=6 File.Version=6
GPIO.groupedBy=Group By Peripherals GPIO.groupedBy=Group By Peripherals
IWDG.IPParameters=Prescaler,Reload IWDG.IPParameters=Prescaler,Reload
@ -207,7 +207,7 @@ NVIC.PendSV_IRQn=true\:15\:0\:false\:false\:false\:true\:false\:false
NVIC.PriorityGroup=NVIC_PRIORITYGROUP_4 NVIC.PriorityGroup=NVIC_PRIORITYGROUP_4
NVIC.RCC_IRQn=true\:5\:0\:false\:true\:true\:3\:true\:true\: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.RTC_IRQn=true\:5\:0\:true\:false\:true\:true\:true\:true
NVIC.SVCall_IRQn=true\:5\:0\:false\:false\:false\:true\:false\:false NVIC.SVCall_IRQn=true\:0\:0\:false\:false\:false\:false\:false\:false
NVIC.SysTick_IRQn=true\:15\: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.TIM1_UP_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:true
NVIC.TimeBase=TIM1_UP_IRQn NVIC.TimeBase=TIM1_UP_IRQn
@ -416,8 +416,9 @@ PD4.GPIOParameters=GPIO_Label
PD4.GPIO_Label=SOM_POWER_EN PD4.GPIO_Label=SOM_POWER_EN
PD4.Locked=true PD4.Locked=true
PD4.Signal=GPIO_Output PD4.Signal=GPIO_Output
PD5.GPIOParameters=GPIO_Label PD5.GPIOParameters=GPIO_Label,GPIO_ModeDefaultEXTI
PD5.GPIO_Label=SOM_SHUTDOWN_REQ PD5.GPIO_Label=SOM_SHUTDOWN_REQ
PD5.GPIO_ModeDefaultEXTI=GPIO_MODE_IT_RISING_FALLING
PD5.Locked=true PD5.Locked=true
PD5.Signal=GPXTI5 PD5.Signal=GPXTI5
PD6.GPIOParameters=PinState,GPIO_Label PD6.GPIOParameters=PinState,GPIO_Label
@ -500,7 +501,7 @@ ProjectManager.DeviceId=STM32F107VCTx
ProjectManager.FirmwarePackage=STM32Cube FW_F1 V1.8.0 ProjectManager.FirmwarePackage=STM32Cube FW_F1 V1.8.0
ProjectManager.FreePins=false ProjectManager.FreePins=false
ProjectManager.HalAssertFull=false ProjectManager.HalAssertFull=false
ProjectManager.HeapSize=0x200 ProjectManager.HeapSize=0x400
ProjectManager.KeepUserCode=true ProjectManager.KeepUserCode=true
ProjectManager.LastFirmware=true ProjectManager.LastFirmware=true
ProjectManager.LibraryCopy=1 ProjectManager.LibraryCopy=1
@ -510,7 +511,7 @@ ProjectManager.PreviousToolchain=
ProjectManager.ProjectBuild=false ProjectManager.ProjectBuild=false
ProjectManager.ProjectFileName=NaviKit_stm32.ioc ProjectManager.ProjectFileName=NaviKit_stm32.ioc
ProjectManager.ProjectName=NaviKit_stm32 ProjectManager.ProjectName=NaviKit_stm32
ProjectManager.StackSize=0x400 ProjectManager.StackSize=0x800
ProjectManager.TargetToolchain=STM32CubeIDE ProjectManager.TargetToolchain=STM32CubeIDE
ProjectManager.ToolChainLocation= ProjectManager.ToolChainLocation=
ProjectManager.UnderRoot=true ProjectManager.UnderRoot=true

View File

@ -45,7 +45,7 @@
1. 关机状态; 1. 关机状态;
2. 按下`重启`按钮; 2. 按下`重启`按钮;
3. 按下`电源`按钮; 3. 按下`电源`按钮;
4. 听到滴声后,松开两个按钮。 4. 听到`3次滴声`后,松开两个按钮。(电源灯表示为闪烁状态)
5. 检查Host PC是否有一个名为Nvidia的设备 5. 检查Host PC是否有一个名为Nvidia的设备
@ -58,6 +58,6 @@
* 进入方法: * 进入方法:
1. 断开主板的主电源和备用电源并将主板BIOS的USB typeC接口和Host PC连接 1. 断开主板的主电源和备用电源并将主板BIOS的USB typeC接口和Host PC连接
3. 按下`重启`按钮,插入主板的主电源,听到滴声后,松开`重启`按钮; 3. 按下`重启`按钮,插入主板的主电源,听到`5次滴声`后,松开`重启`按钮;
4. 打开STM32CubeProgrammer选择UART模式点击Connect 4. 打开STM32CubeProgrammer选择UART模式点击Connect
5. 点击Open选择新固件点击Download 5. 点击Open选择新固件点击Download

View File

@ -55,8 +55,8 @@ ENTRY(Reset_Handler)
/* Highest address of the user mode stack */ /* Highest address of the user mode stack */
_estack = ORIGIN(RAM) + LENGTH(RAM); /* end of "RAM" Ram type memory */ _estack = ORIGIN(RAM) + LENGTH(RAM); /* end of "RAM" Ram type memory */
_Min_Heap_Size = 0x200 ; /* required amount of heap */ _Min_Heap_Size = 0x400 ; /* required amount of heap */
_Min_Stack_Size = 0x400 ; /* required amount of stack */ _Min_Stack_Size = 0x800 ; /* required amount of stack */
/* Memories definition */ /* Memories definition */
MEMORY MEMORY