Skip to content

Commit

Permalink
L431 FIXES
Browse files Browse the repository at this point in the history
  • Loading branch information
AlkaMotors committed Aug 10, 2024
1 parent 485820e commit f268d73
Show file tree
Hide file tree
Showing 75 changed files with 17,003 additions and 285 deletions.
98 changes: 95 additions & 3 deletions Inc/targets.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,46 @@
// GLOBAL
// #define USE_ADC_INPUT
// #define USE_ALKAS_DEBUG_LED
//// test for sequre


#ifdef LUMENIER_12S_F421
#define FIRMWARE_NAME "Lumenier 12s"
#define FILE_NAME "LUMENIER_12S_F421"
#define DEAD_TIME 120
#define CURRENT_ADC_PIN LL_GPIO_PIN_3
#define CURRENT_ADC_CHANNEL LL_ADC_CHANNEL_3
#define VOLTAGE_ADC_PIN LL_GPIO_PIN_6
#define VOLTAGE_ADC_CHANNEL LL_ADC_CHANNEL_6
#define HARDWARE_GROUP_AT_B
#define HARDWARE_GROUP_AT_045
#define USE_SERIAL_TELEMETRY
#define MILLIVOLT_PER_AMP 19
#define RAMP_SPEED_LOW_RPM 1
#define RAMP_SPEED_HIGH_RPM 1
#endif


#ifdef NEUTRON_L431
#define FILE_NAME "NEUTRON_L431"
#define FIRMWARE_NAME "L431 Neutron"
#define DEAD_TIME 60
#define DEAD_TIME 70
#define HARDWARE_GROUP_L4_N
#define TARGET_VOLTAGE_DIVIDER 65
#define TARGET_VOLTAGE_DIVIDER 210
#define CURRENT_OFFSET 498
#define MILLIVOLT_PER_AMP 16
#define USE_SERIAL_TELEMETRY
#define USE_INTERNAL_AMP
#endif

#ifdef VIMDRONES_L431
#define FIRMWARE_NAME "VimdroneL431"
#define FILE_NAME "VIMDRONES_L431"
#define DEAD_TIME 45
#define HARDWARE_GROUP_L4_B
#define TARGET_VOLTAGE_DIVIDER 94
#define MILLIVOLT_PER_AMP 100
#define USE_SERIAL_TELEMETRY
#define EEPROM_START_ADD (uint32_t)0x0801F800
#endif

#ifdef REF_L431
Expand Down Expand Up @@ -2657,6 +2689,8 @@
#define PHASE_B_COMP LL_COMP_INPUT_MINUS_IO4 // pa4
#define PHASE_C_COMP LL_COMP_INPUT_MINUS_IO5 // pa5

#define COMMON_COMP LL_COMP_INPUT_PLUS_IO3

#define CURRENT_SENSE_ADC_PIN LL_GPIO_PIN_3
#define VOLTAGE_SENSE_ADC_PIN LL_GPIO_PIN_6

Expand All @@ -2666,6 +2700,52 @@
#endif


#ifdef HARDWARE_GROUP_L4_B

#define MCU_L431
#define USE_TIMER_15_CHANNEL_1
#define INPUT_PIN LL_GPIO_PIN_2
#define INPUT_PIN_PORT GPIOA

#define IC_TIMER_CHANNEL LL_TIM_CHANNEL_CH1
#define IC_TIMER_REGISTER TIM15
#define IC_TIMER_POINTER htim15

#define INPUT_DMA_CHANNEL LL_DMA_CHANNEL_5
#define DMA_HANDLE_TYPE_DEF hdma_tim15_ch1
#define IC_DMA_IRQ_NAME DMA1_Channel5_IRQn

#define PHASE_A_GPIO_LOW LL_GPIO_PIN_1
#define PHASE_A_GPIO_PORT_LOW GPIOB
#define PHASE_A_GPIO_HIGH LL_GPIO_PIN_10
#define PHASE_A_GPIO_PORT_HIGH GPIOA

#define PHASE_B_GPIO_LOW LL_GPIO_PIN_0
#define PHASE_B_GPIO_PORT_LOW GPIOB
#define PHASE_B_GPIO_HIGH LL_GPIO_PIN_9
#define PHASE_B_GPIO_PORT_HIGH GPIOA

#define PHASE_C_GPIO_LOW LL_GPIO_PIN_7
#define PHASE_C_GPIO_PORT_LOW GPIOA
#define PHASE_C_GPIO_HIGH LL_GPIO_PIN_8
#define PHASE_C_GPIO_PORT_HIGH GPIOA


