From c3347af35e57e15fa06e1f2196f3e4f79c6392ff Mon Sep 17 00:00:00 2001 From: zhaohe Date: Wed, 27 Dec 2023 22:13:55 +0800 Subject: [PATCH] v1.0-step1 --- .settings/stm32cubeide.project.prefs | 4 ++-- Core/Inc/FreeRTOSConfig.h | 2 +- Intelligent_winding_robot_main_board.ioc | 4 ++-- Intelligent_winding_robot_main_board.launch | 2 +- STM32F407ZGTX_FLASH.ld | 2 +- sdk | 2 +- usrc/device.cpp | 30 ++++++++++++++++------------- 7 files changed, 25 insertions(+), 21 deletions(-) diff --git a/.settings/stm32cubeide.project.prefs b/.settings/stm32cubeide.project.prefs index 43115de..21d655b 100644 --- a/.settings/stm32cubeide.project.prefs +++ b/.settings/stm32cubeide.project.prefs @@ -1,5 +1,5 @@ 635E684B79701B039C64EA45C3F84D30=6180EFBD1DA04EB1319C95830D4DB159 66BE74F758C12D739921AEA421D593D3=5 -8DF89ED150041C4CBC7CB9A9CAA90856=F84C9880C15B9874E9E687B6E474D0B5 -DC22A860405A8BF2F2C095E5B6529F12=F84C9880C15B9874E9E687B6E474D0B5 +8DF89ED150041C4CBC7CB9A9CAA90856=9FE8B57A80F4C5C9B24FE12120255044 +DC22A860405A8BF2F2C095E5B6529F12=9FE8B57A80F4C5C9B24FE12120255044 eclipse.preferences.version=1 diff --git a/Core/Inc/FreeRTOSConfig.h b/Core/Inc/FreeRTOSConfig.h index 1eb7a78..76606e5 100644 --- a/Core/Inc/FreeRTOSConfig.h +++ b/Core/Inc/FreeRTOSConfig.h @@ -64,7 +64,7 @@ #define configTICK_RATE_HZ ((TickType_t)1000) #define configMAX_PRIORITIES ( 7 ) #define configMINIMAL_STACK_SIZE ((uint16_t)128) -#define configTOTAL_HEAP_SIZE ((size_t)30000) +#define configTOTAL_HEAP_SIZE ((size_t)40000) #define configMAX_TASK_NAME_LEN ( 16 ) #define configUSE_16_BIT_TICKS 0 #define configUSE_MUTEXES 1 diff --git a/Intelligent_winding_robot_main_board.ioc b/Intelligent_winding_robot_main_board.ioc index 3f2772d..eb6a311 100644 --- a/Intelligent_winding_robot_main_board.ioc +++ b/Intelligent_winding_robot_main_board.ioc @@ -95,7 +95,7 @@ Dma.USART3_TX.1.RequestParameters=Instance,Direction,PeriphInc,MemInc,PeriphData FREERTOS.FootprintOK=true FREERTOS.IPParameters=Tasks01,FootprintOK,configUSE_RECURSIVE_MUTEXES,configUSE_NEWLIB_REENTRANT,configTOTAL_HEAP_SIZE FREERTOS.Tasks01=defaultTask,0,512,StartDefaultTask,As weak,NULL,Dynamic,NULL,NULL -FREERTOS.configTOTAL_HEAP_SIZE=20000 +FREERTOS.configTOTAL_HEAP_SIZE=25000 FREERTOS.configUSE_NEWLIB_REENTRANT=1 FREERTOS.configUSE_RECURSIVE_MUTEXES=1 File.Version=6 @@ -212,7 +212,7 @@ ProjectManager.DeviceId=STM32F407ZGTx ProjectManager.FirmwarePackage=STM32Cube FW_F4 V1.27.1 ProjectManager.FreePins=false ProjectManager.HalAssertFull=false -ProjectManager.HeapSize=0x8000 +ProjectManager.HeapSize=0x2000 ProjectManager.KeepUserCode=true ProjectManager.LastFirmware=true ProjectManager.LibraryCopy=1 diff --git a/Intelligent_winding_robot_main_board.launch b/Intelligent_winding_robot_main_board.launch index 951f0cd..c3b1922 100644 --- a/Intelligent_winding_robot_main_board.launch +++ b/Intelligent_winding_robot_main_board.launch @@ -36,7 +36,7 @@ - + diff --git a/STM32F407ZGTX_FLASH.ld b/STM32F407ZGTX_FLASH.ld index 7a03950..c59dca4 100644 --- a/STM32F407ZGTX_FLASH.ld +++ b/STM32F407ZGTX_FLASH.ld @@ -39,7 +39,7 @@ ENTRY(Reset_Handler) /* Highest address of the user mode stack */ _estack = ORIGIN(RAM) + LENGTH(RAM); /* end of "RAM" Ram type memory */ -_Min_Heap_Size = 0x8000; /* required amount of heap */ +_Min_Heap_Size = 0x2000; /* required amount of heap */ _Min_Stack_Size = 0x1000; /* required amount of stack */ /* Memories definition */ diff --git a/sdk b/sdk index aa9d1dd..85b8278 160000 --- a/sdk +++ b/sdk @@ -1 +1 @@ -Subproject commit aa9d1dda89f177ad23af5013fdaf5d8f29c0f8a6 +Subproject commit 85b827815841cd0ad95352d5ee5917a6034c45e3 diff --git a/usrc/device.cpp b/usrc/device.cpp index 23e269d..ed1d90b 100644 --- a/usrc/device.cpp +++ b/usrc/device.cpp @@ -32,6 +32,7 @@ void Device::init() { init_dm(); init_bus(); sub_module_init(); + ZLOGI(TAG, "init end..."); while (true) { OSDefaultSchduler::getInstance()->loop(); @@ -78,7 +79,6 @@ void Device::init_bus() { ZLOGI(TAG, "init feite bus"); ZASSERT(huart3.Init.BaudRate == 115200); m_feitebus.initialize(&huart3, &hdma_usart3_rx, &hdma_usart3_tx); - /******************************************************************************* * 初始化MODBUS总线 * *******************************************************************************/ @@ -101,7 +101,7 @@ void Device::sub_module_init() { */ static MiniRobotCtrlModule::flash_config_t servo_cfg = {.default_torque = 330}; static MiniRobotCtrlModule mini_servo[10]; - for (size_t i = 0; i < 6; i++) { + for (size_t i = 1; i <= 6; i++) { int idnum = 10 + i; ZLOGI(TAG, "init servo:%d", idnum); mini_servo[i].initialize(idnum, &m_feitebus, idnum, &servo_cfg); @@ -128,23 +128,27 @@ void Device::sub_module_init() { static ZIProtocolProxy z_axis_board_can_module_proxy[4]; z_axis_board_can_module_proxy[0].initialize(30, &m_zcanbus); // BOARD3 Z轴板子 z_axis_board_can_module_proxy[1].initialize(31, &m_zcanbus); - z_axis_board_can_module_proxy[1].initialize(32, &m_zcanbus); - z_axis_board_can_module_proxy[2].initialize(33, &m_zcanbus); + z_axis_board_can_module_proxy[2].initialize(32, &m_zcanbus); + z_axis_board_can_module_proxy[3].initialize(33, &m_zcanbus); REG_SUB_MODULE(z_axis_board_can_module_proxy); /** * @brief 初始化 * CAN步进电机模块 */ - static ZIProtocolProxy can_step_motor_proxy[6]; - can_step_motor_proxy[0].initialize(40, &m_zcanbus); // BOARD4 - can_step_motor_proxy[1].initialize(41, &m_zcanbus); - - can_step_motor_proxy[2].initialize(50, &m_zcanbus); // BOARD5 - can_step_motor_proxy[3].initialize(51, &m_zcanbus); - - can_step_motor_proxy[4].initialize(60, &m_zcanbus); // BOARD6 - can_step_motor_proxy[5].initialize(61, &m_zcanbus); + static ZIProtocolProxy can_step_motor_proxy[9]; + int i = 0; + can_step_motor_proxy[i++].initialize(40, &m_zcanbus); // BOARD4 + can_step_motor_proxy[i++].initialize(41, &m_zcanbus); + can_step_motor_proxy[i++].initialize(42, &m_zcanbus); + + can_step_motor_proxy[i++].initialize(50, &m_zcanbus); // BOARD5 + can_step_motor_proxy[i++].initialize(51, &m_zcanbus); + can_step_motor_proxy[i++].initialize(52, &m_zcanbus); + + can_step_motor_proxy[i++].initialize(60, &m_zcanbus); // BOARD6 + can_step_motor_proxy[i++].initialize(61, &m_zcanbus); + can_step_motor_proxy[i++].initialize(62, &m_zcanbus); REG_SUB_MODULE(can_step_motor_proxy); }