Skip to content

Commit

Permalink
Add G431 Mcu
Browse files Browse the repository at this point in the history
  • Loading branch information
AlkaMotors committed Jan 10, 2024
1 parent b6c7d26 commit b2b2793
Show file tree
Hide file tree
Showing 1,181 changed files with 753,653 additions and 296 deletions.
114 changes: 113 additions & 1 deletion Inc/targets.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,18 @@
// #define USE_ADC_INPUT
// #define USE_ALKAS_DEBUG_LED


#ifdef REF_G431
#define FIRMWARE_NAME "Ref G431 "
#define FILE_NAME "REF_G431"
#define DEAD_TIME 80
#define HARDWARE_GROUP_G4_A
#define TARGET_STALL_PROTECTION_INTERVAL 20000
//#define PA6_VOLTAGE
//#define USE_SERIAL_TELEMETRY
#endif


#ifdef GD32DEV_A_E230
#define FIRMWARE_NAME "GD32 Dev A "
#define FILE_NAME "GD32DEV_A_E230"
Expand Down Expand Up @@ -596,6 +608,20 @@
#define CURRENT_ADC_PIN LL_GPIO_PIN_3
#endif

#ifdef ARIA_RAMP_F051
#define FILE_NAME "FLYCOLOR_F051"
#define FIRMWARE_NAME "Aria Slow "
#define DEAD_TIME 45
#define HARDWARE_GROUP_F0_A
#define USE_SERIAL_TELEMETRY
#define VOLTAGE_ADC_CHANNEL LL_ADC_CHANNEL_6
#define VOLTAGE_ADC_PIN LL_GPIO_PIN_6
#define CURRENT_ADC_CHANNEL LL_ADC_CHANNEL_3
#define CURRENT_ADC_PIN LL_GPIO_PIN_3
#define LOOP_FREQUENCY_HZ 500
#define CUSTOM_RAMP
#endif

#ifdef HVFLYCOLOR_F051
#define FILE_NAME "HVFLYCOLOR_F051"
#define FIRMWARE_NAME "FLYCOLOR HV "
Expand Down Expand Up @@ -710,6 +736,8 @@
#define HARDWARE_GROUP_G0_A
#define USE_SERIAL_TELEMETRY
#define SIXTY_FOUR_KB_MEMORY
#define LOOP_FREQUENCY_HZ 500
#define CUSTOM_RAMP
#endif

#ifdef TMOTOR_G071
Expand Down Expand Up @@ -1601,6 +1629,56 @@

#endif

#ifdef HARDWARE_GROUP_G4_A

#define MCU_G431
#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_1
#define DMA_HANDLE_TYPE_DEF hdma_tim15_ch1
#define IC_DMA_IRQ_NAME DMA1_Channel1_IRQn

#define PHASE_A_GPIO_LOW LL_GPIO_PIN_0
#define PHASE_A_GPIO_PORT_LOW GPIOF
#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 PHASE_A_COMP LL_COMP_INPUT_MINUS_IO1 //
#define PHASE_B_COMP LL_COMP_INPUT_MINUS_IO1 //
#define PHASE_C_COMP LL_COMP_INPUT_MINUS_IO2 //

#define PHASE_A_EXTI_LINE LL_EXTI_LINE_22
#define PHASE_A_COMP_NUMBER COMP2

#define PHASE_B_EXTI_LINE LL_EXTI_LINE_21
#define PHASE_B_COMP_NUMBER COMP1

#define PHASE_C_EXTI_LINE LL_EXTI_LINE_21
#define PHASE_C_COMP_NUMBER COMP1

#define VOLTAGE_ADC_PIN LL_GPIO_PIN_5
#define VOLTAGE_ADC_CHANNEL LL_ADC_CHANNEL_5

#define CURRENT_ADC_PIN LL_GPIO_PIN_4
#define CURRENT_ADC_CHANNEL LL_ADC_CHANNEL_4

#endif

/************************************ G031 Hardware Groups ************************************************/

#ifdef HARDWARE_GROUP_F031_A
Expand Down Expand Up @@ -2081,7 +2159,7 @@
#define APPLICATION_ADDRESS 0x08001000
#define MAIN_COMP COMP2
#define EXTI_LINE LL_EXTI_LINE_18
#define TARGET_MIN_BEMF_COUNTS 2
#define TARGET_MIN_BEMF_COUNTS 3
#define COMPARATOR_IRQ ADC1_COMP_IRQn
#define USE_ADC
#ifndef CURRENT_ADC_CHANNEL
Expand All @@ -2100,6 +2178,40 @@
#define COM_TIMER_IRQ TIM14_IRQn
#endif