#define USE_COMP_2
#define PHASE_A_COMP LL_COMP_INPUT_MINUS_IO2 // pb7
#define PHASE_B_COMP LL_COMP_INPUT_MINUS_IO5 // pa5
#define PHASE_C_COMP LL_COMP_INPUT_MINUS_IO4 // pa4
#define COMMON_COMP LL_COMP_INPUT_PLUS_IO1
//#define USE_LED_STRIP
//#define WS2812_PIN LL_GPIO_PIN_3

#define CURRENT_ADC_CHANNEL LL_ADC_CHANNEL_8
#define VOLTAGE_ADC_CHANNEL LL_ADC_CHANNEL_11
#define ADC_CHANNEL_TEMP LL_ADC_CHANNEL_6

#endif



#ifdef HARDWARE_GROUP_L4_N

Expand Down Expand Up @@ -2700,6 +2780,8 @@
#define PHASE_A_COMP LL_COMP_INPUT_MINUS_IO2 // pb7
#define PHASE_B_COMP LL_COMP_INPUT_MINUS_IO5 // pa5
#define PHASE_C_COMP LL_COMP_INPUT_MINUS_IO4 // pa4
#define COMMON_COMP LL_COMP_INPUT_PLUS_IO1


#define CURRENT_SENSE_ADC_PIN LL_GPIO_PIN_3
#define VOLTAGE_SENSE_ADC_PIN LL_GPIO_PIN_6
Expand Down Expand Up @@ -2895,16 +2977,26 @@
#ifdef MCU_L431
#define STMICRO
#define CPU_FREQUENCY_MHZ 80
#ifndef EEPROM_START_ADD
#define EEPROM_START_ADD (uint32_t)0x0800F800
#endif
#define INTERVAL_TIMER TIM2
#define TEN_KHZ_TIMER TIM6
#define UTILITY_TIMER TIM7
#define COM_TIMER TIM16
#define TIM1_AUTORELOAD 3334
#define APPLICATION_ADDRESS 0x08001000
#ifdef USE_COMP_2
#define MAIN_COMP COMP2
#define EXTI_LINE LL_EXTI_LINE_22
#endif
#ifdef USE_COMP_1
#define MAIN_COMP COMP2
#define EXTI_LINE LL_EXTI_LINE_21
#endif
#ifndef TARGET_MIN_BEMF_COUNTS
#define TARGET_MIN_BEMF_COUNTS 3
#endif
#define COM_TIMER_IRQ TIM1_UP_TIM16_IRQn
#define DSHOT_PRIORITY_THRESHOLD 60
#define COMPARATOR_IRQ COMP_IRQn
Expand Down
4 changes: 2 additions & 2 deletions Keil_Projects/AM32_MultiProject.uvmpw
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,11 @@

<project>
<PathAndName>.\Am32F421.uvprojx</PathAndName>
<NodeIsExpanded>1</NodeIsExpanded>
<NodeIsCheckedInBatchBuild>1</NodeIsCheckedInBatchBuild>
</project>

<project>
<PathAndName>.\Am32G071.uvprojx</PathAndName>
<NodeIsActive>1</NodeIsActive>
<NodeIsCheckedInBatchBuild>1</NodeIsCheckedInBatchBuild>
</project>

Expand All @@ -46,6 +44,8 @@

<project>
<PathAndName>.\Am32l431.uvprojx</PathAndName>
<NodeIsActive>1</NodeIsActive>
<NodeIsExpanded>1</NodeIsExpanded>
<NodeIsCheckedInBatchBuild>1</NodeIsCheckedInBatchBuild>
</project>

Expand Down
171 changes: 108 additions & 63 deletions Keil_Projects/AM32_MultiProject.uvmpw.uvgui.alkaz

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions Keil_Projects/Am32F031.uvguix.alkaz
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@
<View>
<WinId>38003</WinId>
<ViewName>Registers</ViewName>
<TableColWidths>211 212</TableColWidths>
<TableColWidths>130 100</TableColWidths>
</View>
<View>
<WinId>346</WinId>
<ViewName>Code Coverage</ViewName>
<TableColWidths>669 160</TableColWidths>
<TableColWidths>669 203</TableColWidths>
</View>
<View>
<WinId>204</WinId>
<ViewName>Performance Analyzer</ViewName>
<TableColWidths>829</TableColWidths>
<TableColWidths>829 124 124 100</TableColWidths>
</View>
</SECTreeCtrl>

