Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
108 changes: 108 additions & 0 deletions configs/PULPYF405PRO/config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
/*
* This file is part of Betaflight.
*
* Betaflight is free software. You can redistribute this software
* and/or modify this software under the terms of the GNU General
* Public License as published by the Free Software Foundation,
* either version 3 of the License, or (at your option) any later
* version.
*
* Betaflight is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this software.
*
* If not, see <http://www.gnu.org/licenses/>.
*/

#pragma once

#define FC_TARGET_MCU STM32F405

#define BOARD_NAME PULPYF405PRO
#define MANUFACTURER_ID CUST

#define USE_ACC
#define USE_ACC_SPI_ICM42688P
#define USE_GYRO
#define USE_GYRO_SPI_ICM42688P
#define USE_GYRO_CLKIN
#define USE_MAX7456
#define USE_SDCARD
#define USE_SDCARD_SPI
#define USE_BARO
#define USE_BARO_DPS310

#define BEEPER_PIN PB8
#define MOTOR1_PIN PC6
#define MOTOR2_PIN PC7
#define MOTOR3_PIN PC8
#define MOTOR4_PIN PC9
#define SERVO1_PIN PB0 // Gimbal X
#define SERVO2_PIN PB1 // Gimbal Y
#define SERVO3_PIN PA0 // Gimbal Z
#define LED_STRIP_PIN PA15
#define UART1_TX_PIN PA9
#define UART2_TX_PIN PA2
#define UART3_TX_PIN PB10
#define UART4_TX_PIN PC10
#define UART5_TX_PIN PC12
#define UART1_RX_PIN PA10
#define UART2_RX_PIN PA3
#define UART3_RX_PIN PB11
#define UART4_RX_PIN PA1
#define UART5_RX_PIN PD2
#define I2C1_SDA_PIN PB7
#define I2C1_SCL_PIN PB6
#define LED0_PIN PC2
#define LED1_PIN PC3
#define LED2_PIN PC5
#define SPI1_SCK_PIN PA5
#define SPI2_SCK_PIN PB13
#define SPI3_SCK_PIN PB3
#define SPI1_SDI_PIN PA6
#define SPI2_SDI_PIN PB14
#define SPI3_SDI_PIN PB4
#define SPI1_SDO_PIN PA7
#define SPI2_SDO_PIN PB15
#define SPI3_SDO_PIN PB5
#define SDCARD_SPI_CS_PIN PB12
#define MAX7456_SPI_CS_PIN PA8
#define ESCSERIAL_PIN PC11
#define ADC_VBAT_PIN PC0
#define ADC_CURR_PIN PC1
#define GYRO_1_EXTI_PIN PC4
#define GYRO_1_CS_PIN PA4
#define GYRO_1_CLKIN_PIN PB9

#define TIMER_PIN_MAPPING \
TIMER_PIN_MAP( 0, PB8 , 2, -1) \
TIMER_PIN_MAP( 1, PC6 , 2, 1) \
TIMER_PIN_MAP( 2, PC7 , 2, 1) \
TIMER_PIN_MAP( 3, PC8 , 2, 1) \
TIMER_PIN_MAP( 4, PC9 , 2, 0) \
TIMER_PIN_MAP( 5, PB0 , 2, -1) \
TIMER_PIN_MAP( 6, PB1 , 2, -1) \
TIMER_PIN_MAP( 7, PA0 , 2, -1) \
TIMER_PIN_MAP( 8, PA15, 1, 0) \
TIMER_PIN_MAP( 9, PB9 , 2, -1)
Comment on lines +80 to +92
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot May 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Remove PB9 from timer mapping to avoid gyro clock pin conflict.

PB9 is declared as GYRO_1_CLKIN_PIN (Line 80) and also exposed in TIMER_PIN_MAPPING (Line 92). That creates a dual-role conflict on a critical gyro signal pin.

Proposed fix
 `#define` TIMER_PIN_MAPPING \
     TIMER_PIN_MAP( 0, PB8 , 2, -1) \
     TIMER_PIN_MAP( 1, PC6 , 2,  1) \
     TIMER_PIN_MAP( 2, PC7 , 2,  1) \
     TIMER_PIN_MAP( 3, PC8 , 2,  1) \
     TIMER_PIN_MAP( 4, PC9 , 2,  0) \
     TIMER_PIN_MAP( 5, PB0 , 2, -1) \
     TIMER_PIN_MAP( 6, PB1 , 2, -1) \
     TIMER_PIN_MAP( 7, PA0 , 2, -1) \