#ifdef MCU_G431
#define STMICRO
#define CPU_FREQUENCY_MHZ 150
#define EEPROM_START_ADD (uint32_t)0x0800F800
#define INTERVAL_TIMER TIM2
#define TEN_KHZ_TIMER TIM6
#define UTILITY_TIMER TIM17
#define COM_TIMER TIM16
#define TIM1_AUTORELOAD 6249
#define APPLICATION_ADDRESS 0x08001000
#define MAIN_COMP COMP2
#define EXTI_LINE LL_EXTI_LINE_22
#define TARGET_MIN_BEMF_COUNTS 3
#define COMPARATOR_IRQ COMP1_2_3_IRQn
//#define USE_ADC
//#ifndef CURRENT_ADC_CHANNEL
//#define CURRENT_ADC_CHANNEL LL_ADC_CHANNEL_5
//#endif
//#ifndef VOLTAGE_ADC_CHANNEL
//#define VOLTAGE_ADC_CHANNEL LL_ADC_CHANNEL_6
//#endif
//#ifndef CURRENT_ADC_PIN
//#define CURRENT_ADC_PIN LL_GPIO_PIN_5
//#endif
//#ifndef VOLTAGE_ADC_PIN
//#define VOLTAGE_ADC_PIN LL_GPIO_PIN_6
//#endif
#define DSHOT_PRIORITY_THRESHOLD 60
#define COM_TIMER_IRQ TIM1_UP_TIM16_IRQn
#endif


#ifdef MCU_GDE23
#define GIGADEVICES
#define CPU_FREQUENCY_MHZ 72
Expand Down
7 changes: 6 additions & 1 deletion Keil_Projects/AM32_MultiProject.uvmpw
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,13 @@

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

<project>
<PathAndName>.\Am32G431.uvprojx</PathAndName>
<NodeIsActive>1</NodeIsActive>
<NodeIsExpanded>1</NodeIsExpanded>
</project>

