diff --git a/Core/Inc/navikit.h b/Core/Inc/navikit.h index db9328b..d7db43a 100644 --- a/Core/Inc/navikit.h +++ b/Core/Inc/navikit.h @@ -22,7 +22,7 @@ typedef struct struct{ enum { shutdown, //only mcu runing - runing, //all function runing + running, //all function runing sleep, //SOCs and FANs are stop dfu, //device firmware update for SOM isp //in system program for BIOS diff --git a/Core/Src/freertos.c b/Core/Src/freertos.c index d6c7b5f..afb4615 100644 --- a/Core/Src/freertos.c +++ b/Core/Src/freertos.c @@ -157,7 +157,7 @@ void MX_FREERTOS_Init(void) { /* Create the queue(s) */ /* creation of uartQueue */ - uartQueueHandle = osMessageQueueNew (128, sizeof(uint8_t), &uartQueue_attributes); + uartQueueHandle = osMessageQueueNew (1024, sizeof(uint8_t), &uartQueue_attributes); /* USER CODE BEGIN RTOS_QUEUES */ /* add queues, ... */ @@ -207,24 +207,28 @@ void StartDefaultTask(void *argument) /* init code for USB_DEVICE */ MX_USB_DEVICE_Init(); /* 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); Beep(50); + printf("\nCore initial successfully\n"); + printf("---------------------------------------------\n"); + printf("Copyright (c) Powered by www.autolabor.com.cn\n"); + osDelay(100); + 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()); + osDelay(100); + printf("Chip UID: %d%d%d \n", HAL_GetUIDw0(),HAL_GetUIDw1(),HAL_GetUIDw2); + printf("----------------------------------------------\n"); /* Infinite loop */ for(;;) { osDelay(100); -// count = osMessageQueueGetCount(uartQueueHandle); -// if(count){ -// for(uint8_t i=0;i0){ + osMessageQueuePut(uartQueueHandle,(uint8_t*)&ch,0,100); + } + else{ +// uint8_t front[1];//trash +// osMessageQueueGet(uartQueueHandle,front,0,10); +// osMessageQueuePut(uartQueueHandle,(uint8_t *)&ch,0,100); + } return ch; } -#endif + /* USER CODE END Application */ /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/Core/Src/main.c b/Core/Src/main.c index abb2884..6199d03 100644 --- a/Core/Src/main.c +++ b/Core/Src/main.c @@ -108,16 +108,7 @@ int main(void) /* Initialize interrupts */ MX_NVIC_Init(); /* USER CODE BEGIN 2 */ - //HAL_IWDG_Refresh(&hiwdg); - printf("\nCore 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("HAL Version: %d \n", HAL_GetHalVersion()); - printf("Revision ID: %d \n", HAL_GetREVID()); - printf("Device ID: %d \n", HAL_GetDEVID()); - printf("Chip UID: %d%d%d \n", HAL_GetUIDw0(),HAL_GetUIDw1(),HAL_GetUIDw2); - printf("----------------------------------------------\n"); + /* USER CODE END 2 */ /* Init scheduler */ @@ -231,7 +222,7 @@ static void MX_NVIC_Init(void) /* USER CODE BEGIN 4 */ void ISP_Judge() -{ +{//Judge that if need jump to ISP area RTC_HandleTypeDef hrtc; hrtc.Instance = RTC; if(HAL_RTCEx_BKUPRead(&hrtc,RTC_BKP_DR1) == 0x32f2) diff --git a/Core/Src/navikit.c b/Core/Src/navikit.c index b34fda0..0dfb15b 100644 --- a/Core/Src/navikit.c +++ b/Core/Src/navikit.c @@ -60,7 +60,7 @@ void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin) if(HAL_GPIO_ReadPin(SOM_SHUTDOWN_REQ_GPIO_Port, SOM_SHUTDOWN_REQ_Pin)==GPIO_PIN_RESET) {//falling edge trigger // NaviKit.som.shutdown_req = false; - if(NaviKit.sys.sta == runing) + if(NaviKit.sys.sta == running) { NaviKit.sys.next_sta = shutdown; }