-    TIMER_PIN_MAP( 8, PA15, 1,  0) \
-    TIMER_PIN_MAP( 9, PB9 , 2, -1)
+    TIMER_PIN_MAP( 8, PA15, 1,  0)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@configs/PULPYF405PRO/config.h` around lines 80 - 92, The GYRO_1_CLKIN_PIN
macro (GYRO_1_CLKIN_PIN = PB9) conflicts with the TIMER_PIN_MAPPING entry that
also lists PB9; remove PB9 from the timer mapping so the gyro clock pin isn’t
double-assigned. Edit the TIMER_PIN_MAPPING block to eliminate or replace the
TIMER_PIN_MAP(...) entry that references PB9 (the one currently mapping index 9
or the PB9 occurrence), leaving that timer slot with no pin (e.g., use -1) or
choose an alternate unused pin, ensuring only GYRO_1_CLKIN_PIN uses PB9.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The gyro clock pin requires a timer assignment.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ot0tot, thank you for the clarification! You're absolutely right — when USE_GYRO_CLKIN is enabled, the firmware needs to drive a clock signal to the gyro via a timer output, so having PB9 in both GYRO_1_CLKIN_PIN and TIMER_PIN_MAPPING is intentional and required for correct operation. My concern was mistaken. I'll disregard this comment.

(◕‿◕✿)


✏️ Learnings added
Learnt from: ot0tot
Repo: betaflight/config PR: 1099
File: configs/PULPYF405PRO/config.h:80-92
Timestamp: 2026-05-08T01:40:09.346Z
Learning: In Betaflight board configurations (betaflight/config), when `USE_GYRO_CLKIN` is defined and a `GYRO_1_CLKIN_PIN` is assigned, that same pin **must** also appear in `TIMER_PIN_MAPPING`. The timer entry is required so the firmware can drive a clock signal to the gyro via a timer/PWM output. Having the CLKIN pin in both `GYRO_1_CLKIN_PIN` and `TIMER_PIN_MAPPING` is intentional and correct — it is not a dual-role conflict. Do not flag this as an issue during code review.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.


🧠 Learnings used
Learnt from: haslinghuis
Repo: betaflight/config PR: 1051
File: configs/DEEPSPACEF722MINI/config.h:35-35
Timestamp: 2026-03-15T13:09:34.824Z
Learning: In Betaflight board configuration reviews, when a target is a rebranding of an existing hardware design (e.g., Skystar targets rebranded to Deepspace), you may retain deprecated components (e.g., BMI270 gyro) in the configuration to maintain hardware compatibility. The deprecation policy applies only to genuinely new target submissions, not to rebrands of already-produced hardware. This guidance should be checked whenever reviewing config.h files under betaflight/config and any rewritten or renamed targets that are rebrands.

Learnt from: osirisinferi
Repo: betaflight/config PR: 1072
File: configs/PILOTIXF405V3BF/config.h:89-91
Timestamp: 2026-04-23T14:45:46.186Z
Learning: In Betaflight board configuration reviews, ensure `config.h` only overrides settings when the value differs from the firmware/platform defaults. Do not define macros solely to repeat the default value (e.g., adding a `#define` that matches the default behavior). When the default behavior is acceptable, omitting the corresponding macro (for example, omitting `PINIO3_CONFIG` when the default behavior suffices) should not be flagged as a review issue. Reviewers should focus on meaningful overrides vs. redundant default-redefinitions.



#define ADC_INSTANCE ADC3
#define ADC3_DMA_OPT 1
#define DEFAULT_BLACKBOX_DEVICE BLACKBOX_DEVICE_SDCARD
#define BARO_I2C_INSTANCE I2CDEV_1
#define MAG_I2C_INSTANCE I2CDEV_1
#define DEFAULT_DSHOT_BITBANG DSHOT_BITBANG_OFF
#define DEFAULT_CURRENT_METER_SOURCE CURRENT_METER_ADC
#define DEFAULT_VOLTAGE_METER_SOURCE VOLTAGE_METER_ADC
#define BEEPER_INVERTED
#define SYSTEM_HSE_MHZ 8
#define SDCARD_SPI_INSTANCE SPI2
#define MAX7456_SPI_INSTANCE SPI3
#define GYRO_1_SPI_INSTANCE SPI1
//#define GYRO_1_ALIGN CW270_DEG
Loading