Skip to content

Commit

Permalink
Updated docs, GP and Nuklear sources.
Browse files Browse the repository at this point in the history
  • Loading branch information
rombrew committed Dec 10, 2024
1 parent 52cd2d3 commit 5d04bbc
Show file tree
Hide file tree
Showing 40 changed files with 8,247 additions and 5,150 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ There are a few videos about PMC on [youtube](https://www.youtube.com/@romblv).
- Least Squares estimate library
[LSE](https://github.com/rombrew/lse).


- Phase current sampling scheme includes two or three sensors configuration
with inline or low-side placement.
- Self-adjustment of all onboard measurements (current and voltage) along
Expand Down
17 changes: 9 additions & 8 deletions doc/CommandLineInterface.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
## Overview

This page introduces you to the Command Line Interface (CLI). We have a regular
CLI with autocompletion function and command history.
The main control interface of PMC is Command Line Interface (CLI). We have a
regular UNIX-like CLI with autocompletion function and command history.
Depending on the hardware it is available on USART, USB and CAN interface.

## Key mapping

Expand All @@ -12,10 +13,10 @@ These are the basic special keys that are used in the CLI:
- `Tab` or (@) - Automplete function.
- `Shift` + `Tab` - Automplete function reverse.
- `Ctrl` + `C` or `Ctrl` + `D` - Drop the content of the line or abort the command.
- `Ctrl` + `P` or `Up` or `*` - History function scroll up.
- `Ctrl` + `N` or `Down` or `!` - History function scroll down.
- `Ctrl` + `P` or `Up` - History function scroll up.
- `Ctrl` + `N` or `Down` - History function scroll down.

## Register file
## Register concept

A register is a scalar variable known by its name and having associated
attributes. All registers together are called the register file. This is a
Expand All @@ -31,7 +32,7 @@ command.
- You can specify a register number instead of its name to refer the exactly
one register.

Something like that.
Try something like that.

(pmc) reg <pattern> <value>
(pmc) reg <ID> <value>
Expand Down Expand Up @@ -88,7 +89,7 @@ Command to grab telemetry into RAM and flush textual dump.
(pmc) tlm_grab <rate>
(pmc) tlm_flush_sync

Run in endless loop of grabbing until PMC stops with error.
Run in endless loop of grabbing until PMC stops with an error.

(pmc) tlm_watch <rate>

Expand Down Expand Up @@ -162,7 +163,7 @@ Show instant analog knob input voltages.
(pmc) reg ap.knob_in_ANG
(pmc) reg ap.knob_in_BRK

Enable the HX711 helper task.
Enable the HX711 helper application.

(pmc) reg ap.task_HX711 1

File renamed without changes.
8 changes: 5 additions & 3 deletions doc/GettingStarted.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ erased MCU) then short BOOT pin to +3.3v before the power up.
+--/ --+
```

**WARNING**: You also can use an USB connection if your hardware has one.
**WARNING**: You also can use an USB connection if your hardware has one. Refer
to your hardware manual or look into `src/hal/hw/...` directory to find out
available serial interfaces.

## Software

Expand Down Expand Up @@ -94,7 +96,7 @@ files by `mkconfig` python script before build.
$ ./mkconfig
$ make HWREV=PHOBIA_rev5

## Load
## MCU flash

There are several ways to load the firmware into the MCU.

Expand Down Expand Up @@ -147,7 +149,7 @@ for setting PMC up.
- [Hardware VESC](HardwareVESC.md)
- [Integrity Self Test](IntegritySelfTest.md)
- [Machine Probe](MachineProbe.md)
- [Machine Tuning](MachineTuning.md)
- [Control Tuning](ControlTuning.md)
- [High Frequency Injection](HighFrequencyInjection.md)
- [Input Analog Knob](InputAnalogKnob.md)
- [Input Pulse Width](InputPulseWidth.md)
Expand Down
3 changes: 2 additions & 1 deletion doc/GraphicalUserInterface.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
## Overview

This page introduces you to the Phobia Graphical User Interface (PGUI). We have
a regular GUI application.
the regular GUI front-end application that communicates with PMC via serial
interface.

## TODO

2 changes: 1 addition & 1 deletion doc/HardwareDesign.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ uncertainty in the output voltage `DTu` expressed as follows.
The voltage divider (R1, R2) and filter capacitor (C1) are used to measure the
terminal voltage (uA, uB, uC) and supply voltage (uS). This RC scheme forms an
exponential integrator that allows us to restore the pulse width by measured
voltage. Additional resistor R3 can be used to bias the zero volatege into the
voltage. Additional resistor R3 can be used to bias the zero voltage into the
linear region. You can skip the terminal voltage sensing if you do not need
related features but supply voltage measuring is mandatory.

Expand Down
2 changes: 1 addition & 1 deletion doc/HardwareVESC.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ You are also welcome to look into `src/hal/hw/...` directory to get a full
actual information about specific hardware port.

You can build the firmware binary yourself from sources or get it from the
bundle releases.
bundle [resleases](https://github.com/rombrew/phobia/releases).

$ cd phobia/src
$ make HWREV=MKESC_60100_v2
Expand Down
4 changes: 2 additions & 2 deletions doc/IntegritySelfTest.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
This page describes how to verify the electrical integrity of PMC hardware.

**WARNING**: The procedures listed here are MUST DO in case of new hardware
first powerup.
first power up.

## Automated Self Test

Expand All @@ -16,7 +16,7 @@ This test does the following steps in this order.

- Get current sensors zero drift and check it is within the acceptable range.
- Check actual bootstrap retention time and compare with configuration.
- Check the power stage responds to the control.
- Check the power stages respond to the control.
- Check measurement accuracy against the distortion introduced by PWM.

You can do it with or without machine connected. Ignore the appropriate error
Expand Down
39 changes: 28 additions & 11 deletions doc/MachineProbe.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,13 @@ you will need to decrease probing currents for a small machine.
If you use power supply that not tolerate reverse current then pay attention to
the wattage limit settings.

(pmc) reg pm.watt

- `pm.watt_wA_reverse` - Maximal reverse current on DC link.
- `pm.watt_uDC_maximal` - Maximal overvoltage on DC link.

Also do not forget to reset the machine parameters if you have previously run
another machine.

(pmc) pm_default_probe
(pmc) pm_default_machine

## Sensors adjustment

Expand Down Expand Up @@ -101,7 +99,8 @@ to reach this condition.
(pmc) pm_probe_spinup

If the procedure fails to spinup the machine try to adjust forced control
parameters. Also you can specify Kv manually if you know it exactly.
parameters. Also you can specify Kv manually if you know it exactly and Zp
number is already configured correcly.

(pmc) reg pm.const_lambda_kv <rpm/V>

Expand All @@ -110,6 +109,7 @@ speed and request lambda probing manually. Do not load the machine at this.

(pmc) pm_fsm_startup
(pmc) reg pm.s_setpoint_rpm <rpm>
...
(pmc) pm_probe_const_flux_linkage

## No forced spinup
Expand All @@ -124,21 +124,38 @@ PMC will wait for the machine to reach at least `pm.zone_threshold` speed.

## Speed noise threshold

After a flux linkage we estimate speed noise level to know the lower bound of
flux observer operation. As a result these threshold values are calculated.
In case of you use `pm_probe_spinup` after a flux linkage we estimate speed
noise level to know the lower bound of flux observer operation. As a result
these threshold values are calculated.

(pmc) reg pm.zone_noise
(pmc) reg pm.zone_threshold

If you have estimated flux linkage in detached mode or specified Kv manually
you should probe the noise threshold manually when the machine is in run.

(pmc) pm_fsm_startup
(pmc) reg pm.s_setpoint_rpm <rpm>
...
(pmc) pm_probe_noise_threshold

## Moment of inertia

Final estimate is a moment of inertia `pm.const_Ja`. To do this possible a
speed maneuver will be performed. Note that this may result energy regeneration
so your power supply must tolerate this. Either you should limit maximal DC
link current reverse as stated above.
In case of you use `pm_probe_spinup` the final estimate is a moment of inertia
`pm.const_Ja`. To do this possible a speed maneuver will be performed. Note
that this may result energy regeneration so your power supply must tolerate
this. Either you should limit maximal DC link current reverse as stated above.

This constant is used to tune speed control loop. Also it is used in operation
to predict the speed changes from an applied current.
to predict the speed changes from an applied current and so on.

If you have estimated flux linkage in detached mode or specified Kv manually
you should probe the moment of inertia manually.

(pmc) pm_fsm_startup
(pmc) reg pm.s_setpoint_rpm <rpm>
...
(pmc) pm_probe_const_inertia

## See also

Expand Down
19 changes: 11 additions & 8 deletions doc/NetworkCAN.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,22 @@ TODO
conventional two wire bus
uses a linear bus terminated at each end

+------------------------*--------------------
| |
| +------------------|-----*--------------
| | | |
+------|-----|------+ +------|-----|------+
| CAN_H CAN_L | | CAN_H CAN_L | ...
| | | |

+-------------------------*------------------~~~
| |
| +------------------|------*-----------~~~
| | | |
+------+------+------+ +------+------+------+
| CAN_H CAN_L | | CAN_H CAN_L | ...
| | | |
| PMC (node 1) | | PMC (node 2) |

## Protocol

We use base frame format with 11-bit identifier.

+---------------+-------------+------------------------+
| ID (11-bit) | N (4-bit) | payload (64-bit) |
+---------------+-------------+------------------------+

## Network survey

Expand Down
Loading

0 comments on commit 5d04bbc

Please sign in to comment.