Fix stabilizer formatting

Signed-off-by: Egor Savkin <es@m-labs.hk>
This commit is contained in:
Egor Savkin 2024-09-25 13:36:18 +08:00
parent 746ba53dab
commit 7dfe91b523

View File

@ -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