上位机联调正常
This commit is contained in:
parent
2514a1efe7
commit
922d376bcc
|
@ -41,11 +41,14 @@ void MX_ADC_Init(void)
|
|||
LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_ADC1);
|
||||
|
||||
LL_IOP_GRP1_EnableClock(LL_IOP_GRP1_PERIPH_GPIOC);
|
||||
LL_IOP_GRP1_EnableClock(LL_IOP_GRP1_PERIPH_GPIOA);
|
||||
LL_IOP_GRP1_EnableClock(LL_IOP_GRP1_PERIPH_GPIOB);
|
||||
/**ADC GPIO Configuration
|
||||
PC0 ------> ADC_IN10
|
||||
PC3 ------> ADC_IN13
|
||||
PA7 ------> ADC_IN7
|
||||
PB0 ------> ADC_IN8
|
||||
PB1 ------> ADC_IN9
|
||||
*/
|
||||
GPIO_InitStruct.Pin = LL_GPIO_PIN_0;
|
||||
GPIO_InitStruct.Mode = LL_GPIO_MODE_ANALOG;
|
||||
|
@ -57,11 +60,21 @@ void MX_ADC_Init(void)
|
|||
GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
|
||||
LL_GPIO_Init(MG_ADC_IN13_GPIO_Port, &GPIO_InitStruct);
|
||||
|
||||
GPIO_InitStruct.Pin = LL_GPIO_PIN_7;
|
||||
GPIO_InitStruct.Mode = LL_GPIO_MODE_ANALOG;
|
||||
GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
|
||||
LL_GPIO_Init(GPIOA, &GPIO_InitStruct);
|
||||
|
||||
GPIO_InitStruct.Pin = LL_GPIO_PIN_0;
|
||||
GPIO_InitStruct.Mode = LL_GPIO_MODE_ANALOG;
|
||||
GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
|
||||
LL_GPIO_Init(GPIOB, &GPIO_InitStruct);
|
||||
|
||||
GPIO_InitStruct.Pin = LL_GPIO_PIN_1;
|
||||
GPIO_InitStruct.Mode = LL_GPIO_MODE_ANALOG;
|
||||
GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
|
||||
LL_GPIO_Init(GPIOB, &GPIO_InitStruct);
|
||||
|
||||
/* ADC DMA Init */
|
||||
|
||||
/* ADC Init */
|
||||
|
@ -85,10 +98,18 @@ void MX_ADC_Init(void)
|
|||
|
||||
/* USER CODE END ADC_Init 1 */
|
||||
|
||||
/** Configure Regular Channel
|
||||
*/
|
||||
LL_ADC_REG_SetSequencerChAdd(ADC1, LL_ADC_CHANNEL_7);
|
||||
|
||||
/** Configure Regular Channel
|
||||
*/
|
||||
LL_ADC_REG_SetSequencerChAdd(ADC1, LL_ADC_CHANNEL_8);
|
||||
|
||||
/** Configure Regular Channel
|
||||
*/
|
||||
LL_ADC_REG_SetSequencerChAdd(ADC1, LL_ADC_CHANNEL_9);
|
||||
|
||||
/** Configure Regular Channel
|
||||
*/
|
||||
LL_ADC_REG_SetSequencerChAdd(ADC1, LL_ADC_CHANNEL_10);
|
||||
|
|
|
@ -132,12 +132,6 @@ void MX_GPIO_Init(void)
|
|||
GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
|
||||
LL_GPIO_Init(GPIOA, &GPIO_InitStruct);
|
||||
|
||||
/**/
|
||||
GPIO_InitStruct.Pin = LL_GPIO_PIN_7;
|
||||
GPIO_InitStruct.Mode = LL_GPIO_MODE_ANALOG;
|
||||
GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
|
||||
LL_GPIO_Init(GPIOA, &GPIO_InitStruct);
|
||||
|
||||
/**/
|
||||
GPIO_InitStruct.Pin = LL_GPIO_PIN_4;
|
||||
GPIO_InitStruct.Mode = LL_GPIO_MODE_ANALOG;
|
||||
|
@ -150,12 +144,6 @@ void MX_GPIO_Init(void)
|
|||
GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
|
||||
LL_GPIO_Init(GPIOC, &GPIO_InitStruct);
|
||||
|
||||
/**/
|
||||
GPIO_InitStruct.Pin = LL_GPIO_PIN_1;
|
||||
GPIO_InitStruct.Mode = LL_GPIO_MODE_ANALOG;
|
||||
GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
|
||||
LL_GPIO_Init(GPIOB, &GPIO_InitStruct);
|
||||
|
||||
/**/
|
||||
GPIO_InitStruct.Pin = LL_GPIO_PIN_2;
|
||||
GPIO_InitStruct.Mode = LL_GPIO_MODE_ANALOG;
|
||||
|
|
|
@ -165,6 +165,21 @@
|
|||
<WinNumber>1</WinNumber>
|
||||
<ItemText>self_test,0x0A</ItemText>
|
||||
</Ww>
|
||||
<Ww>
|
||||
<count>3</count>
|
||||
<WinNumber>1</WinNumber>
|
||||
<ItemText>motor,0x0A</ItemText>
|
||||
</Ww>
|
||||
<Ww>
|
||||
<count>4</count>
|
||||
<WinNumber>1</WinNumber>
|
||||
<ItemText>motor_param,0x0A</ItemText>
|
||||
</Ww>
|
||||
<Ww>
|
||||
<count>5</count>
|
||||
<WinNumber>1</WinNumber>
|
||||
<ItemText>adc_value,0x0A</ItemText>
|
||||
</Ww>
|
||||
</WatchWindow1>
|
||||
<MemoryWindow1>
|
||||
<Mm>
|
||||
|
@ -228,7 +243,7 @@
|
|||
|
||||
<Group>
|
||||
<GroupName>Application/MDK-ARM</GroupName>
|
||||
<tvExp>1</tvExp>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<cbSel>0</cbSel>
|
||||
<RteFlg>0</RteFlg>
|
||||
|
@ -248,7 +263,7 @@
|
|||
|
||||
<Group>
|
||||
<GroupName>Application/User/Core</GroupName>
|
||||
<tvExp>1</tvExp>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<cbSel>0</cbSel>
|
||||
<RteFlg>0</RteFlg>
|
||||
|
@ -476,7 +491,7 @@
|
|||
|
||||
<Group>
|
||||
<GroupName>User</GroupName>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExp>1</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<cbSel>0</cbSel>
|
||||
<RteFlg>0</RteFlg>
|
||||
|
@ -780,7 +795,7 @@
|
|||
<GroupNumber>9</GroupNumber>
|
||||
<FileNumber>41</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>1</tvExp>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\User\board\board.c</PathWithFileName>
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,938 +0,0 @@
|
|||
|
||||
|
||||
|
||||
ARM Macro Assembler Page 1
|
||||
|
||||
|
||||
1 00000000 ;*******************************************************
|
||||
***********************
|
||||
2 00000000 ;* File Name : startup_stm32l072xx.s
|
||||
3 00000000 ;* Author : MCD Application Team
|
||||
4 00000000 ;* Description : STM32l072xx Devices vector table
|
||||
for MDK-ARM toolchain.
|
||||
5 00000000 ;* This module performs:
|
||||
6 00000000 ;* - Set the initial SP
|
||||
7 00000000 ;* - Set the initial PC == Reset_Ha
|
||||
ndler
|
||||
8 00000000 ;* - Set the vector table entries w
|
||||
ith the exceptions ISR address
|
||||
9 00000000 ;* - Branches to __main in the C lb
|
||||
rary (which eventually
|
||||
10 00000000 ;* calls main()).
|
||||
11 00000000 ;* After Reset the Cortex-M0+ proce
|
||||
ssor is in Thread mode,
|
||||
12 00000000 ;* priority is Privileged, and the
|
||||
Stack is set to Main.
|
||||
13 00000000 ;*******************************************************
|
||||
***********************
|
||||
14 00000000 ;* @attention
|
||||
15 00000000 ;*
|
||||
16 00000000 ;* Copyright (c) 2016 STMicroelectronics.
|
||||
17 00000000 ;* All rights reserved.
|
||||
18 00000000 ;*
|
||||
19 00000000 ;* This software is licensed under terms that can be fou
|
||||
nd in the LICENSE file
|
||||
20 00000000 ;* in the root directory of this software component.
|
||||
21 00000000 ;* If no LICENSE file comes with this software, it is pr
|
||||
ovided AS-IS.
|
||||
22 00000000 ;*
|
||||
23 00000000 ;*******************************************************
|
||||
***********************
|
||||
24 00000000
|
||||
25 00000000 ; Amount of memory (in bytes) allocated for Stack
|
||||
26 00000000 ; Tailor this value to your application needs
|
||||
27 00000000 ; <h> Stack Configuration
|
||||
28 00000000 ; <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
|
||||
29 00000000 ; </h>
|
||||
30 00000000
|
||||
31 00000000 00000600
|
||||
Stack_Size
|
||||
EQU 0x600
|
||||
32 00000000
|
||||
33 00000000 AREA STACK, NOINIT, READWRITE, ALIGN
|
||||
=3
|
||||
34 00000000 Stack_Mem
|
||||
SPACE Stack_Size
|
||||
35 00000600 __initial_sp
|
||||
36 00000600
|
||||
37 00000600
|
||||
38 00000600 ; <h> Heap Configuration
|
||||
39 00000600 ; <o> Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
|
||||
40 00000600 ; </h>
|
||||
41 00000600
|
||||
42 00000600 00000400
|
||||
Heap_Size
|
||||
EQU 0x400
|
||||
|
||||
|
||||
|
||||
ARM Macro Assembler Page 2
|
||||
|
||||
|
||||
43 00000600
|
||||
44 00000600 AREA HEAP, NOINIT, READWRITE, ALIGN=
|
||||
3
|
||||
45 00000000 __heap_base
|
||||
46 00000000 Heap_Mem
|
||||
SPACE Heap_Size
|
||||
47 00000400 __heap_limit
|
||||
48 00000400
|
||||
49 00000400 PRESERVE8
|
||||
50 00000400 THUMB
|
||||
51 00000400
|
||||
52 00000400
|
||||
53 00000400 ; Vector Table Mapped to Address 0 at Reset
|
||||
54 00000400 AREA RESET, DATA, READONLY
|
||||
55 00000000 EXPORT __Vectors
|
||||
56 00000000 EXPORT __Vectors_End
|
||||
57 00000000 EXPORT __Vectors_Size
|
||||
58 00000000
|
||||
59 00000000 00000000
|
||||
__Vectors
|
||||
DCD __initial_sp ; Top of Stack
|
||||
60 00000004 00000000 DCD Reset_Handler ; Reset Handler
|
||||
61 00000008 00000000 DCD NMI_Handler ; NMI Handler
|
||||
62 0000000C 00000000 DCD HardFault_Handler ; Hard Fault
|
||||
Handler
|
||||
63 00000010 00000000 DCD 0 ; Reserved
|
||||
64 00000014 00000000 DCD 0 ; Reserved
|
||||
65 00000018 00000000 DCD 0 ; Reserved
|
||||
66 0000001C 00000000 DCD 0 ; Reserved
|
||||
67 00000020 00000000 DCD 0 ; Reserved
|
||||
68 00000024 00000000 DCD 0 ; Reserved
|
||||
69 00000028 00000000 DCD 0 ; Reserved
|
||||
70 0000002C 00000000 DCD SVC_Handler ; SVCall Handler
|
||||
71 00000030 00000000 DCD 0 ; Reserved
|
||||
72 00000034 00000000 DCD 0 ; Reserved
|
||||
73 00000038 00000000 DCD PendSV_Handler ; PendSV Handler
|
||||
|
||||
74 0000003C 00000000 DCD SysTick_Handler
|
||||
; SysTick Handler
|
||||
75 00000040
|
||||
76 00000040 ; External Interrupts
|
||||
77 00000040 00000000 DCD WWDG_IRQHandler
|
||||
; Window Watchdog
|
||||
78 00000044 00000000 DCD PVD_IRQHandler ; PVD through EX
|
||||
TI Line detect
|
||||
79 00000048 00000000 DCD RTC_IRQHandler ; RTC through EX
|
||||
TI Line
|
||||
80 0000004C 00000000 DCD FLASH_IRQHandler ; FLASH
|
||||
81 00000050 00000000 DCD RCC_CRS_IRQHandler
|
||||
; RCC and CRS
|
||||
82 00000054 00000000 DCD EXTI0_1_IRQHandler
|
||||
; EXTI Line 0 and 1
|
||||
|
||||
83 00000058 00000000 DCD EXTI2_3_IRQHandler
|
||||
; EXTI Line 2 and 3
|
||||
|
||||
84 0000005C 00000000 DCD EXTI4_15_IRQHandler
|
||||
; EXTI Line 4 to 15
|
||||
|
||||
|
||||
|
||||
|
||||
ARM Macro Assembler Page 3
|
||||
|
||||
|
||||
85 00000060 00000000 DCD TSC_IRQHandler ; TSC
|
||||
86 00000064 00000000 DCD DMA1_Channel1_IRQHandler
|
||||
; DMA1 Channel 1
|
||||
87 00000068 00000000 DCD DMA1_Channel2_3_IRQHandler ; DM
|
||||
A1 Channel 2 and Ch
|
||||
annel 3
|
||||
88 0000006C 00000000 DCD DMA1_Channel4_5_6_7_IRQHandler
|
||||
; DMA1 Channel 4, C
|
||||
hannel 5, Channel 6
|
||||
and Channel 7
|
||||
89 00000070 00000000 DCD ADC1_COMP_IRQHandler ; ADC1, CO
|
||||
MP1 and COMP2
|
||||
90 00000074 00000000 DCD LPTIM1_IRQHandler ; LPTIM1
|
||||
91 00000078 00000000 DCD USART4_5_IRQHandler
|
||||
; USART4 and USART5
|
||||
|
||||
92 0000007C 00000000 DCD TIM2_IRQHandler ; TIM2
|
||||
93 00000080 00000000 DCD TIM3_IRQHandler ; TIM3
|
||||
94 00000084 00000000 DCD TIM6_DAC_IRQHandler
|
||||
; TIM6 and DAC
|
||||
95 00000088 00000000 DCD TIM7_IRQHandler ; TIM7
|
||||
96 0000008C 00000000 DCD 0 ; Reserved
|
||||
97 00000090 00000000 DCD TIM21_IRQHandler ; TIM21
|
||||
98 00000094 00000000 DCD I2C3_IRQHandler ; I2C3
|
||||
99 00000098 00000000 DCD TIM22_IRQHandler ; TIM22
|
||||
100 0000009C 00000000 DCD I2C1_IRQHandler ; I2C1
|
||||
101 000000A0 00000000 DCD I2C2_IRQHandler ; I2C2
|
||||
102 000000A4 00000000 DCD SPI1_IRQHandler ; SPI1
|
||||
103 000000A8 00000000 DCD SPI2_IRQHandler ; SPI2
|
||||
104 000000AC 00000000 DCD USART1_IRQHandler ; USART1
|
||||
105 000000B0 00000000 DCD USART2_IRQHandler ; USART2
|
||||
106 000000B4 00000000 DCD RNG_LPUART1_IRQHandler
|
||||
; RNG and LPUART1
|
||||
107 000000B8 00000000 DCD 0 ; Reserved
|
||||
108 000000BC 00000000 DCD USB_IRQHandler ; USB
|
||||
109 000000C0
|
||||
110 000000C0 __Vectors_End
|
||||
111 000000C0
|
||||
112 000000C0 000000C0
|
||||
__Vectors_Size
|
||||
EQU __Vectors_End - __Vectors
|
||||
113 000000C0
|
||||
114 000000C0 AREA |.text|, CODE, READONLY
|
||||
115 00000000
|
||||
116 00000000 ; Reset handler routine
|
||||
117 00000000 Reset_Handler
|
||||
PROC
|
||||
118 00000000 EXPORT Reset_Handler [
|
||||
WEAK]
|
||||
119 00000000 IMPORT __main
|
||||
120 00000000 IMPORT SystemInit
|
||||
121 00000000 4807 LDR R0, =SystemInit
|
||||
122 00000002 4780 BLX R0
|
||||
123 00000004 4807 LDR R0, =__main
|
||||
124 00000006 4700 BX R0
|
||||
125 00000008 ENDP
|
||||
126 00000008
|
||||
127 00000008 ; Dummy Exception Handlers (infinite loops which can be
|
||||
modified)
|
||||
|
||||
|
||||
|
||||
ARM Macro Assembler Page 4
|
||||
|
||||
|
||||
128 00000008
|
||||
129 00000008 NMI_Handler
|
||||
PROC
|
||||
130 00000008 EXPORT NMI_Handler
|
||||
[WEAK]
|
||||
131 00000008 E7FE B .
|
||||
132 0000000A ENDP
|
||||
134 0000000A HardFault_Handler
|
||||
PROC
|
||||
135 0000000A EXPORT HardFault_Handler
|
||||
[WEAK]
|
||||
136 0000000A E7FE B .
|
||||
137 0000000C ENDP
|
||||
138 0000000C SVC_Handler
|
||||
PROC
|
||||
139 0000000C EXPORT SVC_Handler
|
||||
[WEAK]
|
||||
140 0000000C E7FE B .
|
||||
141 0000000E ENDP
|
||||
142 0000000E PendSV_Handler
|
||||
PROC
|
||||
143 0000000E EXPORT PendSV_Handler
|
||||
[WEAK]
|
||||
144 0000000E E7FE B .
|
||||
145 00000010 ENDP
|
||||
146 00000010 SysTick_Handler
|
||||
PROC
|
||||
147 00000010 EXPORT SysTick_Handler
|
||||
[WEAK]
|
||||
148 00000010 E7FE B .
|
||||
149 00000012 ENDP
|
||||
150 00000012
|
||||
151 00000012 Default_Handler
|
||||
PROC
|
||||
152 00000012
|
||||
153 00000012 EXPORT WWDG_IRQHandler
|
||||
[WEAK]
|
||||
154 00000012 EXPORT PVD_IRQHandler
|
||||
[WEAK]
|
||||
155 00000012 EXPORT RTC_IRQHandler
|
||||
[WEAK]
|
||||
156 00000012 EXPORT FLASH_IRQHandler
|
||||
[WEAK]
|
||||
157 00000012 EXPORT RCC_CRS_IRQHandler
|
||||
[WEAK]
|
||||
158 00000012 EXPORT EXTI0_1_IRQHandler
|
||||
[WEAK]
|
||||
159 00000012 EXPORT EXTI2_3_IRQHandler
|
||||
[WEAK]
|
||||
160 00000012 EXPORT EXTI4_15_IRQHandler
|
||||
[WEAK]
|
||||
161 00000012 EXPORT TSC_IRQHandler
|
||||
[WEAK]
|
||||
162 00000012 EXPORT DMA1_Channel1_IRQHandler
|
||||
[WEAK]
|
||||
163 00000012 EXPORT DMA1_Channel2_3_IRQHandler
|
||||
[WEAK]
|
||||
164 00000012 EXPORT DMA1_Channel4_5_6_7_IRQHandler
|
||||
[WEAK]
|
||||
|
||||
|
||||
|
||||
ARM Macro Assembler Page 5
|
||||
|
||||
|
||||
165 00000012 EXPORT ADC1_COMP_IRQHandler
|
||||
[WEAK]
|
||||
166 00000012 EXPORT LPTIM1_IRQHandler
|
||||
[WEAK]
|
||||
167 00000012 EXPORT USART4_5_IRQHandler
|
||||
[WEAK]
|
||||
168 00000012 EXPORT TIM2_IRQHandler
|
||||
[WEAK]
|
||||
169 00000012 EXPORT TIM3_IRQHandler
|
||||
[WEAK]
|
||||
170 00000012 EXPORT TIM6_DAC_IRQHandler
|
||||
[WEAK]
|
||||
171 00000012 EXPORT TIM7_IRQHandler
|
||||
[WEAK]
|
||||
172 00000012 EXPORT TIM21_IRQHandler
|
||||
[WEAK]
|
||||
173 00000012 EXPORT TIM22_IRQHandler
|
||||
[WEAK]
|
||||
174 00000012 EXPORT I2C1_IRQHandler
|
||||
[WEAK]
|
||||
175 00000012 EXPORT I2C2_IRQHandler
|
||||
[WEAK]
|
||||
176 00000012 EXPORT I2C3_IRQHandler
|
||||
[WEAK]
|
||||
177 00000012 EXPORT SPI1_IRQHandler
|
||||
[WEAK]
|
||||
178 00000012 EXPORT SPI2_IRQHandler
|
||||
[WEAK]
|
||||
179 00000012 EXPORT USART1_IRQHandler
|
||||
[WEAK]
|
||||
180 00000012 EXPORT USART2_IRQHandler
|
||||
[WEAK]
|
||||
181 00000012 EXPORT RNG_LPUART1_IRQHandler
|
||||
[WEAK]
|
||||
182 00000012 EXPORT USB_IRQHandler
|
||||
[WEAK]
|
||||
183 00000012
|
||||
184 00000012
|
||||
185 00000012 WWDG_IRQHandler
|
||||
186 00000012 PVD_IRQHandler
|
||||
187 00000012 RTC_IRQHandler
|
||||
188 00000012 FLASH_IRQHandler
|
||||
189 00000012 RCC_CRS_IRQHandler
|
||||
190 00000012 EXTI0_1_IRQHandler
|
||||
191 00000012 EXTI2_3_IRQHandler
|
||||
192 00000012 EXTI4_15_IRQHandler
|
||||
193 00000012 TSC_IRQHandler
|
||||
194 00000012 DMA1_Channel1_IRQHandler
|
||||
195 00000012 DMA1_Channel2_3_IRQHandler
|
||||
196 00000012 DMA1_Channel4_5_6_7_IRQHandler
|
||||
197 00000012 ADC1_COMP_IRQHandler
|
||||
198 00000012 LPTIM1_IRQHandler
|
||||
199 00000012 USART4_5_IRQHandler
|
||||
200 00000012 TIM2_IRQHandler
|
||||
201 00000012 TIM3_IRQHandler
|
||||
202 00000012 TIM6_DAC_IRQHandler
|
||||
203 00000012 TIM7_IRQHandler
|
||||
204 00000012 TIM21_IRQHandler
|
||||
205 00000012 TIM22_IRQHandler
|
||||
|
||||
|
||||
|
||||
ARM Macro Assembler Page 6
|
||||
|
||||
|
||||
206 00000012 I2C1_IRQHandler
|
||||
207 00000012 I2C2_IRQHandler
|
||||
208 00000012 I2C3_IRQHandler
|
||||
209 00000012 SPI1_IRQHandler
|
||||
210 00000012 SPI2_IRQHandler
|
||||
211 00000012 USART1_IRQHandler
|
||||
212 00000012 USART2_IRQHandler
|
||||
213 00000012 RNG_LPUART1_IRQHandler
|
||||
214 00000012 USB_IRQHandler
|
||||
215 00000012
|
||||
216 00000012 E7FE B .
|
||||
217 00000014
|
||||
218 00000014 ENDP
|
||||
219 00000014
|
||||
220 00000014 ALIGN
|
||||
221 00000014
|
||||
222 00000014 ;*******************************************************
|
||||
************************
|
||||
223 00000014 ; User Stack and Heap initialization
|
||||
224 00000014 ;*******************************************************
|
||||
************************
|
||||
225 00000014 IF :DEF:__MICROLIB
|
||||
232 00000014
|
||||
233 00000014 IMPORT __use_two_region_memory
|
||||
234 00000014 EXPORT __user_initial_stackheap
|
||||
235 00000014
|
||||
236 00000014 __user_initial_stackheap
|
||||
237 00000014
|
||||
238 00000014 4804 LDR R0, = Heap_Mem
|
||||
239 00000016 4905 LDR R1, =(Stack_Mem + Stack_Size)
|
||||
240 00000018 4A05 LDR R2, = (Heap_Mem + Heap_Size)
|
||||
241 0000001A 4B06 LDR R3, = Stack_Mem
|
||||
242 0000001C 4770 BX LR
|
||||
243 0000001E
|
||||
244 0000001E 00 00 ALIGN
|
||||
245 00000020
|
||||
246 00000020 ENDIF
|
||||
247 00000020
|
||||
248 00000020 END
|
||||
00000000
|
||||
00000000
|
||||
00000000
|
||||
00000600
|
||||
00000400
|
||||
00000000
|
||||
Command Line: --debug --xref --diag_suppress=9931 --cpu=Cortex-M0+ --apcs=inter
|
||||
work --depend=motor\startup_stm32l072xx.d -omotor\startup_stm32l072xx.o -I.\RTE
|
||||
\_motor -IS:\software\MDK\ARM\Packs\ARM\CMSIS\5.9.0\CMSIS\Core\Include -IS:\sof
|
||||
tware\MDK\ARM\Packs\Keil\STM32L0xx_DFP\2.2.0\Drivers\CMSIS\Device\ST\STM32L0xx\
|
||||
Include --predefine="__UVISION_VERSION SETA 538" --predefine="_RTE_ SETA 1" --p
|
||||
redefine="STM32L072xx SETA 1" --predefine="_RTE_ SETA 1" --list=startup_stm32l0
|
||||
72xx.lst startup_stm32l072xx.s
|
||||
|
||||
|
||||
|
||||
ARM Macro Assembler Page 1 Alphabetic symbol ordering
|
||||
Relocatable symbols
|
||||
|
||||
STACK 00000000
|
||||
|
||||
Symbol: STACK
|
||||
Definitions
|
||||
At line 33 in file startup_stm32l072xx.s
|
||||
Uses
|
||||
None
|
||||
Comment: STACK unused
|
||||
Stack_Mem 00000000
|
||||
|
||||
Symbol: Stack_Mem
|
||||
Definitions
|
||||
At line 34 in file startup_stm32l072xx.s
|
||||
Uses
|
||||
At line 239 in file startup_stm32l072xx.s
|
||||
At line 241 in file startup_stm32l072xx.s
|
||||
|
||||
__initial_sp 00000600
|
||||
|
||||
Symbol: __initial_sp
|
||||
Definitions
|
||||
At line 35 in file startup_stm32l072xx.s
|
||||
Uses
|
||||
At line 59 in file startup_stm32l072xx.s
|
||||
Comment: __initial_sp used once
|
||||
3 symbols
|
||||
|
||||
|
||||
|
||||
ARM Macro Assembler Page 1 Alphabetic symbol ordering
|
||||
Relocatable symbols
|
||||
|
||||
HEAP 00000000
|
||||
|
||||
Symbol: HEAP
|
||||
Definitions
|
||||
At line 44 in file startup_stm32l072xx.s
|
||||
Uses
|
||||
None
|
||||
Comment: HEAP unused
|
||||
Heap_Mem 00000000
|
||||
|
||||
Symbol: Heap_Mem
|
||||
Definitions
|
||||
At line 46 in file startup_stm32l072xx.s
|
||||
Uses
|
||||
At line 238 in file startup_stm32l072xx.s
|
||||
At line 240 in file startup_stm32l072xx.s
|
||||
|
||||
__heap_base 00000000
|
||||
|
||||
Symbol: __heap_base
|
||||
Definitions
|
||||
At line 45 in file startup_stm32l072xx.s
|
||||
Uses
|
||||
None
|
||||
Comment: __heap_base unused
|
||||
__heap_limit 00000400
|
||||
|
||||
Symbol: __heap_limit
|
||||
Definitions
|
||||
At line 47 in file startup_stm32l072xx.s
|
||||
Uses
|
||||
None
|
||||
Comment: __heap_limit unused
|
||||
4 symbols
|
||||
|
||||
|
||||
|
||||
ARM Macro Assembler Page 1 Alphabetic symbol ordering
|
||||
Relocatable symbols
|
||||
|
||||
RESET 00000000
|
||||
|
||||
Symbol: RESET
|
||||
Definitions
|
||||
At line 54 in file startup_stm32l072xx.s
|
||||
Uses
|
||||
None
|
||||
Comment: RESET unused
|
||||
__Vectors 00000000
|
||||
|
||||
Symbol: __Vectors
|
||||
Definitions
|
||||
At line 59 in file startup_stm32l072xx.s
|
||||
Uses
|
||||
At line 55 in file startup_stm32l072xx.s
|
||||
At line 112 in file startup_stm32l072xx.s
|
||||
|
||||
__Vectors_End 000000C0
|
||||
|
||||
Symbol: __Vectors_End
|
||||
Definitions
|
||||
At line 110 in file startup_stm32l072xx.s
|
||||
Uses
|
||||
At line 56 in file startup_stm32l072xx.s
|
||||
At line 112 in file startup_stm32l072xx.s
|
||||
|
||||
3 symbols
|
||||
|
||||
|
||||
|
||||
ARM Macro Assembler Page 1 Alphabetic symbol ordering
|
||||
Relocatable symbols
|
||||
|
||||
.text 00000000
|
||||
|
||||
Symbol: .text
|
||||
Definitions
|
||||
At line 114 in file startup_stm32l072xx.s
|
||||
Uses
|
||||
None
|
||||
Comment: .text unused
|
||||
ADC1_COMP_IRQHandler 00000012
|
||||
|
||||
Symbol: ADC1_COMP_IRQHandler
|
||||
Definitions
|
||||
At line 197 in file startup_stm32l072xx.s
|
||||
Uses
|
||||
At line 89 in file startup_stm32l072xx.s
|
||||
At line 165 in file startup_stm32l072xx.s
|
||||
|
||||
DMA1_Channel1_IRQHandler 00000012
|
||||
|
||||
Symbol: DMA1_Channel1_IRQHandler
|
||||
Definitions
|
||||
At line 194 in file startup_stm32l072xx.s
|
||||
Uses
|
||||
At line 86 in file startup_stm32l072xx.s
|
||||
At line 162 in file startup_stm32l072xx.s
|
||||
|
||||
DMA1_Channel2_3_IRQHandler 00000012
|
||||
|
||||
Symbol: DMA1_Channel2_3_IRQHandler
|
||||
Definitions
|
||||
At line 195 in file startup_stm32l072xx.s
|
||||
Uses
|
||||
At line 87 in file startup_stm32l072xx.s
|
||||
At line 163 in file startup_stm32l072xx.s
|
||||
|
||||
DMA1_Channel4_5_6_7_IRQHandler 00000012
|
||||
|
||||
Symbol: DMA1_Channel4_5_6_7_IRQHandler
|
||||
Definitions
|
||||
At line 196 in file startup_stm32l072xx.s
|
||||
Uses
|
||||
At line 88 in file startup_stm32l072xx.s
|
||||
At line 164 in file startup_stm32l072xx.s
|
||||
|
||||
Default_Handler 00000012
|
||||
|
||||
Symbol: Default_Handler
|
||||
Definitions
|
||||
At line 151 in file startup_stm32l072xx.s
|
||||
Uses
|
||||
None
|
||||
Comment: Default_Handler unused
|
||||
EXTI0_1_IRQHandler 00000012
|
||||
|
||||
Symbol: EXTI0_1_IRQHandler
|
||||
Definitions
|
||||
At line 190 in file startup_stm32l072xx.s
|
||||
Uses
|
||||
At line 82 in file startup_stm32l072xx.s
|
||||
|
||||
|
||||
|
||||
ARM Macro Assembler Page 2 Alphabetic symbol ordering
|
||||
Relocatable symbols
|
||||
|
||||
At line 158 in file startup_stm32l072xx.s
|
||||
|
||||
EXTI2_3_IRQHandler 00000012
|
||||
|
||||
Symbol: EXTI2_3_IRQHandler
|
||||
Definitions
|
||||
At line 191 in file startup_stm32l072xx.s
|
||||
Uses
|
||||
At line 83 in file startup_stm32l072xx.s
|
||||
At line 159 in file startup_stm32l072xx.s
|
||||
|
||||
EXTI4_15_IRQHandler 00000012
|
||||
|
||||
Symbol: EXTI4_15_IRQHandler
|
||||
Definitions
|
||||
At line 192 in file startup_stm32l072xx.s
|
||||
Uses
|
||||
At line 84 in file startup_stm32l072xx.s
|
||||
At line 160 in file startup_stm32l072xx.s
|
||||
|
||||
FLASH_IRQHandler 00000012
|
||||
|
||||
Symbol: FLASH_IRQHandler
|
||||
Definitions
|
||||
At line 188 in file startup_stm32l072xx.s
|
||||
Uses
|
||||
At line 80 in file startup_stm32l072xx.s
|
||||
At line 156 in file startup_stm32l072xx.s
|
||||
|
||||
HardFault_Handler 0000000A
|
||||
|
||||
Symbol: HardFault_Handler
|
||||
Definitions
|
||||
At line 134 in file startup_stm32l072xx.s
|
||||
Uses
|
||||
At line 62 in file startup_stm32l072xx.s
|
||||
At line 135 in file startup_stm32l072xx.s
|
||||
|
||||
I2C1_IRQHandler 00000012
|
||||
|
||||
Symbol: I2C1_IRQHandler
|
||||
Definitions
|
||||
At line 206 in file startup_stm32l072xx.s
|
||||
Uses
|
||||
At line 100 in file startup_stm32l072xx.s
|
||||
At line 174 in file startup_stm32l072xx.s
|
||||
|
||||
I2C2_IRQHandler 00000012
|
||||
|
||||
Symbol: I2C2_IRQHandler
|
||||
Definitions
|
||||
At line 207 in file startup_stm32l072xx.s
|
||||
Uses
|
||||
At line 101 in file startup_stm32l072xx.s
|
||||
At line 175 in file startup_stm32l072xx.s
|
||||
|
||||
I2C3_IRQHandler 00000012
|
||||
|
||||
Symbol: I2C3_IRQHandler
|
||||
|
||||
|
||||
|
||||
ARM Macro Assembler Page 3 Alphabetic symbol ordering
|
||||
Relocatable symbols
|
||||
|
||||
Definitions
|
||||
At line 208 in file startup_stm32l072xx.s
|
||||
Uses
|
||||
At line 98 in file startup_stm32l072xx.s
|
||||
At line 176 in file startup_stm32l072xx.s
|
||||
|
||||
LPTIM1_IRQHandler 00000012
|
||||
|
||||
Symbol: LPTIM1_IRQHandler
|
||||
Definitions
|
||||
At line 198 in file startup_stm32l072xx.s
|
||||
Uses
|
||||
At line 90 in file startup_stm32l072xx.s
|
||||
At line 166 in file startup_stm32l072xx.s
|
||||
|
||||
NMI_Handler 00000008
|
||||
|
||||
Symbol: NMI_Handler
|
||||
Definitions
|
||||
At line 129 in file startup_stm32l072xx.s
|
||||
Uses
|
||||
At line 61 in file startup_stm32l072xx.s
|
||||
At line 130 in file startup_stm32l072xx.s
|
||||
|
||||
PVD_IRQHandler 00000012
|
||||
|
||||
Symbol: PVD_IRQHandler
|
||||
Definitions
|
||||
At line 186 in file startup_stm32l072xx.s
|
||||
Uses
|
||||
At line 78 in file startup_stm32l072xx.s
|
||||
At line 154 in file startup_stm32l072xx.s
|
||||
|
||||
PendSV_Handler 0000000E
|
||||
|
||||
Symbol: PendSV_Handler
|
||||
Definitions
|
||||
At line 142 in file startup_stm32l072xx.s
|
||||
Uses
|
||||
At line 73 in file startup_stm32l072xx.s
|
||||
At line 143 in file startup_stm32l072xx.s
|
||||
|
||||
RCC_CRS_IRQHandler 00000012
|
||||
|
||||
Symbol: RCC_CRS_IRQHandler
|
||||
Definitions
|
||||
At line 189 in file startup_stm32l072xx.s
|
||||
Uses
|
||||
At line 81 in file startup_stm32l072xx.s
|
||||
At line 157 in file startup_stm32l072xx.s
|
||||
|
||||
RNG_LPUART1_IRQHandler 00000012
|
||||
|
||||
Symbol: RNG_LPUART1_IRQHandler
|
||||
Definitions
|
||||
At line 213 in file startup_stm32l072xx.s
|
||||
Uses
|
||||
At line 106 in file startup_stm32l072xx.s
|
||||
At line 181 in file startup_stm32l072xx.s
|
||||
|
||||
|
||||
|
||||
ARM Macro Assembler Page 4 Alphabetic symbol ordering
|
||||
Relocatable symbols
|
||||
|
||||
|
||||
RTC_IRQHandler 00000012
|
||||
|
||||
Symbol: RTC_IRQHandler
|
||||
Definitions
|
||||
At line 187 in file startup_stm32l072xx.s
|
||||
Uses
|
||||
At line 79 in file startup_stm32l072xx.s
|
||||
At line 155 in file startup_stm32l072xx.s
|
||||
|
||||
Reset_Handler 00000000
|
||||
|
||||
Symbol: Reset_Handler
|
||||
Definitions
|
||||
At line 117 in file startup_stm32l072xx.s
|
||||
Uses
|
||||
At line 60 in file startup_stm32l072xx.s
|
||||
At line 118 in file startup_stm32l072xx.s
|
||||
|
||||
SPI1_IRQHandler 00000012
|
||||
|
||||
Symbol: SPI1_IRQHandler
|
||||
Definitions
|
||||
At line 209 in file startup_stm32l072xx.s
|
||||
Uses
|
||||
At line 102 in file startup_stm32l072xx.s
|
||||
At line 177 in file startup_stm32l072xx.s
|
||||
|
||||
SPI2_IRQHandler 00000012
|
||||
|
||||
Symbol: SPI2_IRQHandler
|
||||
Definitions
|
||||
At line 210 in file startup_stm32l072xx.s
|
||||
Uses
|
||||
At line 103 in file startup_stm32l072xx.s
|
||||
At line 178 in file startup_stm32l072xx.s
|
||||
|
||||
SVC_Handler 0000000C
|
||||
|
||||
Symbol: SVC_Handler
|
||||
Definitions
|
||||
At line 138 in file startup_stm32l072xx.s
|
||||
Uses
|
||||
At line 70 in file startup_stm32l072xx.s
|
||||
At line 139 in file startup_stm32l072xx.s
|
||||
|
||||
SysTick_Handler 00000010
|
||||
|
||||
Symbol: SysTick_Handler
|
||||
Definitions
|
||||
At line 146 in file startup_stm32l072xx.s
|
||||
Uses
|
||||
At line 74 in file startup_stm32l072xx.s
|
||||
At line 147 in file startup_stm32l072xx.s
|
||||
|
||||
TIM21_IRQHandler 00000012
|
||||
|
||||
Symbol: TIM21_IRQHandler
|
||||
Definitions
|
||||
|
||||
|
||||
|
||||
ARM Macro Assembler Page 5 Alphabetic symbol ordering
|
||||
Relocatable symbols
|
||||
|
||||
At line 204 in file startup_stm32l072xx.s
|
||||
Uses
|
||||
At line 97 in file startup_stm32l072xx.s
|
||||
At line 172 in file startup_stm32l072xx.s
|
||||
|
||||
TIM22_IRQHandler 00000012
|
||||
|
||||
Symbol: TIM22_IRQHandler
|
||||
Definitions
|
||||
At line 205 in file startup_stm32l072xx.s
|
||||
Uses
|
||||
At line 99 in file startup_stm32l072xx.s
|
||||
At line 173 in file startup_stm32l072xx.s
|
||||
|
||||
TIM2_IRQHandler 00000012
|
||||
|
||||
Symbol: TIM2_IRQHandler
|
||||
Definitions
|
||||
At line 200 in file startup_stm32l072xx.s
|
||||
Uses
|
||||
At line 92 in file startup_stm32l072xx.s
|
||||
At line 168 in file startup_stm32l072xx.s
|
||||
|
||||
TIM3_IRQHandler 00000012
|
||||
|
||||
Symbol: TIM3_IRQHandler
|
||||
Definitions
|
||||
At line 201 in file startup_stm32l072xx.s
|
||||
Uses
|
||||
At line 93 in file startup_stm32l072xx.s
|
||||
At line 169 in file startup_stm32l072xx.s
|
||||
|
||||
TIM6_DAC_IRQHandler 00000012
|
||||
|
||||
Symbol: TIM6_DAC_IRQHandler
|
||||
Definitions
|
||||
At line 202 in file startup_stm32l072xx.s
|
||||
Uses
|
||||
At line 94 in file startup_stm32l072xx.s
|
||||
At line 170 in file startup_stm32l072xx.s
|
||||
|
||||
TIM7_IRQHandler 00000012
|
||||
|
||||
Symbol: TIM7_IRQHandler
|
||||
Definitions
|
||||
At line 203 in file startup_stm32l072xx.s
|
||||
Uses
|
||||
At line 95 in file startup_stm32l072xx.s
|
||||
At line 171 in file startup_stm32l072xx.s
|
||||
|
||||
TSC_IRQHandler 00000012
|
||||
|
||||
Symbol: TSC_IRQHandler
|
||||
Definitions
|
||||
At line 193 in file startup_stm32l072xx.s
|
||||
Uses
|
||||
At line 85 in file startup_stm32l072xx.s
|
||||
At line 161 in file startup_stm32l072xx.s
|
||||
|
||||
|
||||
|
||||
|
||||
ARM Macro Assembler Page 6 Alphabetic symbol ordering
|
||||
Relocatable symbols
|
||||
|
||||
USART1_IRQHandler 00000012
|
||||
|
||||
Symbol: USART1_IRQHandler
|
||||
Definitions
|
||||
At line 211 in file startup_stm32l072xx.s
|
||||
Uses
|
||||
At line 104 in file startup_stm32l072xx.s
|
||||
At line 179 in file startup_stm32l072xx.s
|
||||
|
||||
USART2_IRQHandler 00000012
|
||||
|
||||
Symbol: USART2_IRQHandler
|
||||
Definitions
|
||||
At line 212 in file startup_stm32l072xx.s
|
||||
Uses
|
||||
At line 105 in file startup_stm32l072xx.s
|
||||
At line 180 in file startup_stm32l072xx.s
|
||||
|
||||
USART4_5_IRQHandler 00000012
|
||||
|
||||
Symbol: USART4_5_IRQHandler
|
||||
Definitions
|
||||
At line 199 in file startup_stm32l072xx.s
|
||||
Uses
|
||||
At line 91 in file startup_stm32l072xx.s
|
||||
At line 167 in file startup_stm32l072xx.s
|
||||
|
||||
USB_IRQHandler 00000012
|
||||
|
||||
Symbol: USB_IRQHandler
|
||||
Definitions
|
||||
At line 214 in file startup_stm32l072xx.s
|
||||
Uses
|
||||
At line 108 in file startup_stm32l072xx.s
|
||||
At line 182 in file startup_stm32l072xx.s
|
||||
|
||||
WWDG_IRQHandler 00000012
|
||||
|
||||
Symbol: WWDG_IRQHandler
|
||||
Definitions
|
||||
At line 185 in file startup_stm32l072xx.s
|
||||
Uses
|
||||
At line 77 in file startup_stm32l072xx.s
|
||||
At line 153 in file startup_stm32l072xx.s
|
||||
|
||||
__user_initial_stackheap 00000014
|
||||
|
||||
Symbol: __user_initial_stackheap
|
||||
Definitions
|
||||
At line 236 in file startup_stm32l072xx.s
|
||||
Uses
|
||||
At line 234 in file startup_stm32l072xx.s
|
||||
Comment: __user_initial_stackheap used once
|
||||
39 symbols
|
||||
|
||||
|
||||
|
||||
ARM Macro Assembler Page 1 Alphabetic symbol ordering
|
||||
Absolute symbols
|
||||
|
||||
Heap_Size 00000400
|
||||
|
||||
Symbol: Heap_Size
|
||||
Definitions
|
||||
At line 42 in file startup_stm32l072xx.s
|
||||
Uses
|
||||
At line 46 in file startup_stm32l072xx.s
|
||||
At line 240 in file startup_stm32l072xx.s
|
||||
|
||||
Stack_Size 00000600
|
||||
|
||||
Symbol: Stack_Size
|
||||
Definitions
|
||||
At line 31 in file startup_stm32l072xx.s
|
||||
Uses
|
||||
At line 34 in file startup_stm32l072xx.s
|
||||
At line 239 in file startup_stm32l072xx.s
|
||||
|
||||
__Vectors_Size 000000C0
|
||||
|
||||
Symbol: __Vectors_Size
|
||||
Definitions
|
||||
At line 112 in file startup_stm32l072xx.s
|
||||
Uses
|
||||
At line 57 in file startup_stm32l072xx.s
|
||||
Comment: __Vectors_Size used once
|
||||
3 symbols
|
||||
|
||||
|
||||
|
||||
ARM Macro Assembler Page 1 Alphabetic symbol ordering
|
||||
External symbols
|
||||
|
||||
SystemInit 00000000
|
||||
|
||||
Symbol: SystemInit
|
||||
Definitions
|
||||
At line 120 in file startup_stm32l072xx.s
|
||||
Uses
|
||||
At line 121 in file startup_stm32l072xx.s
|
||||
Comment: SystemInit used once
|
||||
__main 00000000
|
||||
|
||||
Symbol: __main
|
||||
Definitions
|
||||
At line 119 in file startup_stm32l072xx.s
|
||||
Uses
|
||||
At line 123 in file startup_stm32l072xx.s
|
||||
Comment: __main used once
|
||||
__use_two_region_memory 00000000
|
||||
|
||||
Symbol: __use_two_region_memory
|
||||
Definitions
|
||||
At line 233 in file startup_stm32l072xx.s
|
||||
Uses
|
||||
None
|
||||
Comment: __use_two_region_memory unused
|
||||
3 symbols
|
||||
392 symbols in table
|
|
@ -8,7 +8,7 @@
|
|||
typedef struct
|
||||
{
|
||||
bool is_open;
|
||||
uint32_t calibration_value;
|
||||
float32 calibration_value;
|
||||
uint32_t original_value;
|
||||
} calibration_sensor_data_t;
|
||||
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
|
||||
extern __IO app_t app;
|
||||
extern motor_t *motor;
|
||||
uint8_t detect_result = ST_DEV_NORMAL;
|
||||
|
||||
static struct flow fl_adc_inspection; // ADC
|
||||
static struct flow fl_systom_inspection; // 系统
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include "board.h"
|
||||
#include "motor.h"
|
||||
|
||||
extern uint8_t detect_result;
|
||||
void motor_process(frame_msg_t *rx, frame_msg_t *bk);
|
||||
void sensor_process(frame_msg_t *rx, frame_msg_t *bk);
|
||||
void error_process(uint8_t err, frame_msg_t *rx, frame_msg_t *bk);
|
||||
|
@ -126,6 +127,7 @@ void host_rx_msg_deal(void)
|
|||
osel_memset((uint8_t *)&rx_msg, 0, sizeof(frame_msg_t));
|
||||
osel_memset((uint8_t *)&bk_msg, 0, sizeof(frame_msg_t));
|
||||
execute_state = IDLE;
|
||||
detect_result = ST_DEV_NORMAL;
|
||||
}
|
||||
|
||||
// 串口接收回调
|
||||
|
@ -162,8 +164,6 @@ static void host_uart_init(void)
|
|||
motor_t *motor;
|
||||
motor_ctrl_t *motor_param = NULL;
|
||||
|
||||
extern uint8_t detect_result;
|
||||
|
||||
// 电机初始化
|
||||
static void motor_init(void)
|
||||
{
|
||||
|
@ -213,6 +213,22 @@ static uint8_t motor_ctrl(uint8_t sw, motor_ctrl_t *param)
|
|||
return state;
|
||||
}
|
||||
|
||||
static void motor_state(frame_msg_t *rx, frame_msg_t *bk)
|
||||
{
|
||||
DBG_ASSERT(bk != NULL __DBG_LINE);
|
||||
|
||||
step_motor_t *step_motor = &motor->handle.step_motor;
|
||||
uint8_t state = ST_DEV_NORMAL;
|
||||
|
||||
// 回复数据
|
||||
bk->head = PACKET_STX;
|
||||
bk->state = state;
|
||||
bk->dev_no = rx->dev_no;
|
||||
bk->cmd_no = rx->cmd_no;
|
||||
bk->len = sizeof(uint8_t);
|
||||
bk->data[0] = step_motor->attribute.state;
|
||||
}
|
||||
|
||||
void motor_process_init(void)
|
||||
{
|
||||
motor_param = (motor_ctrl_t *)osel_mem_alloc(sizeof(motor_ctrl_t));
|
||||
|
@ -256,6 +272,9 @@ void motor_process(frame_msg_t *rx, frame_msg_t *bk)
|
|||
bk->state = state;
|
||||
break;
|
||||
}
|
||||
case MOTOR_STATE:
|
||||
motor_state(rx, bk);
|
||||
break;
|
||||
default:
|
||||
error_process(ST_CMD_IVALID, rx, bk);
|
||||
break;
|
||||
|
@ -263,6 +282,7 @@ void motor_process(frame_msg_t *rx, frame_msg_t *bk)
|
|||
}
|
||||
|
||||
/************************************* ADc传感器 *************************************/
|
||||
uint8_t detect_result = ST_DEV_NORMAL; // 数据转换结果
|
||||
uint16_t sensor_adc[GET_ALL_VALUE] = {0};
|
||||
|
||||
// AD传感器
|
||||
|
@ -304,6 +324,10 @@ float32 torsion_detect(void)
|
|||
|
||||
adc = get_sensor_adc(GET_TORSION_VALUE);
|
||||
val = adc / 4096 * 3000;
|
||||
if (val < 914 || val > 2086)
|
||||
{
|
||||
detect_result = ST_DEV_MISS;
|
||||
}
|
||||
val = (val - 1500) / 101 / (1.934 * 3) * 10;
|
||||
|
||||
return val;
|
||||
|
@ -315,6 +339,10 @@ float32 pressure_detect(uint8_t id)
|
|||
|
||||
adc = get_sensor_adc(id);
|
||||
val = adc / 4096 * 3000;
|
||||
if (val < 600 || val > 3000)
|
||||
{
|
||||
detect_result = ST_DEV_MISS;
|
||||
}
|
||||
val = (val - 600) / (10 * 15) / 16 * 1000;
|
||||
|
||||
return val;
|
||||
|
@ -326,6 +354,10 @@ float32 flow_detect(uint8_t id)
|
|||
|
||||
adc = get_sensor_adc(id);
|
||||
val = adc / 4096 * 3000;
|
||||
if (val < 600 || val > 3000)
|
||||
{
|
||||
detect_result = ST_DEV_MISS;
|
||||
}
|
||||
val = (val - 600) / (10 * 15) / 16 * 300;
|
||||
|
||||
return val;
|
||||
|
@ -405,7 +437,7 @@ static uint8_t test_motor_cmd(uint8_t cmd, uint8_t *buf)
|
|||
motor_ctrl_t motor_param;
|
||||
msg.head = PACKET_STX;
|
||||
msg.state = ST_DEV_NORMAL;
|
||||
msg.dev_no = ADC_SENSOR;
|
||||
msg.dev_no = MOTOR;
|
||||
msg.cmd_no = cmd;
|
||||
switch (cmd)
|
||||
{
|
||||
|
@ -422,7 +454,8 @@ static uint8_t test_motor_cmd(uint8_t cmd, uint8_t *buf)
|
|||
if (cmd == MOTOR_MOVE)
|
||||
{
|
||||
motor_param.dir = DIR_CW;
|
||||
motor_param.angle = 1.2;
|
||||
motor_param.angle = 90;
|
||||
motor_param.angle = S2B_FLOAT32(motor_param.angle);
|
||||
}
|
||||
osel_memcpy((uint8_t *)&buf[index], (uint8_t *)&motor_param, sizeof(motor_ctrl_t));
|
||||
index += sizeof(motor_ctrl_t);
|
||||
|
|
|
@ -63,6 +63,7 @@ typedef enum
|
|||
SET_MOTOR_SPEED, // 设置电机速度
|
||||
MOTOR_MOVE, // 电机启动(参数1:方向,参数2:角度)
|
||||
MOTOR_STOP, // 电机停止
|
||||
MOTOR_STATE, // 电机状态
|
||||
} motor_cmd_e;
|
||||
|
||||
// 传感器命令号
|
||||
|
@ -94,6 +95,8 @@ typedef enum
|
|||
TEST_DEV_MAX,
|
||||
} test_dev_e;
|
||||
|
||||
#pragma pack(1)
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint8_t head; // 包头
|
||||
|
@ -116,6 +119,8 @@ typedef struct
|
|||
uint8_t cmd_id;
|
||||
} test_t;
|
||||
|
||||
#pragma pack()
|
||||
|
||||
extern uint16_t sensor_adc[GET_ALL_VALUE];
|
||||
|
||||
extern void board_init(void);
|
||||
|
|
|
@ -21,6 +21,7 @@ static void step_motor_run(motor_t *motor, dir_e dir)
|
|||
handle->attribute.en = TRUE;
|
||||
dir == DIR_CCW ? handle->gpios.dir->set(*handle->gpios.dir) : handle->gpios.dir->reset(*handle->gpios.dir);
|
||||
PWM_START(handle->pwm_timer, handle->pwm_channel);
|
||||
handle->attribute.state = TRUE;
|
||||
}
|
||||
|
||||
static void step_motor_stop(motor_t *motor)
|
||||
|
@ -32,6 +33,7 @@ static void step_motor_stop(motor_t *motor)
|
|||
handle->attribute.angle = 0;
|
||||
handle->attribute.pulse_count = 0;
|
||||
PWM_STOP(handle->pwm_timer, handle->pwm_channel);
|
||||
handle->attribute.state = FALSE;
|
||||
if (handle->interface.stop_cb != NULL)
|
||||
{
|
||||
handle->interface.stop_cb(motor);
|
||||
|
@ -62,7 +64,6 @@ static void step_motor_set_angle(motor_t *motor, float32 angle, dir_e dir)
|
|||
|
||||
static void step_motor_set_speed(motor_t *motor, uint32_t psc)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -15,8 +15,8 @@ typedef struct MOTOR motor_t;
|
|||
|
||||
typedef enum
|
||||
{
|
||||
DIR_CW = 0, /* 顺时针旋转 */
|
||||
DIR_CCW, /* 逆时针旋转 */
|
||||
DIR_CW = 0, /* 逆时针旋转 */
|
||||
DIR_CCW, /* 顺时针旋转 */
|
||||
} dir_e;
|
||||
typedef enum
|
||||
{
|
||||
|
@ -51,6 +51,7 @@ typedef struct
|
|||
__IO uint32_t pulse_count; /* 脉冲个数记录 */
|
||||
__IO int add_pulse_count; /* 脉冲个数累计 */
|
||||
__IO uint32_t step_angle; /* 步距 */
|
||||
uint8_t state; // 运动状态
|
||||
} step_motor_attribute_t;
|
||||
|
||||
typedef struct
|
||||
|
|
|
@ -65,24 +65,24 @@
|
|||
|
||||
typedef enum
|
||||
{
|
||||
IN0 = 0,
|
||||
IN1,
|
||||
// IN2,
|
||||
// IN3,
|
||||
// IN4,
|
||||
// IN5,
|
||||
IN6,
|
||||
// IN0 = 0,
|
||||
// IN1,
|
||||
// IN2,
|
||||
// IN3,
|
||||
// IN4,
|
||||
// IN5,
|
||||
// IN6,
|
||||
IN7,
|
||||
IN8,
|
||||
IN9,
|
||||
IN10,
|
||||
IN11,
|
||||
IN12,
|
||||
// IN11,
|
||||
// IN12,
|
||||
IN13,
|
||||
// IN14,
|
||||
// IN15,
|
||||
INVREF,
|
||||
INTEMP,
|
||||
// INVREF,
|
||||
// INTEMP,
|
||||
INMAX,
|
||||
} adc_num_t; // ADC通道号,根据cubemax配置的通道数量而定
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
{ \
|
||||
LL_TIM_EnableCounter(TIMx); \
|
||||
LL_TIM_CC_EnableChannel(TIMx, CHx); \
|
||||
LL_TIM_EnableIT_UPDATE(TIMx); \
|
||||
} while (__LINE__ == -1)
|
||||
|
||||
// 停止PWM输出
|
||||
|
@ -16,6 +17,7 @@
|
|||
{ \
|
||||
LL_TIM_DisableCounter(TIMx); \
|
||||
LL_TIM_CC_DisableChannel(TIMx, CHx); \
|
||||
LL_TIM_ClearFlag_UPDATE(TIMx); \
|
||||
} while (__LINE__ == -1)
|
||||
|
||||
// 修改比较值,修改占空比
|
||||
|
|
30
motor.ioc
30
motor.ioc
|
@ -57,20 +57,22 @@ Mcu.Name=STM32L072R(B-Z)Tx
|
|||
Mcu.Package=LQFP64
|
||||
Mcu.Pin0=PH0-OSC_IN
|
||||
Mcu.Pin1=PH1-OSC_OUT
|
||||
Mcu.Pin10=PA10
|
||||
Mcu.Pin11=PA13
|
||||
Mcu.Pin12=PA14
|
||||
Mcu.Pin13=VP_SYS_VS_Systick
|
||||
Mcu.Pin14=VP_TIM6_VS_ClockSourceINT
|
||||
Mcu.Pin10=PB15
|
||||
Mcu.Pin11=PA9
|
||||
Mcu.Pin12=PA10
|
||||
Mcu.Pin13=PA13
|
||||
Mcu.Pin14=PA14
|
||||
Mcu.Pin15=VP_SYS_VS_Systick
|
||||
Mcu.Pin16=VP_TIM6_VS_ClockSourceINT
|
||||
Mcu.Pin2=PC0
|
||||
Mcu.Pin3=PC3
|
||||
Mcu.Pin4=PB0
|
||||
Mcu.Pin5=PB12
|
||||
Mcu.Pin6=PB13
|
||||
Mcu.Pin7=PB14
|
||||
Mcu.Pin8=PB15
|
||||
Mcu.Pin9=PA9
|
||||
Mcu.PinsNb=15
|
||||
Mcu.Pin4=PA7
|
||||
Mcu.Pin5=PB0
|
||||
Mcu.Pin6=PB1
|
||||
Mcu.Pin7=PB12
|
||||
Mcu.Pin8=PB13
|
||||
Mcu.Pin9=PB14
|
||||
Mcu.PinsNb=17
|
||||
Mcu.ThirdPartyNb=0
|
||||
Mcu.UserConstants=
|
||||
Mcu.UserName=STM32L072RBTx
|
||||
|
@ -93,10 +95,14 @@ PA13.Mode=Serial_Wire
|
|||
PA13.Signal=SYS_SWDIO
|
||||
PA14.Mode=Serial_Wire
|
||||
PA14.Signal=SYS_SWCLK
|
||||
PA7.Mode=IN7
|
||||
PA7.Signal=ADC_IN7
|
||||
PA9.Mode=Asynchronous
|
||||
PA9.Signal=USART1_TX
|
||||
PB0.Mode=IN8
|
||||
PB0.Signal=ADC_IN8
|
||||
PB1.Mode=IN9
|
||||
PB1.Signal=ADC_IN9
|
||||
PB12.GPIOParameters=GPIO_Speed,PinState,GPIO_Label
|
||||
PB12.GPIO_Label=ENA
|
||||
PB12.GPIO_Speed=GPIO_SPEED_FREQ_HIGH
|
||||
|
|
Reference in New Issue