From 7dfe91b52373fec8eb1579c951b0de5405f9c457 Mon Sep 17 00:00:00 2001 From: Egor Savkin Date: Wed, 25 Sep 2024 13:36:18 +0800 Subject: [PATCH] Fix stabilizer formatting Signed-off-by: Egor Savkin --- src/hw/stabilizer.md | 49 +++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 26 deletions(-) diff --git a/src/hw/stabilizer.md b/src/hw/stabilizer.md index 74df2f9..5ee37fd 100644 --- a/src/hw/stabilizer.md +++ b/src/hw/stabilizer.md @@ -14,17 +14,19 @@ Not present in the JSON. You can get the firmware from [Hydra](https://nixbld.m-labs.hk/jobset/mcu/mcu-contrib). -* ``stabilizer-dual-iir`` supports Pounder v1.2 - probably you should flash this one, -* ``stabilizer-dual-iir-pounder_v1_0`` supports Pounder 1.0 and 1.1 (legacy), -* ``stabilizer-lockin`` is a different application which we do not usually flash. +* `stabilizer-dual-iir` supports Pounder v1.2 - probably you should flash this one, +* `stabilizer-dual-iir-pounder_v1_0` supports Pounder 1.0 and 1.1 (legacy), +* `stabilizer-lockin` is a different application which we do not usually flash. These all include changes to the mainline code to include Pounder telemetry. ### Building (optional) -Please keep in mind that the firmware from the official Quartiq repository does not include support for Pounder in MQTT, you may need to use a fork for that. But if the stabilizer is without a Pounder, it's also a valid option. +Please keep in mind that the firmware from the official Quartiq repository does not include support for Pounder in MQTT, +you may need to use a fork for that. But if the stabilizer is without a Pounder, it's also a valid option. -There is no Nix Flake support to make things easier, so you need to set up rust and cargo manually. Start with cloning the stabilizer repository and opening a new shell with dfu-util (for flashing) and rustup (for building). +There is no Nix Flake support to make things easier, so you need to set up rust and cargo manually. +Start with cloning the stabilizer repository and opening a new shell with dfu-util (for flashing) and rustup (for building). ``` nix-shell -p dfu-util rustup @@ -62,35 +64,30 @@ With newer firmware with USB serial console: 1. Connect the Stabilizer to power. 2. Connect USB cable to the Stabilizer. -3. Run ``nix-shell -p python312Packages.pyserial``. -4. Run ``python -m serial /dev/ttyACM0`` to connect the serial port using ``pyserial``. -5. Input ``platform dfu`` in the console. -6. Run ``nix-shell -p dfu-util``. - -And for both: - -5. The device is now in DFU mode. -6. Flash the device with the following command: - -``` -dfu-util -a 0 -s 0x08000000:leave -R -D stabilizer-dual-iir.bin -``` - +3. Ensure you have `pyserial` module either with `nix-shell -p python312Packages.pyserial` for NixOS users + or using `pip install pyserial` if you are using venv. +4. Run `python -m serial /dev/ttyACM0` to connect the serial port using `pyserial`. +5. Input `platform dfu` in the console. +6. Once the device is now in DFU mode, flash the device with the following command (needs `nix-shell -p dfu-util`): + ``` + dfu-util -a 0 -s 0x08000000:leave -R -D stabilizer-dual-iir.bin + ``` 7. Look for "File downloaded successfully". -For normal usage, the stabilizer must be configured with USB console later (try ``help`` command first), to set its IP address and MQTT broker address. However, for general testing (like the one below), you don't need to configure it any further. +For normal usage, the stabilizer must be configured with USB console later (try `help` command first), +to set its IP address and MQTT broker address. However, for general testing (like the one below), you don't need to +configure it any further. ### Clearing settings -In case someone sets some setting wrongly, or updates the firmware and suddenly there's an incompatibility, you may find (firmware, not yourself) in a state of panic, where it will not allow you to change the settings back. +In case someone sets some setting wrongly, or updates the firmware and suddenly there's an incompatibility, +you may find (firmware, not yourself) in a state of panic, where it will not allow you to change the settings back. 1. Get into DFU mode (described above), probably with jumper method. 2. Use dfu-util to clear the flash completely: - -``` -dfu-util -a 0 -s 0x08000000:mass-erase:force:leave -``` - + ``` + dfu-util -a 0 -s 0x08000000:mass-erase:force:leave + ``` 3. Reflash the target firmware. ## Testing