# 6010 48V Motor Driver Final Runnable Package

This is the short-path final release package. It is intended to avoid Windows MAX_PATH copy/extract errors.

## Quick flash

Use STM32CubeProgrammer and program:

`MPS_FOC/SafeTestOutput/final_48v.hex`

Target MCU: STM32G474RBT6  
Bus voltage used in final validation: 48 V  
PWM: 20 kHz center-aligned complementary TIM1 PWM  
Dead-time: about 3 us  
Driver: 3 x MP1921 half-bridge gate drivers  
Motor: 6010 joint motor, 14 pole pairs, built-in 8:1 reduction  
Encoder: MA600 SPI1, 14 bit  
Protection: PB12/TIM1_BKIN, ADC current checks, software ALL-OFF, X stop

## Serial commands

Serial: 115200, 8N1, text mode.

1. `H` : preflight, bus off, outputs off
2. `Z` : zero current calibration
3. `A30` : arm output-side +30 degree relative position command
4. `B30` : arm output-side -30 degree relative position command
5. `Y` : confirm armed command
6. `X` : immediate all-off

Angle commands use output-side degrees after the 8:1 reduction. Valid range is A1..A360 and B1..B360.

## Source layout

The final source has already been placed into the normal CubeIDE source path:

- `MPS_FOC/Core/Src/main.c` : final unified speed + position control source
- `MPS_FOC/Core/Src/tim.c` : final TIM1/BKIN/dead-time initialization source

For reference, the same final files are also copied to:

- `MPS_FOC/SafeTestBuild/final_main_48v.c`
- `MPS_FOC/SafeTestBuild/tim_break_filter_init.c`

## Build

Open/import `MPS_FOC` with STM32CubeIDE and build the project. The final source is already installed as `Core/Src/main.c`, so no manual replacement is required.

If you only need to run the tested firmware, flash `final_48v.hex` directly.

## Notes

This package intentionally removes historical long-name intermediate test scripts from the final delivery package. The complete historical archive remains in the development workspace, but this package is the one intended for copying, sending, importing, and flashing.
