Chat

Welcome to Flux

Treat Flux like your intern. Tell it what you'd like to build and it'll get to work. You can also ask it questions, brainstorm ideas, and teach it your preferences. Learn More

Explain project
Write a project description
Find schematic issues
Create a test plan
Simulate a circuit
Prepare for Manufacturing
Component Selection Workflow
New Subsystem Wizard
Write I2C initialization code
Generate firmware skeleton

Refine this doc
Ask about this doc
Firmware Starter
Scope
Starter notes for firmware running on U2, the STM32L433 host MCU in the NewFEEDER project.
Current pin mapping
Power, reset, and debug

Table


FunctionMCU pinConnected hardware / netNotes
ResetNRSTNRSTExternal reset network and debug header
SWDIOPA13SWDIO_MCUSWD programming / debug
SWCLKPA14SWCLK_MCUSWD programming / debug
SWOPB3SWOOptional trace output
USB D-PA11USB_DMNative USB FS DFU / update port
USB D+PA12USB_DPNative USB FS DFU / update port
Modem control and DFU interface

Table


FunctionMCU pinConnected hardware / netNotes
MODEM_AUX_ENPA0MODEM_AUX_ENModem auxiliary enable / control
MODEM_DFU_BOOTPA1MODEM_DFU_BOOTModem boot / mode control
MODEM_DFU_RESETPA2MODEM_DFU_RESETModem reset control
MODEM_DFU_TX_TO_STMPA3MODEM_DFU_TX_TO_STMFrom modem to MCU
MODEM_DFU_RX_FROM_STMPA4MODEM_DFU_RX_FROM_STMFrom MCU to modem
Camera interface

Table


FunctionMCU pinConnected hardware / netNotes
SPI SCLKPA5CAM_SCLK -> U7 pin 3External camera clock
SPI MISOPA6CAM_MISO -> U7 pin 4Camera data to MCU
SPI MOSIPA7CAM_MOSI -> U7 pin 5Camera data from MCU
Camera CSPB0CAM_CS -> U7 pin 6Dedicated camera chip select
Ultrasonic and I2C peripherals

Table


FunctionMCU pinConnected hardware / netNotes
Ultrasonic RXPB10ULTRASONIC_UART_RXUART to U6
Ultrasonic TXPB11ULTRASONIC_UART_TXUART to U6
I2C SCLPB6I2C1_SCLShared I2C bus
I2C SDAPB7I2C1_SDAShared I2C bus
IR illuminator control

Table


FunctionMCU pinConnected hardware / netNotes
IR illuminator enablePB12IR_ILLUM_EN_L -> R24 -> Q3 gateActive low high-side switch control
External illuminated pushbutton interface

Table


FunctionMCU pinHardware / netNotes
External pushbutton inputPC13EXT_BTN_N from J7 through R26, with R25 pull-up, C31 filter, and D10 ESD clampActive-low user input; keep as input-only because PC13-PC15 have restricted output-drive use on STM32L433
External pushbutton LED controlPB13EXT_BTN_LED_EN to R27 -> Q4 gate, with R28 pull-downDedicated output driving a low-side MOSFET; LED remains off by default during reset
External pushbutton connector pinout
  • Dedicated connector: J7
  • Pin 1 = GND
  • Pin 2 = 5V_MODEM LED supply
  • Pin 3 = EXT_BTN_RAW / button sense from the switch contact
  • Pin 4 = EXT_BTN_LED_RETURN_SW switched LED return from Q4
Required firmware convention for the pushbutton
  • Configure PC13 as a pulled-up input and interpret low = button pressed.
  • Configure PB13 as a push-pull output and drive it low during early boot so Q4 stays off.
  • Drive PB13 high only when the external pushbutton LED should turn on.
  • The off-board button LED supply is sourced from 5V_MODEM, while Q4 still lets firmware switch the LED on and off from U2 PB13.
