ARM GAS /tmp/ccmNZWYr.s page 1 1 .cpu cortex-m4 2 .arch armv7e-m 3 .fpu fpv4-sp-d16 4 .eabi_attribute 27, 1 5 .eabi_attribute 28, 1 6 .eabi_attribute 20, 1 7 .eabi_attribute 21, 1 8 .eabi_attribute 23, 3 9 .eabi_attribute 24, 1 10 .eabi_attribute 25, 1 11 .eabi_attribute 26, 1 12 .eabi_attribute 30, 1 13 .eabi_attribute 34, 1 14 .eabi_attribute 18, 4 15 .file "AMS_HighLevel.c" 16 .text 17 .Ltext0: 18 .cfi_sections .debug_frame 19 .file 1 "Core/Src/AMS_HighLevel.c" 20 .section .text.AMS_Init,"ax",%progbits 21 .align 1 22 .global AMS_Init 23 .syntax unified 24 .thumb 25 .thumb_func 27 AMS_Init: 28 .LVL0: 29 .LFB130: 1:Core/Src/AMS_HighLevel.c **** /* 2:Core/Src/AMS_HighLevel.c **** * AMS_HighLevel.c 3:Core/Src/AMS_HighLevel.c **** * 4:Core/Src/AMS_HighLevel.c **** * Created on: 20.07.2022 5:Core/Src/AMS_HighLevel.c **** * Author: max 6:Core/Src/AMS_HighLevel.c **** */ 7:Core/Src/AMS_HighLevel.c **** 8:Core/Src/AMS_HighLevel.c **** 9:Core/Src/AMS_HighLevel.c **** #include "AMS_HighLevel.h" 10:Core/Src/AMS_HighLevel.c **** 11:Core/Src/AMS_HighLevel.c **** Cell_Module module; 12:Core/Src/AMS_HighLevel.c **** uint32_t balancedCells = 0; 13:Core/Src/AMS_HighLevel.c **** uint8_t BalancingActive = 0; 14:Core/Src/AMS_HighLevel.c **** uint8_t stateofcharge = 100; 15:Core/Src/AMS_HighLevel.c **** int64_t currentintegrator = 0; 16:Core/Src/AMS_HighLevel.c **** uint32_t lastticks = 0; 17:Core/Src/AMS_HighLevel.c **** uint32_t currenttick = 0; 18:Core/Src/AMS_HighLevel.c **** uint8_t eepromconfigured = 0; 19:Core/Src/AMS_HighLevel.c **** 20:Core/Src/AMS_HighLevel.c **** uint8_t internalbalancingalgo = 1; 21:Core/Src/AMS_HighLevel.c **** uint16_t startbalancingthreshold = 41000; 22:Core/Src/AMS_HighLevel.c **** uint16_t stopbalancingthreshold = 30000; 23:Core/Src/AMS_HighLevel.c **** uint16_t balancingvoltagedelta = 10; 24:Core/Src/AMS_HighLevel.c **** 25:Core/Src/AMS_HighLevel.c **** 26:Core/Src/AMS_HighLevel.c **** uint16_t amsuv = 0; 27:Core/Src/AMS_HighLevel.c **** uint16_t amsov = 0; 28:Core/Src/AMS_HighLevel.c **** 29:Core/Src/AMS_HighLevel.c **** uint8_t amserrorcode = 0; ARM GAS /tmp/ccmNZWYr.s page 2 30:Core/Src/AMS_HighLevel.c **** uint8_t amswarningcode = 0; 31:Core/Src/AMS_HighLevel.c **** 32:Core/Src/AMS_HighLevel.c **** uint8_t numberofCells = 17; 33:Core/Src/AMS_HighLevel.c **** uint8_t numberofAux = 0; 34:Core/Src/AMS_HighLevel.c **** 35:Core/Src/AMS_HighLevel.c **** 36:Core/Src/AMS_HighLevel.c **** amsState currentAMSState = AMSDEACTIVE; 37:Core/Src/AMS_HighLevel.c **** amsState lastAMSState = AMSDEACTIVE; 38:Core/Src/AMS_HighLevel.c **** 39:Core/Src/AMS_HighLevel.c **** void AMS_Init(SPI_HandleTypeDef *hspi) 40:Core/Src/AMS_HighLevel.c **** { 30 .loc 1 40 1 view -0 31 .cfi_startproc 32 @ args = 0, pretend = 0, frame = 0 33 @ frame_needed = 0, uses_anonymous_args = 0 34 .loc 1 40 1 is_stmt 0 view .LVU1 35 0000 08B5 push {r3, lr} 36 .cfi_def_cfa_offset 8 37 .cfi_offset 3, -8 38 .cfi_offset 14, -4 41:Core/Src/AMS_HighLevel.c **** if(eepromconfigured == 1) 39 .loc 1 41 2 is_stmt 1 view .LVU2 40 .loc 1 41 22 is_stmt 0 view .LVU3 41 0002 0F4B ldr r3, .L6 42 0004 1B78 ldrb r3, [r3] @ zero_extendqisi2 43 .loc 1 41 4 view .LVU4 44 0006 012B cmp r3, #1 45 0008 11D0 beq .L5 42:Core/Src/AMS_HighLevel.c **** { 43:Core/Src/AMS_HighLevel.c **** /*amsov = eepromcellovervoltage>>4; 44:Core/Src/AMS_HighLevel.c **** amsuv = (eepromcellundervoltage-1)>>4; 45:Core/Src/AMS_HighLevel.c **** numberofCells = eepromnumofcells; 46:Core/Src/AMS_HighLevel.c **** numberofAux = eepromnumofaux; 47:Core/Src/AMS_HighLevel.c **** initAMS(hspi, eepromnumofcells, eepromnumofaux);*/ 48:Core/Src/AMS_HighLevel.c **** amsConfigOverVoltage(amsov); 49:Core/Src/AMS_HighLevel.c **** amsConfigUnderVoltage(amsuv); 50:Core/Src/AMS_HighLevel.c **** } 51:Core/Src/AMS_HighLevel.c **** else 52:Core/Src/AMS_HighLevel.c **** { 53:Core/Src/AMS_HighLevel.c **** initAMS(hspi, numberofCells, numberofAux); 46 .loc 1 53 3 is_stmt 1 view .LVU5 47 000a 0E4B ldr r3, .L6+4 48 000c 1A78 ldrb r2, [r3] @ zero_extendqisi2 49 000e 0E4B ldr r3, .L6+8 50 0010 1978 ldrb r1, [r3] @ zero_extendqisi2 51 0012 FFF7FEFF bl initAMS 52 .LVL1: 54:Core/Src/AMS_HighLevel.c **** amsov = DEFAULT_OV; 53 .loc 1 54 3 view .LVU6 54 .loc 1 54 9 is_stmt 0 view .LVU7 55 0016 0D4B ldr r3, .L6+12 56 0018 40F64122 movw r2, #2625 57 001c 1A80 strh r2, [r3] @ movhi 55:Core/Src/AMS_HighLevel.c **** amsuv = DEFAULT_UV; 58 .loc 1 55 3 is_stmt 1 view .LVU8 59 .loc 1 55 9 is_stmt 0 view .LVU9 60 001e 0C4B ldr r3, .L6+16 ARM GAS /tmp/ccmNZWYr.s page 3 61 0020 40F21A62 movw r2, #1562 62 0024 1A80 strh r2, [r3] @ movhi 63 .L3: 56:Core/Src/AMS_HighLevel.c **** } 57:Core/Src/AMS_HighLevel.c **** 58:Core/Src/AMS_HighLevel.c **** 59:Core/Src/AMS_HighLevel.c **** currentAMSState = AMSIDLE; 64 .loc 1 59 2 is_stmt 1 view .LVU10 65 .loc 1 59 18 is_stmt 0 view .LVU11 66 0026 0B4B ldr r3, .L6+20 67 0028 0122 movs r2, #1 68 002a 1A70 strb r2, [r3] 60:Core/Src/AMS_HighLevel.c **** 61:Core/Src/AMS_HighLevel.c **** 62:Core/Src/AMS_HighLevel.c **** } 69 .loc 1 62 1 view .LVU12 70 002c 08BD pop {r3, pc} 71 .LVL2: 72 .L5: 48:Core/Src/AMS_HighLevel.c **** amsConfigUnderVoltage(amsuv); 73 .loc 1 48 3 is_stmt 1 view .LVU13 74 002e 074B ldr r3, .L6+12 75 0030 1888 ldrh r0, [r3] 76 .LVL3: 48:Core/Src/AMS_HighLevel.c **** amsConfigUnderVoltage(amsuv); 77 .loc 1 48 3 is_stmt 0 view .LVU14 78 0032 FFF7FEFF bl amsConfigOverVoltage 79 .LVL4: 49:Core/Src/AMS_HighLevel.c **** } 80 .loc 1 49 3 is_stmt 1 view .LVU15 81 0036 064B ldr r3, .L6+16 82 0038 1888 ldrh r0, [r3] 83 003a FFF7FEFF bl amsConfigUnderVoltage 84 .LVL5: 85 003e F2E7 b .L3 86 .L7: 87 .align 2 88 .L6: 89 0040 00000000 .word eepromconfigured 90 0044 00000000 .word numberofAux 91 0048 00000000 .word numberofCells 92 004c 00000000 .word amsov 93 0050 00000000 .word amsuv 94 0054 00000000 .word currentAMSState 95 .cfi_endproc 96 .LFE130: 98 .section .text.AMS_Warning_Loop,"ax",%progbits 99 .align 1 100 .global AMS_Warning_Loop 101 .syntax unified 102 .thumb 103 .thumb_func 105 AMS_Warning_Loop: 106 .LFB133: 63:Core/Src/AMS_HighLevel.c **** 64:Core/Src/AMS_HighLevel.c **** void AMS_Loop() 65:Core/Src/AMS_HighLevel.c **** { ARM GAS /tmp/ccmNZWYr.s page 4 66:Core/Src/AMS_HighLevel.c **** 67:Core/Src/AMS_HighLevel.c **** //On Transition Functions called ones if the State Changed 68:Core/Src/AMS_HighLevel.c **** 69:Core/Src/AMS_HighLevel.c **** if(currentAMSState != lastAMSState) 70:Core/Src/AMS_HighLevel.c **** { 71:Core/Src/AMS_HighLevel.c **** switch(currentAMSState) 72:Core/Src/AMS_HighLevel.c **** { 73:Core/Src/AMS_HighLevel.c **** case AMSIDLE: 74:Core/Src/AMS_HighLevel.c **** break; 75:Core/Src/AMS_HighLevel.c **** case AMSDEACTIVE: 76:Core/Src/AMS_HighLevel.c **** break; 77:Core/Src/AMS_HighLevel.c **** case AMSCHARGING: 78:Core/Src/AMS_HighLevel.c **** break; 79:Core/Src/AMS_HighLevel.c **** case AMSIDLEBALANCING: 80:Core/Src/AMS_HighLevel.c **** break; 81:Core/Src/AMS_HighLevel.c **** case AMSDISCHARGING: 82:Core/Src/AMS_HighLevel.c **** break; 83:Core/Src/AMS_HighLevel.c **** case AMSWARNING: 84:Core/Src/AMS_HighLevel.c **** writeWarningLog(0x01); 85:Core/Src/AMS_HighLevel.c **** break; 86:Core/Src/AMS_HighLevel.c **** case AMSERROR: 87:Core/Src/AMS_HighLevel.c **** writeErrorLog(amserrorcode); 88:Core/Src/AMS_HighLevel.c **** break; 89:Core/Src/AMS_HighLevel.c **** } 90:Core/Src/AMS_HighLevel.c **** lastAMSState = currentAMSState; 91:Core/Src/AMS_HighLevel.c **** } 92:Core/Src/AMS_HighLevel.c **** 93:Core/Src/AMS_HighLevel.c **** //Main Loops for different AMS States 94:Core/Src/AMS_HighLevel.c **** 95:Core/Src/AMS_HighLevel.c **** switch(currentAMSState) 96:Core/Src/AMS_HighLevel.c **** { 97:Core/Src/AMS_HighLevel.c **** case AMSIDLE: 98:Core/Src/AMS_HighLevel.c **** AMS_Idle_Loop(); 99:Core/Src/AMS_HighLevel.c **** break; 100:Core/Src/AMS_HighLevel.c **** case AMSDEACTIVE: 101:Core/Src/AMS_HighLevel.c **** break; 102:Core/Src/AMS_HighLevel.c **** case AMSCHARGING: 103:Core/Src/AMS_HighLevel.c **** break; 104:Core/Src/AMS_HighLevel.c **** case AMSIDLEBALANCING: 105:Core/Src/AMS_HighLevel.c **** AMS_Idle_Loop(); 106:Core/Src/AMS_HighLevel.c **** break; 107:Core/Src/AMS_HighLevel.c **** case AMSDISCHARGING: 108:Core/Src/AMS_HighLevel.c **** break; 109:Core/Src/AMS_HighLevel.c **** case AMSWARNING: 110:Core/Src/AMS_HighLevel.c **** AMS_Warning_Loop(); 111:Core/Src/AMS_HighLevel.c **** break; 112:Core/Src/AMS_HighLevel.c **** case AMSERROR: 113:Core/Src/AMS_HighLevel.c **** break; 114:Core/Src/AMS_HighLevel.c **** } 115:Core/Src/AMS_HighLevel.c **** } 116:Core/Src/AMS_HighLevel.c **** 117:Core/Src/AMS_HighLevel.c **** uint8_t AMS_Idle_Loop() 118:Core/Src/AMS_HighLevel.c **** { 119:Core/Src/AMS_HighLevel.c **** amsWakeUp(); 120:Core/Src/AMS_HighLevel.c **** amsConfigOverVoltage(amsov); 121:Core/Src/AMS_HighLevel.c **** amsConfigUnderVoltage(amsuv); 122:Core/Src/AMS_HighLevel.c **** amsConfigAuxMeasurement(0xFFFF); ARM GAS /tmp/ccmNZWYr.s page 5 123:Core/Src/AMS_HighLevel.c **** amsClearAux(); 124:Core/Src/AMS_HighLevel.c **** amsCellMeasurement(&module); 125:Core/Src/AMS_HighLevel.c **** amsInternalStatusMeasurement(&module); 126:Core/Src/AMS_HighLevel.c **** amsAuxMeasurement(&module); 127:Core/Src/AMS_HighLevel.c **** amsCheckUnderOverVoltage(&module); 128:Core/Src/AMS_HighLevel.c **** integrateCurrent(); 129:Core/Src/AMS_HighLevel.c **** 130:Core/Src/AMS_HighLevel.c **** static uint32_t channelstobalance = 1; 131:Core/Src/AMS_HighLevel.c **** 132:Core/Src/AMS_HighLevel.c **** channelstobalance = 0x1FFFF; 133:Core/Src/AMS_HighLevel.c **** /* if(channelstobalance & 0x20000){ 134:Core/Src/AMS_HighLevel.c **** channelstobalance = 1; 135:Core/Src/AMS_HighLevel.c **** }*/ 136:Core/Src/AMS_HighLevel.c **** 137:Core/Src/AMS_HighLevel.c **** amsConfigBalancing(channelstobalance); 138:Core/Src/AMS_HighLevel.c **** amsStartBalancing(100); 139:Core/Src/AMS_HighLevel.c **** 140:Core/Src/AMS_HighLevel.c **** if((module.overVoltage | module.underVoltage)) 141:Core/Src/AMS_HighLevel.c **** { 142:Core/Src/AMS_HighLevel.c **** //amsSendWarning(); 143:Core/Src/AMS_HighLevel.c **** // currentAMSState = AMSWARNING; 144:Core/Src/AMS_HighLevel.c **** } 145:Core/Src/AMS_HighLevel.c **** 146:Core/Src/AMS_HighLevel.c **** // AMS_Balancing_Loop(); 147:Core/Src/AMS_HighLevel.c **** 148:Core/Src/AMS_HighLevel.c **** /* if(BalancingActive) 149:Core/Src/AMS_HighLevel.c **** { 150:Core/Src/AMS_HighLevel.c **** amsStartBalancing(100); 151:Core/Src/AMS_HighLevel.c **** } 152:Core/Src/AMS_HighLevel.c **** else 153:Core/Src/AMS_HighLevel.c **** { 154:Core/Src/AMS_HighLevel.c **** amsStopBalancing(); 155:Core/Src/AMS_HighLevel.c **** }*/ 156:Core/Src/AMS_HighLevel.c **** //amsConfigBalancing(balancedCells); 157:Core/Src/AMS_HighLevel.c **** //volatile amscheck = amscheckOpenCellWire(&module); 158:Core/Src/AMS_HighLevel.c **** return 0; 159:Core/Src/AMS_HighLevel.c **** } 160:Core/Src/AMS_HighLevel.c **** 161:Core/Src/AMS_HighLevel.c **** uint8_t AMS_Warning_Loop() 162:Core/Src/AMS_HighLevel.c **** { 107 .loc 1 162 1 view -0 108 .cfi_startproc 109 @ args = 0, pretend = 0, frame = 0 110 @ frame_needed = 0, uses_anonymous_args = 0 111 0000 10B5 push {r4, lr} 112 .cfi_def_cfa_offset 8 113 .cfi_offset 4, -8 114 .cfi_offset 14, -4 163:Core/Src/AMS_HighLevel.c **** 164:Core/Src/AMS_HighLevel.c **** amsWakeUp(); 115 .loc 1 164 4 view .LVU17 116 0002 FFF7FEFF bl amsWakeUp 117 .LVL6: 165:Core/Src/AMS_HighLevel.c **** amsConfigOverVoltage(amsov); 118 .loc 1 165 4 view .LVU18 119 0006 144B ldr r3, .L12 120 0008 1888 ldrh r0, [r3] ARM GAS /tmp/ccmNZWYr.s page 6 121 000a FFF7FEFF bl amsConfigOverVoltage 122 .LVL7: 166:Core/Src/AMS_HighLevel.c **** amsConfigUnderVoltage(amsuv); 123 .loc 1 166 4 view .LVU19 124 000e 134B ldr r3, .L12+4 125 0010 1888 ldrh r0, [r3] 126 0012 FFF7FEFF bl amsConfigUnderVoltage 127 .LVL8: 167:Core/Src/AMS_HighLevel.c **** amsConfigAuxMeasurement(0xFFFF); 128 .loc 1 167 4 view .LVU20 129 0016 4FF6FF70 movw r0, #65535 130 001a FFF7FEFF bl amsConfigAuxMeasurement 131 .LVL9: 168:Core/Src/AMS_HighLevel.c **** amsClearAux(); 132 .loc 1 168 4 view .LVU21 133 001e FFF7FEFF bl amsClearAux 134 .LVL10: 169:Core/Src/AMS_HighLevel.c **** amsCellMeasurement(&module); 135 .loc 1 169 4 view .LVU22 136 0022 0F4C ldr r4, .L12+8 137 0024 2046 mov r0, r4 138 0026 FFF7FEFF bl amsCellMeasurement 139 .LVL11: 170:Core/Src/AMS_HighLevel.c **** amsInternalStatusMeasurement(&module); 140 .loc 1 170 4 view .LVU23 141 002a 2046 mov r0, r4 142 002c FFF7FEFF bl amsInternalStatusMeasurement 143 .LVL12: 171:Core/Src/AMS_HighLevel.c **** amsAuxMeasurement(&module); 144 .loc 1 171 4 view .LVU24 145 0030 2046 mov r0, r4 146 0032 FFF7FEFF bl amsAuxMeasurement 147 .LVL13: 172:Core/Src/AMS_HighLevel.c **** amsCheckUnderOverVoltage(&module); 148 .loc 1 172 4 view .LVU25 149 0036 2046 mov r0, r4 150 0038 FFF7FEFF bl amsCheckUnderOverVoltage 151 .LVL14: 173:Core/Src/AMS_HighLevel.c **** 174:Core/Src/AMS_HighLevel.c **** if(!(module.overVoltage | module.underVoltage)) 152 .loc 1 174 4 view .LVU26 153 .loc 1 174 15 is_stmt 0 view .LVU27 154 003c A36D ldr r3, [r4, #88] 155 .loc 1 174 36 view .LVU28 156 003e E26D ldr r2, [r4, #92] 157 .loc 1 174 6 view .LVU29 158 0040 1343 orrs r3, r3, r2 159 0042 03D0 beq .L11 160 .L9: 175:Core/Src/AMS_HighLevel.c **** { 176:Core/Src/AMS_HighLevel.c **** currentAMSState = AMSIDLE; 177:Core/Src/AMS_HighLevel.c **** amsClearWarning(); 178:Core/Src/AMS_HighLevel.c **** } 179:Core/Src/AMS_HighLevel.c **** amsStopBalancing(); 161 .loc 1 179 4 is_stmt 1 view .LVU30 162 0044 FFF7FEFF bl amsStopBalancing 163 .LVL15: ARM GAS /tmp/ccmNZWYr.s page 7 180:Core/Src/AMS_HighLevel.c **** 181:Core/Src/AMS_HighLevel.c **** return 0; 164 .loc 1 181 2 view .LVU31 182:Core/Src/AMS_HighLevel.c **** } 165 .loc 1 182 1 is_stmt 0 view .LVU32 166 0048 0020 movs r0, #0 167 004a 10BD pop {r4, pc} 168 .L11: 176:Core/Src/AMS_HighLevel.c **** amsClearWarning(); 169 .loc 1 176 5 is_stmt 1 view .LVU33 176:Core/Src/AMS_HighLevel.c **** amsClearWarning(); 170 .loc 1 176 21 is_stmt 0 view .LVU34 171 004c 054B ldr r3, .L12+12 172 004e 0122 movs r2, #1 173 0050 1A70 strb r2, [r3] 177:Core/Src/AMS_HighLevel.c **** } 174 .loc 1 177 5 is_stmt 1 view .LVU35 175 0052 FFF7FEFF bl amsClearWarning 176 .LVL16: 177 0056 F5E7 b .L9 178 .L13: 179 .align 2 180 .L12: 181 0058 00000000 .word amsov 182 005c 00000000 .word amsuv 183 0060 00000000 .word module 184 0064 00000000 .word currentAMSState 185 .cfi_endproc 186 .LFE133: 188 .section .text.AMS_Error_Loop,"ax",%progbits 189 .align 1 190 .global AMS_Error_Loop 191 .syntax unified 192 .thumb 193 .thumb_func 195 AMS_Error_Loop: 196 .LFB134: 183:Core/Src/AMS_HighLevel.c **** 184:Core/Src/AMS_HighLevel.c **** uint8_t AMS_Error_Loop() 185:Core/Src/AMS_HighLevel.c **** { 197 .loc 1 185 1 view -0 198 .cfi_startproc 199 @ args = 0, pretend = 0, frame = 0 200 @ frame_needed = 0, uses_anonymous_args = 0 201 @ link register save eliminated. 186:Core/Src/AMS_HighLevel.c **** return 0; 202 .loc 1 186 2 view .LVU37 187:Core/Src/AMS_HighLevel.c **** } 203 .loc 1 187 1 is_stmt 0 view .LVU38 204 0000 0020 movs r0, #0 205 0002 7047 bx lr 206 .cfi_endproc 207 .LFE134: 209 .section .text.AMS_Charging_Loop,"ax",%progbits 210 .align 1 211 .global AMS_Charging_Loop 212 .syntax unified ARM GAS /tmp/ccmNZWYr.s page 8 213 .thumb 214 .thumb_func 216 AMS_Charging_Loop: 217 .LFB135: 188:Core/Src/AMS_HighLevel.c **** 189:Core/Src/AMS_HighLevel.c **** uint8_t AMS_Charging_Loop() 190:Core/Src/AMS_HighLevel.c **** { 218 .loc 1 190 1 is_stmt 1 view -0 219 .cfi_startproc 220 @ args = 0, pretend = 0, frame = 0 221 @ frame_needed = 0, uses_anonymous_args = 0 222 @ link register save eliminated. 191:Core/Src/AMS_HighLevel.c **** return 0; 223 .loc 1 191 2 view .LVU40 192:Core/Src/AMS_HighLevel.c **** } 224 .loc 1 192 1 is_stmt 0 view .LVU41 225 0000 0020 movs r0, #0 226 0002 7047 bx lr 227 .cfi_endproc 228 .LFE135: 230 .section .text.AMS_Discharging_Loop,"ax",%progbits 231 .align 1 232 .global AMS_Discharging_Loop 233 .syntax unified 234 .thumb 235 .thumb_func 237 AMS_Discharging_Loop: 238 .LFB136: 193:Core/Src/AMS_HighLevel.c **** 194:Core/Src/AMS_HighLevel.c **** uint8_t AMS_Discharging_Loop() 195:Core/Src/AMS_HighLevel.c **** { 239 .loc 1 195 1 is_stmt 1 view -0 240 .cfi_startproc 241 @ args = 0, pretend = 0, frame = 0 242 @ frame_needed = 0, uses_anonymous_args = 0 243 @ link register save eliminated. 196:Core/Src/AMS_HighLevel.c **** return 0; 244 .loc 1 196 2 view .LVU43 197:Core/Src/AMS_HighLevel.c **** } 245 .loc 1 197 1 is_stmt 0 view .LVU44 246 0000 0020 movs r0, #0 247 0002 7047 bx lr 248 .cfi_endproc 249 .LFE136: 251 .section .text.AMS_Balancing_Loop,"ax",%progbits 252 .align 1 253 .global AMS_Balancing_Loop 254 .syntax unified 255 .thumb 256 .thumb_func 258 AMS_Balancing_Loop: 259 .LFB137: 198:Core/Src/AMS_HighLevel.c **** 199:Core/Src/AMS_HighLevel.c **** uint8_t AMS_Balancing_Loop() 200:Core/Src/AMS_HighLevel.c **** { 260 .loc 1 200 1 is_stmt 1 view -0 261 .cfi_startproc ARM GAS /tmp/ccmNZWYr.s page 9 262 @ args = 0, pretend = 0, frame = 0 263 @ frame_needed = 0, uses_anonymous_args = 0 264 0000 70B5 push {r4, r5, r6, lr} 265 .cfi_def_cfa_offset 16 266 .cfi_offset 4, -16 267 .cfi_offset 5, -12 268 .cfi_offset 6, -8 269 .cfi_offset 14, -4 201:Core/Src/AMS_HighLevel.c **** uint8_t balancingdone = 1; 270 .loc 1 201 2 view .LVU46 271 .LVL17: 202:Core/Src/AMS_HighLevel.c **** if((eepromconfigured == 1) && (internalbalancingalgo == 1) && (module.internalDieTemp<28000/*Therm 272 .loc 1 202 2 view .LVU47 273 .loc 1 202 23 is_stmt 0 view .LVU48 274 0002 3E4B ldr r3, .L42 275 0004 1B78 ldrb r3, [r3] @ zero_extendqisi2 276 .loc 1 202 4 view .LVU49 277 0006 012B cmp r3, #1 278 0008 03D1 bne .L18 279 .loc 1 202 55 discriminator 1 view .LVU50 280 000a 3D4B ldr r3, .L42+4 281 000c 1C78 ldrb r4, [r3] @ zero_extendqisi2 282 .loc 1 202 29 discriminator 1 view .LVU51 283 000e 012C cmp r4, #1 284 0010 04D0 beq .L37 285 .L18: 203:Core/Src/AMS_HighLevel.c **** { 204:Core/Src/AMS_HighLevel.c **** uint16_t highestcellvoltage = module.cellVoltages[0]; 205:Core/Src/AMS_HighLevel.c **** uint16_t lowestcellvoltage = module.cellVoltages[0]; 206:Core/Src/AMS_HighLevel.c **** uint8_t highestcell = 0; 207:Core/Src/AMS_HighLevel.c **** uint8_t lowestcell = 0; 208:Core/Src/AMS_HighLevel.c **** 209:Core/Src/AMS_HighLevel.c **** for(uint8_t n = 0; n < numberofCells; n++) 210:Core/Src/AMS_HighLevel.c **** { 211:Core/Src/AMS_HighLevel.c **** if(module.cellVoltages[n] > highestcellvoltage) 212:Core/Src/AMS_HighLevel.c **** { 213:Core/Src/AMS_HighLevel.c **** highestcellvoltage = module.cellVoltages[n]; 214:Core/Src/AMS_HighLevel.c **** highestcell = n; 215:Core/Src/AMS_HighLevel.c **** } 216:Core/Src/AMS_HighLevel.c **** if(module.cellVoltages[n] < lowestcellvoltage) 217:Core/Src/AMS_HighLevel.c **** { 218:Core/Src/AMS_HighLevel.c **** lowestcellvoltage = module.cellVoltages[n]; 219:Core/Src/AMS_HighLevel.c **** lowestcell = n; 220:Core/Src/AMS_HighLevel.c **** } 221:Core/Src/AMS_HighLevel.c **** } 222:Core/Src/AMS_HighLevel.c **** 223:Core/Src/AMS_HighLevel.c **** if(currentAMSState == AMSCHARGING) //Balancing is only Active if the BMS is in Charging Mode 224:Core/Src/AMS_HighLevel.c **** { 225:Core/Src/AMS_HighLevel.c **** 226:Core/Src/AMS_HighLevel.c **** uint32_t channelstobalance = 0; 227:Core/Src/AMS_HighLevel.c **** 228:Core/Src/AMS_HighLevel.c **** if(highestcellvoltage > startbalancingthreshold) 229:Core/Src/AMS_HighLevel.c **** { 230:Core/Src/AMS_HighLevel.c **** for(uint8_t n = 0; n < numberofCells; n++) 231:Core/Src/AMS_HighLevel.c **** { 232:Core/Src/AMS_HighLevel.c **** if(module.cellVoltages[n] > stopbalancingthreshold) 233:Core/Src/AMS_HighLevel.c **** { ARM GAS /tmp/ccmNZWYr.s page 10 234:Core/Src/AMS_HighLevel.c **** uint16_t dv = module.cellVoltages[n]-lowestcellvoltage; 235:Core/Src/AMS_HighLevel.c **** if(dv > (balancingvoltagedelta*1000)) 236:Core/Src/AMS_HighLevel.c **** { 237:Core/Src/AMS_HighLevel.c **** balancingdone = 0; 238:Core/Src/AMS_HighLevel.c **** channelstobalance |= 1< balancingvoltagedelta) 264:Core/Src/AMS_HighLevel.c **** { 265:Core/Src/AMS_HighLevel.c **** balancingdone = 0; 266:Core/Src/AMS_HighLevel.c **** channelstobalance |= 1< (balancingvoltagedelta*1000)) 449 .loc 1 234 7 is_stmt 1 view .LVU110 234:Core/Src/AMS_HighLevel.c **** if(dv > (balancingvoltagedelta*1000)) 450 .loc 1 234 16 is_stmt 0 view .LVU111 451 009a ACEB010C sub ip, ip, r1 452 009e 1FFA8CFC uxth ip, ip 453 .LVL38: 235:Core/Src/AMS_HighLevel.c **** { 454 .loc 1 235 7 is_stmt 1 view .LVU112 235:Core/Src/AMS_HighLevel.c **** { 455 .loc 1 235 37 is_stmt 0 view .LVU113 456 00a2 1D4D ldr r5, .L42+28 457 00a4 2D88 ldrh r5, [r5] 458 00a6 4FF47A7E mov lr, #1000 459 00aa 0EFB05F5 mul r5, lr, r5 235:Core/Src/AMS_HighLevel.c **** { 460 .loc 1 235 9 view .LVU114 461 00ae AC45 cmp ip, r5 462 00b0 E7DD ble .L26 237:Core/Src/AMS_HighLevel.c **** channelstobalance |= 1< balancingvoltagedelta) 512 .loc 1 262 7 view .LVU131 262:Core/Src/AMS_HighLevel.c **** if(dv > balancingvoltagedelta) 513 .loc 1 262 40 is_stmt 0 view .LVU132 514 00d0 0C4D ldr r5, .L42+8 515 00d2 35F813C0 ldrh ip, [r5, r3, lsl #1] 262:Core/Src/AMS_HighLevel.c **** if(dv > balancingvoltagedelta) 516 .loc 1 262 16 view .LVU133 517 00d6 ACEB010C sub ip, ip, r1 518 00da 1FFA8CFC uxth ip, ip 519 .LVL48: 263:Core/Src/AMS_HighLevel.c **** { 520 .loc 1 263 7 is_stmt 1 view .LVU134 263:Core/Src/AMS_HighLevel.c **** { 521 .loc 1 263 13 is_stmt 0 view .LVU135 522 00de 0E4D ldr r5, .L42+28 523 00e0 2D88 ldrh r5, [r5] 263:Core/Src/AMS_HighLevel.c **** { 524 .loc 1 263 9 view .LVU136 525 00e2 6545 cmp r5, ip 526 00e4 F0D2 bcs .L30 265:Core/Src/AMS_HighLevel.c **** channelstobalance |= 1<