ARK 12S CAN ESC#36
Draft
AlexKlimaj wants to merge 7 commits into
Draft
Conversation
Update firmware definitions and add RGB LED control functions for G431 Add CAN termination pin definitions and setup function for GPIO control Make FDCAN1 TX/RX pins configurable for ARK CAN ESC The ARK CAN ESC routes FDCAN1_TX to PB9 instead of PA12 used by all other G431 DroneCAN targets. Add CAN_TX_PIN/PORT and CAN_RX_PIN/PORT defines with defaults matching existing PA11/PA12 behavior, and set the ARK target to use PB9 for TX. Make ADC GPIO ports configurable for ARK CAN ESC The ARK CAN ESC has voltage on PB11 (GPIOB) and current on PC3 (GPIOC), unlike other G431 targets which use GPIOA for both. Add VOLTAGE_ADC_PORT and CURRENT_ADC_PORT defines with GPIOA defaults, and use them in ADC_Init() instead of the hardcoded GPIOA. Enable current sensing for ARK CAN ESC Add USE_CURRENT_SENSE to the target definition so the ADC scan sequence includes the current channel. Fix the ADC sequencer length to 3 ranks when USE_CURRENT_SENSE is defined, and set DMA transfer length to match. Without this, only temperature and voltage were scanned, and current telemetry would report garbage. Switch ARK CAN ESC input capture to TIM16_CH1 on PB4 The ARK CAN ESC routes MTR_INPUT to PB4, which cannot be TIM15_CH1 (only PA2 supports that). PB4 AF1 = TIM16_CH1, so switch the G4_E hardware group to USE_TIMER_16_CHANNEL_1. Since TIM16 was the commutation timer (COM_TIMER) for all G431 targets, reassign COM_TIMER to TIM7 for the ARK target using the existing #ifndef override pattern. Add MX_TIM7_Init() and TIM7_IRQHandler for commutation, and wrap the existing TIM15/TIM16 init paths with appropriate #ifdefs. Existing G431 targets are unaffected — they continue using TIM15 for input capture and TIM16 as COM_TIMER. Add CURRENT_OFFSET definition for improved current sensing accuracy Refactor timer reset logic for Dshot DMA functions to improve clarity and maintainability Add EEPROM_START_ADD definition for EEPROM memory management Add RAMP_SPEED definitions and RAMP_DIVIDER macro for improved RPM control dead time 65
Co-authored-by: Jacob Dahl <37091262+dakejahl@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Rebased from AlexKlimaj:jake/12s-can-esc (upstream am32-firmware/AM32#340) onto
ark-release.Adds the ARK_G431_CAN target for the ARK 12S CAN ESC:
Related
Test plan
ARK_G431_CANtarget