</ProjectWorkspace>
85 changes: 56 additions & 29 deletions Keil_Projects/AM32_MultiProject.uvmpw.uvgui.alkaz

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions Keil_Projects/Am32F031.uvguix.alkaz
Original file line number Diff line number Diff line change
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>1152</Len>
<Data>0100000004000000010000000100000001000000010000000000000002000000000000000100000001000000000000002800000028000000010000000A00000004000000010000003B433A5C55736572735C616C6B617A5C4F6E6544726976655C446F63756D656E74735C414D33325F4D554C54495F4D43555C5372635C6D61696E2E6300000000066D61696E2E6300000000C5D4F200FFFFFFFF43433A5C55736572735C616C6B617A5C4F6E6544726976655C446F63756D656E74735C414D33325F4D554C54495F4D43555C4D63755C463033315C5372635C4144432E6300000000054144432E6300000000FFDC7800FFFFFFFF4B433A5C55736572735C616C6B617A5C4F6E6544726976655C446F63756D656E74735C414D33325F4D554C54495F4D43555C4D63755C673037315C5372635C7065726970686572616C732E63000000000D7065726970686572616C732E6300000000BECEA100FFFFFFFF49433A5C55736572735C616C6B617A5C4F6E6544726976655C446F63756D656E74735C414D33325F4D554C54495F4D43555C4D63755C653233305C5372635C70686173656F7574732E63000000000B70686173656F7574732E6300000000F0A0A100FFFFFFFF3E433A5C55736572735C616C6B617A5C4F6E6544726976655C446F63756D656E74735C414D33325F4D554C54495F4D43555C696E635C746172676574732E680000000009746172676574732E6800000000BCA8E100FFFFFFFF49433A5C55736572735C616C6B617A5C4F6E6544726976655C446F63756D656E74735C414D33325F4D554C54495F4D43555C4D63755C463033315C5372635C70686173656F7574732E63000000000B70686173656F7574732E63000000009CC1B600FFFFFFFF49433A5C55736572735C616C6B617A5C4F6E6544726976655C446F63756D656E74735C414D33325F4D554C54495F4D43555C4D63755C663035315C5372635C70686173656F7574732E63000000000B70686173656F7574732E6300000000F7B88600FFFFFFFF49433A5C55736572735C616C6B617A5C4F6E6544726976655C446F63756D656E74735C414D33325F4D554C54495F4D43555C4D63755C663431355C5372635C70686173656F7574732E63000000000B70686173656F7574732E6300000000D9ADC200FFFFFFFF49433A5C55736572735C616C6B617A5C4F6E6544726976655C446F63756D656E74735C414D33325F4D554C54495F4D43555C4D63755C663432315C5372635C70686173656F7574732E63000000000B70686173656F7574732E6300000000A5C2D700FFFFFFFF49433A5C55736572735C616C6B617A5C4F6E6544726976655C446F63756D656E74735C414D33325F4D554C54495F4D43555C4D63755C673037315C5372635C70686173656F7574732E63000000000B70686173656F7574732E6300000000B3A6BE00FFFFFFFF0100000010000000C5D4F200FFDC7800BECEA100F0A0A100BCA8E1009CC1B600F7B88600D9ADC200A5C2D700B3A6BE00EAD6A300F6FA7D00B5E99D005FC3CF00C1838300CACAD500010000000000000002000000B5010000700000008007000012030000</Data>
<Len>1452</Len>
<Data>0100000004000000010000000100000001000000010000000000000002000000000000000100000001000000000000002800000028000000010000000D00000002000000010000003B433A5C55736572735C616C6B617A5C4F6E6544726976655C446F63756D656E74735C414D33325F4D554C54495F4D43555C5372635C6D61696E2E6300000000066D61696E2E6300000000C5D4F200FFFFFFFF43433A5C55736572735C616C6B617A5C4F6E6544726976655C446F63756D656E74735C414D33325F4D554C54495F4D43555C4D63755C463033315C5372635C4144432E6300000000054144432E6300000000FFDC7800FFFFFFFF4B433A5C55736572735C616C6B617A5C4F6E6544726976655C446F63756D656E74735C414D33325F4D554C54495F4D43555C4D63755C673037315C5372635C7065726970686572616C732E63000000000D7065726970686572616C732E6300000000BECEA100FFFFFFFF49433A5C55736572735C616C6B617A5C4F6E6544726976655C446F63756D656E74735C414D33325F4D554C54495F4D43555C4D63755C653233305C5372635C70686173656F7574732E63000000000B70686173656F7574732E6300000000F0A0A100FFFFFFFF3E433A5C55736572735C616C6B617A5C4F6E6544726976655C446F63756D656E74735C414D33325F4D554C54495F4D43555C696E635C746172676574732E680000000009746172676574732E6800000000BCA8E100FFFFFFFF49433A5C55736572735C616C6B617A5C4F6E6544726976655C446F63756D656E74735C414D33325F4D554C54495F4D43555C4D63755C463033315C5372635C70686173656F7574732E63000000000B70686173656F7574732E63000000009CC1B600FFFFFFFF49433A5C55736572735C616C6B617A5C4F6E6544726976655C446F63756D656E74735C414D33325F4D554C54495F4D43555C4D63755C663035315C5372635C70686173656F7574732E63000000000B70686173656F7574732E6300000000F7B88600FFFFFFFF49433A5C55736572735C616C6B617A5C4F6E6544726976655C446F63756D656E74735C414D33325F4D554C54495F4D43555C4D63755C663431355C5372635C70686173656F7574732E63000000000B70686173656F7574732E6300000000D9ADC200FFFFFFFF49433A5C55736572735C616C6B617A5C4F6E6544726976655C446F63756D656E74735C414D33325F4D554C54495F4D43555C4D63755C663432315C5372635C70686173656F7574732E63000000000B70686173656F7574732E6300000000A5C2D700FFFFFFFF49433A5C55736572735C616C6B617A5C4F6E6544726976655C446F63756D656E74735C414D33325F4D554C54495F4D43555C4D63755C673037315C5372635C70686173656F7574732E63000000000B70686173656F7574732E6300000000B3A6BE00FFFFFFFF42433A5C55736572735C616C6B617A5C4F6E6544726976655C446F63756D656E74735C414D33325F4D554C54495F4D43555C4D63755C673037315C5372635C494F2E630000000004494F2E6300000000EAD6A300FFFFFFFF4C433A5C55736572735C616C6B617A5C4F6E6544726976655C446F63756D656E74735C414D33325F4D554C54495F4D43555C4D63755C673037315C5372635C73746D3332673078785F69742E63000000000E73746D3332673078785F69742E6300000000F6FA7D00FFFFFFFF4A433A5C55736572735C616C6B617A5C4F6E6544726976655C446F63756D656E74735C414D33325F4D554C54495F4D43555C4D63755C663035315C5372635C636F6D70617261746F722E63000000000C636F6D70617261746F722E6300000000B5E99D00FFFFFFFF0100000010000000C5D4F200FFDC7800BECEA100F0A0A100BCA8E1009CC1B600F7B88600D9ADC200A5C2D700B3A6BE00EAD6A300F6FA7D00B5E99D005FC3CF00C1838300CACAD500010000000000000002000000B5010000700000008007000093030000</Data>
</MDITabState>
</MDIClientArea>
<ViewEx>
Expand Down Expand Up @@ -3605,7 +3605,7 @@
<Size>100</Size>
<ActiveTab>1</ActiveTab>
<Doc>
<Name>&lt;1&gt;..\inc\targets.h</Name>
<Name>C:\Users\alkaz\OneDrive\Documents\AM32_MULTI_MCU\inc\targets.h</Name>
<ColumnNumber>19</ColumnNumber>
<TopLine>648</TopLine>
<CurrentLine>654</CurrentLine>
Expand Down
8 changes: 4 additions & 4 deletions Keil_Projects/Am32F051.uvguix.alkaz
Original file line number Diff line number Diff line change
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>1152</Len>
<Data>0100000004000000010000000100000001000000010000000000000002000000000000000100000001000000000000002800000028000000010000000A00000004000000010000003B433A5C55736572735C616C6B617A5C4F6E6544726976655C446F63756D656E74735C414D33325F4D554C54495F4D43555C5372635C6D61696E2E6300000000066D61696E2E6300000000C5D4F200FFFFFFFF43433A5C55736572735C616C6B617A5C4F6E6544726976655C446F63756D656E74735C414D33325F4D554C54495F4D43555C4D63755C463033315C5372635C4144432E6300000000054144432E6300000000FFDC7800FFFFFFFF4B433A5C55736572735C616C6B617A5C4F6E6544726976655C446F63756D656E74735C414D33325F4D554C54495F4D43555C4D63755C673037315C5372635C7065726970686572616C732E63000000000D7065726970686572616C732E6300000000BECEA100FFFFFFFF49433A5C55736572735C616C6B617A5C4F6E6544726976655C446F63756D656E74735C414D33325F4D554C54495F4D43555C4D63755C653233305C5372635C70686173656F7574732E63000000000B70686173656F7574732E6300000000F0A0A100FFFFFFFF3E433A5C55736572735C616C6B617A5C4F6E6544726976655C446F63756D656E74735C414D33325F4D554C54495F4D43555C696E635C746172676574732E680000000009746172676574732E6800000000BCA8E100FFFFFFFF49433A5C55736572735C616C6B617A5C4F6E6544726976655C446F63756D656E74735C414D33325F4D554C54495F4D43555C4D63755C463033315C5372635C70686173656F7574732E63000000000B70686173656F7574732E63000000009CC1B600FFFFFFFF49433A5C55736572735C616C6B617A5C4F6E6544726976655C446F63756D656E74735C414D33325F4D554C54495F4D43555C4D63755C663035315C5372635C70686173656F7574732E63000000000B70686173656F7574732E6300000000F7B88600FFFFFFFF49433A5C55736572735C616C6B617A5C4F6E6544726976655C446F63756D656E74735C414D33325F4D554C54495F4D43555C4D63755C663431355C5372635C70686173656F7574732E63000000000B70686173656F7574732E6300000000D9ADC200FFFFFFFF49433A5C55736572735C616C6B617A5C4F6E6544726976655C446F63756D656E74735C414D33325F4D554C54495F4D43555C4D63755C663432315C5372635C70686173656F7574732E63000000000B70686173656F7574732E6300000000A5C2D700FFFFFFFF49433A5C55736572735C616C6B617A5C4F6E6544726976655C446F63756D656E74735C414D33325F4D554C54495F4D43555C4D63755C673037315C5372635C70686173656F7574732E63000000000B70686173656F7574732E6300000000B3A6BE00FFFFFFFF0100000010000000C5D4F200FFDC7800BECEA100F0A0A100BCA8E1009CC1B600F7B88600D9ADC200A5C2D700B3A6BE00EAD6A300F6FA7D00B5E99D005FC3CF00C1838300CACAD500010000000000000002000000B5010000700000008007000012030000</Data>
<Len>1452</Len>
<Data>0100000004000000010000000100000001000000010000000000000002000000000000000100000001000000000000002800000028000000010000000D00000002000000010000003B433A5C55736572735C616C6B617A5C4F6E6544726976655C446F63756D656E74735C414D33325F4D554C54495F4D43555C5372635C6D61696E2E6300000000066D61696E2E6300000000C5D4F200FFFFFFFF43433A5C55736572735C616C6B617A5C4F6E6544726976655C446F63756D656E74735C414D33325F4D554C54495F4D43555C4D63755C463033315C5372635C4144432E6300000000054144432E6300000000FFDC7800FFFFFFFF4B433A5C55736572735C616C6B617A5C4F6E6544726976655C446F63756D656E74735C414D33325F4D554C54495F4D43555C4D63755C673037315C5372635C7065726970686572616C732E63000000000D7065726970686572616C732E6300000000BECEA100FFFFFFFF49433A5C55736572735C616C6B617A5C4F6E6544726976655C446F63756D656E74735C414D33325F4D554C54495F4D43555C4D63755C653233305C5372635C70686173656F7574732E63000000000B70686173656F7574732E6300000000F0A0A100FFFFFFFF3E433A5C55736572735C616C6B617A5C4F6E6544726976655C446F63756D656E74735C414D33325F4D554C54495F4D43555C696E635C746172676574732E680000000009746172676574732E6800000000BCA8E100FFFFFFFF49433A5C55736572735C616C6B617A5C4F6E6544726976655C446F63756D656E74735C414D33325F4D554C54495F4D43555C4D63755C463033315C5372635C70686173656F7574732E63000000000B70686173656F7574732E63000000009CC1B600FFFFFFFF49433A5C55736572735C616C6B617A5C4F6E6544726976655C446F63756D656E74735C414D33325F4D554C54495F4D43555C4D63755C663035315C5372635C70686173656F7574732E63000000000B70686173656F7574732E6300000000F7B88600FFFFFFFF49433A5C55736572735C616C6B617A5C4F6E6544726976655C446F63756D656E74735C414D33325F4D554C54495F4D43555C4D63755C663431355C5372635C70686173656F7574732E63000000000B70686173656F7574732E6300000000D9ADC200FFFFFFFF49433A5C55736572735C616C6B617A5C4F6E6544726976655C446F63756D656E74735C414D33325F4D554C54495F4D43555C4D63755C663432315C5372635C70686173656F7574732E63000000000B70686173656F7574732E6300000000A5C2D700FFFFFFFF49433A5C55736572735C616C6B617A5C4F6E6544726976655C446F63756D656E74735C414D33325F4D554C54495F4D43555C4D63755C673037315C5372635C70686173656F7574732E63000000000B70686173656F7574732E6300000000B3A6BE00FFFFFFFF42433A5C55736572735C616C6B617A5C4F6E6544726976655C446F63756D656E74735C414D33325F4D554C54495F4D43555C4D63755C673037315C5372635C494F2E630000000004494F2E6300000000EAD6A300FFFFFFFF4C433A5C55736572735C616C6B617A5C4F6E6544726976655C446F63756D656E74735C414D33325F4D554C54495F4D43555C4D63755C673037315C5372635C73746D3332673078785F69742E63000000000E73746D3332673078785F69742E6300000000F6FA7D00FFFFFFFF4A433A5C55736572735C616C6B617A5C4F6E6544726976655C446F63756D656E74735C414D33325F4D554C54495F4D43555C4D63755C663035315C5372635C636F6D70617261746F722E63000000000C636F6D70617261746F722E6300000000B5E99D00FFFFFFFF0100000010000000C5D4F200FFDC7800BECEA100F0A0A100BCA8E1009CC1B600F7B88600D9ADC200A5C2D700B3A6BE00EAD6A300F6FA7D00B5E99D005FC3CF00C1838300CACAD500010000000000000002000000B5010000700000008007000093030000</Data>
</MDITabState>
</MDIClientArea>
<ViewEx>
Expand Down
Loading

0 comments on commit b2b2793

Please sign in to comment.