Adding a PositionAPI#149
Conversation
Signed-off-by: Jean Alinei <jean.alinei@owntech.org>
|
Matching example to try this new API : |
Review of the PositionAPISome changes were made to the API to accomodate needs for the encoder. (described below) The code that was tested is in the branch: https://github.com/luizvilla/Core/tree/Regression_testing_position_API Encoder testingOn open-loop control, here is the result from the encoder: The open loop control is available by using the 'l' key and the 'p'. You can then raise the 'vq_ol' reference and the 'omega_ol'
_Open-loop test of the encoder_
The sub-plot on the bottom shows two triangles, a red and a gray one.
The triangles have the same shape, and a phase shift. This is expected behaviour as the code is creating the phase. |
|
Hall testing did not work with this code. I'm reverting everything and verifying again. |
Steps
The example does not compile out of the box due to an extra file:
It has to be removed. For now the original Hall sensor code does not work. I looked up the signals on the board and the hall sequence. I have B working and A/C always at zero.
_A and C seen with two probes on the SPIN_
I've patched the Position API to see the raw signals during a full revolution: A = 0, B=1 (oscillates) and C = 0. There is a problem with signals A and C on my implementation. I've swapped the gpios on the ownverter overlay with :
PINS 7 and 49 are not working as of now. I found the specific part of the API that handles the pins: Solved by changing the way the data is parsed from the ownverter overlay. Currently it does Which parses the giving to 7 = 6, 9 = 7 and 49 = 2 With the fix, it will no longer drop the |
|
Sequence matching (for later) I will test the positions to verify it works as follows (R = Red cable, W = white cable, B = black cable)
We ran a series of tests with @jalinei using the original code. |
Current state of advancementI made a series of commits on my I have added:
abz: incremental-encoder {
compatible = "shield-position-abz";
position-sensor-name = "ABZ";
motor = <&default_motor>;
direction-sign = <1>;
electrical-offset = <0x00000000>;
timer = <&timers3>;
counts-per-revolution = <1024>;
index-present = <1>;
index-polarity = "INVERTED";
index-configuration = "A_HIGH_B_HIGH";
status = "okay";
};
|
|
I have created a library of examples for the OwnVerter, several of which uses the position API. https://github.com/luizvilla/examples/tree/new_OWT_examples They require using the https://github.com/luizvilla/Core/tree/positionAPI_corrected Testing procedure:
owntech_examples = https://github.com/luizvilla/examples.git#new_OWT_examples
have fun! |
|
With all the previous messages you have:
Hope it helps |




So far we add a sensorAPI oriented for ADC measurement only, but it was not covering the external position sensors that can be attached to an ownverter for instance.
In this PR, we address that issue so that one could use
With the same generic calls.
Specific dts fragments and bindings have been added to cover the required hardware informations.
Shields overlays now encompass timer definitions for AB index sensors. (Legacy implementation relied on spin.dts to define the pinout)
My proposal is to test against the FOC example modified to use that API. From there, the same example should be usable with one of these 3 sensors in an agnostic way. (except choosing the right sensor and providing motor info from app.overlay).