IR illuminator behavior
  • Combined external camera and IR connector: U7
    • Pin 1 = GND
    • Pin 2 = 3V3_MCU
    • Pin 3 = CAM_SCLK
    • Pin 4 = CAM_MISO
    • Pin 5 = CAM_MOSI
    • Pin 6 = CAM_CS
    • Pin 7 = IR_ILLUM_3V3_SW
    • Pin 8 = GND
  • High-side switch: Q3 P-channel MOSFET
  • Default-off bias: R23 pulls the MOSFET gate up to 3V3_MCU
  • Gate series resistor: R24
Required firmware convention
Because the control is active low:
  • Drive PB12 low to turn the IR illuminator on
  • Drive PB12 high to turn the IR illuminator off
  • During early boot, initialize PB12 as a push-pull output and write it high before enabling any feature that could blink or repurpose the pin
  • Before entering sleep or standby, drive PB12 high so the illuminator rail is disabled
Suggested initialization order
  1. Initialize clocks and system tick.
  2. Configure debug-safe GPIO defaults.
  3. Configure PB12 as output-high so the IR illuminator stays off.
  4. Configure PB13 as output-low so the external pushbutton LED stays off, and configure PC13 with its inactive pull-up before enabling any interrupt on the button input.
  5. Bring up the modem control GPIOs.
  6. Initialize I2C1 on PB6/PB7.
  7. Initialize SPI for the camera on PA5/PA6/PA7 with PB0 as chip select.
  8. Initialize the ultrasonic UART on PB10/PB11.
  9. Initialize USB DFU / USB device support if needed.
Suggested GPIO setup snippet

C


// Pseudocode
write_gpio(PB12, 1);          // active-low control, so HIGH = OFF
configure_output(PB12);

void ir_illum_set(bool enable)
{
    write_gpio(PB12, enable ? 0 : 1);
}
Main loop / power-state guidance
  • Keep the IR illuminator off by default.
  • Enable it only around image capture windows where the camera requires illumination.
  • Turn it off immediately after the capture window completes.
  • In any sleep, stop, or standby entry path, explicitly force PB12 high first.
  • If wake-up code reconfigures GPIOs, restore PB12 high before re-enabling peripherals.
Build and flash notes
  • MCU: STM32L433
  • Recommended toolchains: STM32CubeIDE, STM32CubeMX-generated HAL project, or PlatformIO with STM32 target support.
  • Primary programming interfaces:
    • SWD through the debug header
    • USB DFU through the native USB FS connection when firmware enables it
Bring-up checklist
  • Verify PB12 idles high after reset.
  • Verify U7 pin 7 is 0 V in reset / sleep and 3.3 V only when PB12 is driven low.
  • Verify camera SPI still operates correctly with the IR rail disabled.
  • Verify modem and ultrasonic interfaces remain unaffected when the IR illuminator is switched on and off.
  • Verify PC13 idles in the inactive state with the harness connected and changes state only on button press.
  • Verify PB13 powers up in the LED-off state and only enables the off-board LED through its dedicated driver stage.

    Scope

    Current pin mapping

    Power, reset, and debug

    Modem control and DFU interface

    Camera interface

    Ultrasonic and I2C peripherals

    IR illuminator control

    External illuminated pushbutton interface

    External pushbutton connector pinout

    Required firmware convention for the pushbutton

    IR illuminator behavior

    Required firmware convention

    Suggested initialization order

    Suggested GPIO setup snippet

    Main loop / power-state guidance

    Build and flash notes

    Bring-up checklist

Documents

    Firmware Starter

    Connector Orientation Review

    Project Specification

    Design Notes

Assets

kicad_mod

MDT420E01001 / Blues Notecard M.2 Key E footprint

J-75-0050-MOS-M2-E.kicad_modFootprint
kicad_mod

Corrected 2.7mm NPTH footprint for Würth 9774025151R / MH1 standoff

FORO-0270-U.kicad_modFootprint
FeederPilot_May262026 thumbnail
DeerFeeder controller with cellular connectity and sensors

Properties

Pricing & Availability

Distributor

Qty 1

Arrow

$20.66–$33.49

Digi-Key

$36.63–$42.87

HQonline

$8.38–$8.58

LCSC

$39.89–$41.47

Mouser

$72.52–$73.03

TME

$14.63–$14.78

Verical

$12.15–$451.86

Controls