Expand Down Expand Up @@ -93,8 +93,8 @@
<flags>2</flags>
<showCmd>3</showCmd>
<MinPosition>
<xPos>-1</xPos>
<yPos>-1</yPos>
<xPos>-32000</xPos>
<yPos>-32000</yPos>
</MinPosition>
<MaxPosition>
<xPos>-1</xPos>
Expand All @@ -110,8 +110,8 @@
<MDIClientArea>
<RegID>0</RegID>
<MDITabState>
<Len>1951</Len>
<Data>01000000040000000100000001000000010000000100000000000000020000000000000001000000010000000000000028000000280000000100000011000000020000000100000043433A5C55736572735C616C6B617A5C4F6E6544726976655C446F63756D656E74735C414D33325F4D554C54495F4D43555C4D63755C673037315C5372635C4144432E6300000000054144432E6300000000C5D4F200FFFFFFFF43433A5C55736572735C616C6B617A5C4F6E6544726976655C446F63756D656E74735C414D33325F4D554C54495F4D43555C4D63755C673433315C5372635C4144432E6300000000054144432E6300000000FFDC7800FFFFFFFF3E433A5C55736572735C616C6B617A5C4F6E6544726976655C446F63756D656E74735C414D33325F4D554C54495F4D43555C496E635C746172676574732E680000000009746172676574732E6800000000BECEA100FFFFFFFF4B433A5C55736572735C616C6B617A5C4F6E6544726976655C446F63756D656E74735C414D33325F4D554C54495F4D43555C4D63755C673433315C5372635C7065726970686572616C732E63000000000D7065726970686572616C732E6300000000F0A0A100FFFFFFFF4B433A5C55736572735C616C6B617A5C4F6E6544726976655C446F63756D656E74735C414D33325F4D554C54495F4D43555C4D63755C673433315C496E635C7065726970686572616C732E68000000000D7065726970686572616C732E6800000000BCA8E100FFFFFFFF3B433A5C55736572735C616C6B617A5C4F6E6544726976655C446F63756D656E74735C414D33325F4D554C54495F4D43555C5372635C6D61696E2E6300000000066D61696E2E63000000009CC1B600FFFFFFFF50433A5C55736572735C616C6B617A5C4F6E6544726976655C446F63756D656E74735C414D33325F4D554C54495F4D43555C4D63755C673433315C5372635C73797374656D5F73746D3332673478782E63000000001273797374656D5F73746D3332673478782E6300000000F7B88600FFFFFFFF4C433A5C55736572735C616C6B617A5C4F6E6544726976655C446F63756D656E74735C414D33325F4D554C54495F4D43555C4D63755C673433315C5372635C73746D3332673478785F69742E63000000000E73746D3332673478785F69742E6300000000D9ADC200FFFFFFFF4C433A5C55736572735C616C6B617A5C4F6E6544726976655C446F63756D656E74735C414D33325F4D554C54495F4D43555C4D63755C673037315C5372635C73746D3332673078785F69742E63000000000E73746D3332673078785F69742E6300000000A5C2D700FFFFFFFF43433A5C55736572735C616C6B617A5C4F6E6544726976655C446F63756D656E74735C414D33325F4D554C54495F4D43555C4D63755C6C3433315C5372635C4144432E6300000000054144432E6300000000B3A6BE00FFFFFFFF50433A5C55736572735C616C6B617A5C4F6E6544726976655C446F63756D656E74735C414D33325F4D554C54495F4D43555C4D63755C673433315C5372635C73657269616C5F74656C656D657472792E63000000001273657269616C5F74656C656D657472792E6300000000EAD6A300FFFFFFFF4A433A5C55736572735C616C6B617A5C4F6E6544726976655C446F63756D656E74735C414D33325F4D554C54495F4D43555C4D63755C663431355C5372635C636F6D70617261746F722E63000000000C636F6D70617261746F722E6300000000F6FA7D00FFFFFFFF4B433A5C55736572735C616C6B617A5C4F6E6544726976655C446F63756D656E74735C414D33325F4D554C54495F4D43555C4D63755C663431355C5372635C61743332663431355F69742E63000000000D61743332663431355F69742E6300000000B5E99D00FFFFFFFF4A433A5C55736572735C616C6B617A5C4F6E6544726976655C446F63756D656E74735C414D33325F4D554C54495F4D43555C4D63755C6C3433315C5372635C636F6D70617261746F722E63000000000C636F6D70617261746F722E63000000005FC3CF00FFFFFFFF4C433A5C55736572735C616C6B617A5C4F6E6544726976655C446F63756D656E74735C414D33325F4D554C54495F4D43555C4D63755C6C3433315C5372635C73746D33326C3478785F69742E63000000000E73746D33326C3478785F69742E6300000000C1838300FFFFFFFF4B433A5C55736572735C616C6B617A5C4F6E6544726976655C446F63756D656E74735C414D33325F4D554C54495F4D43555C4D63755C6C3433315C5372635C7065726970686572616C732E63000000000D7065726970686572616C732E6300000000CACAD500FFFFFFFF6F433A5C55736572735C616C6B617A5C4F6E6544726976655C446F63756D656E74735C414D33325F4D554C54495F4D43555C4D63755C663035315C447269766572735C53544D3332463078785F48414C5F4472697665725C5372635C73746D3332663078785F6C6C5F7574696C732E63000000001473746D3332663078785F6C6C5F7574696C732E6300000000C5D4F200FFFFFFFF0100000010000000C5D4F200FFDC7800BECEA100F0A0A100BCA8E1009CC1B600F7B88600D9ADC200A5C2D700B3A6BE00EAD6A300F6FA7D00B5E99D005FC3CF00C1838300CACAD500010000000000000002000000B50100007000000080070000C8030000</Data>
<Len>2508</Len>
<Data>01000000040000000100000001000000010000000100000000000000020000000000000001000000010000000000000028000000280000000100000016000000020000000100000042433A5C55736572735C616C6B617A5C4F6E6544726976655C446F63756D656E74735C414D33325F4D554C54495F4D43555C4D63755C6C3433315C5372635C494F2E630000000004494F2E6300000000C5D4F200FFFFFFFF42433A5C55736572735C616C6B617A5C4F6E6544726976655C446F63756D656E74735C414D33325F4D554C54495F4D43555C4D63755C673037315C5372635C494F2E630000000004494F2E6300000000FFDC7800FFFFFFFF3B433A5C55736572735C616C6B617A5C4F6E6544726976655C446F63756D656E74735C414D33325F4D554C54495F4D43555C5372635C6D61696E2E6300000000066D61696E2E6300000000BECEA100FFFFFFFF50433A5C55736572735C616C6B617A5C4F6E6544726976655C446F63756D656E74735C414D33325F4D554C54495F4D43555C4D63755C6C3433315C5372635C73797374656D5F73746D33326C3478782E63000000001273797374656D5F73746D33326C3478782E6300000000F0A0A100FFFFFFFF4B433A5C55736572735C616C6B617A5C4F6E6544726976655C446F63756D656E74735C414D33325F4D554C54495F4D43555C4D63755C6C3433315C5372635C7065726970686572616C732E63000000000D7065726970686572616C732E6300000000BCA8E100FFFFFFFF4C433A5C55736572735C616C6B617A5C4F6E6544726976655C446F63756D656E74735C414D33325F4D554C54495F4D43555C4D63755C6C3433315C5372635C73746D33326C3478785F69742E63000000000E73746D33326C3478785F69742E63000000009CC1B600FFFFFFFF50433A5C55736572735C616C6B617A5C4F6E6544726976655C446F63756D656E74735C414D33325F4D554C54495F4D43555C4D63755C6C3433315C5372635C73657269616C5F74656C656D657472792E63000000001273657269616C5F74656C656D657472792E6300000000F7B88600FFFFFFFF3C433A5C55736572735C616C6B617A5C4F6E6544726976655C446F63756D656E74735C414D33325F4D554C54495F4D43555C5372635C6473686F742E6300000000076473686F742E6300000000D9ADC200FFFFFFFF3E433A5C55736572735C616C6B617A5C4F6E6544726976655C446F63756D656E74735C414D33325F4D554C54495F4D43555C496E635C746172676574732E680000000009746172676574732E6800000000A5C2D700FFFFFFFF57433A5C55736572735C616C6B617A5C4F6E6544726976655C446F63756D656E74735C414D33325F4D554C54495F4D43555C4D63755C6C3433315C537461727475705C737461727475705F73746D33326C34333178782E730000000015737461727475705F73746D33326C34333178782E7300000000B3A6BE00FFFFFFFF4C433A5C55736572735C616C6B617A5C4F6E6544726976655C446F63756D656E74735C414D33325F4D554C54495F4D43555C4D63755C6C3433315C496E635C73746D33326C3478785F69742E68000000000E73746D33326C3478785F69742E6800000000EAD6A300FFFFFFFF46433A5C55736572735C616C6B617A5C4F6E6544726976655C446F63756D656E74735C414D33325F4D554C54495F4D43555C4D63755C6C3433315C5372635C656570726F6D2E630000000008656570726F6D2E6300000000F6FA7D00FFFFFFFF6F433A5C55736572735C616C6B617A5C4F6E6544726976655C446F63756D656E74735C414D33325F4D554C54495F4D43555C4D63755C6C3433315C447269766572735C434D5349535C4465766963655C53545C53544D33324C3478785C496E636C7564655C73746D33326C3478782E68000000000B73746D33326C3478782E6800000000B5E99D00FFFFFFFF71433A5C55736572735C616C6B617A5C4F6E6544726976655C446F63756D656E74735C414D33325F4D554C54495F4D43555C4D63755C6C3433315C447269766572735C434D5349535C4465766963655C53545C53544D33324C3478785C496E636C7564655C73746D33326C34333178782E68000000000D73746D33326C34333178782E68000000005FC3CF00FFFFFFFF70433A5C55736572735C616C6B617A5C4F6E6544726976655C446F63756D656E74735C414D33325F4D554C54495F4D43555C4D63755C6C3433315C447269766572735C53544D33324C3478785F48414C5F4472697665725C496E635C73746D33326C3478785F6C6C5F73797374656D2E68000000001573746D33326C3478785F6C6C5F73797374656D2E6800000000C1838300FFFFFFFF44433A5C55736572735C616C6B617A5C4F6E6544726976655C446F63756D656E74735C414D33325F4D554C54495F4D43555C4D63755C6C3433315C496E635C6D61696E2E6800000000066D61696E2E6800000000CACAD500FFFFFFFF4A433A5C55736572735C616C6B617A5C4F6E6544726976655C446F63756D656E74735C414D33325F4D554C54495F4D43555C4D63755C6C3433315C5372635C636F6D70617261746F722E63000000000C636F6D70617261746F722E6300000000C5D4F200FFFFFFFF43433A5C55736572735C616C6B617A5C4F6E6544726976655C446F63756D656E74735C414D33325F4D554C54495F4D43555C4D63755C6C3433315C5372635C4144432E6300000000054144432E6300000000FFDC7800FFFFFFFF4B433A5C55736572735C616C6B617A5C4F6E6544726976655C446F63756D656E74735C414D33325F4D554C54495F4D43555C4D63755C6C3433315C496E635C7065726970686572616C732E68000000000D7065726970686572616C732E6800000000BECEA100FFFFFFFF4C433A5C55736572735C616C6B617A5C4F6E6544726976655C446F63756D656E74735C414D33325F4D554C54495F4D43555C4D63755C673037315C5372635C73746D3332673078785F69742E63000000000E73746D3332673078785F69742E6300000000F0A0A100FFFFFFFF46433A5C55736572735C616C6B617A5C4F6E6544726976655C446F63756D656E74735C414D33325F4D554C54495F4D43555C4D63755C673037315C5372635C5753323831322E6300000000085753323831322E6300000000BCA8E100FFFFFFFF46433A5C55736572735C616C6B617A5C4F6E6544726976655C446F63756D656E74735C414D33325F4D554C54495F4D43555C4D63755C663432315C5372635C5753323831322E6300000000085753323831322E63000000009CC1B600FFFFFFFF0100000010000000C5D4F200FFDC7800BECEA100F0A0A100BCA8E1009CC1B600F7B88600D9ADC200A5C2D700B3A6BE00EAD6A300F6FA7D00B5E99D005FC3CF00C1838300CACAD500010000000000000002000000B50100007000000080070000C8030000</Data>
</MDITabState>
</MDIClientArea>
<ViewEx>
Expand Down Expand Up @@ -3605,7 +3605,7 @@
<Size>100</Size>
<ActiveTab>1</ActiveTab>
<Doc>
<Name>C:\Users\alkaz\OneDrive\Documents\AM32_MULTI_MCU\Inc\targets.h</Name>
<Name>&lt;1&gt;..\Inc\targets.h</Name>
<ColumnNumber>19</ColumnNumber>
<TopLine>648</TopLine>
<CurrentLine>654</CurrentLine>
Expand Down
Loading

0 comments on commit f268d73

Please sign in to comment.