Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

External Sensor support (prerelease) #338

Merged
merged 160 commits into from
Apr 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
160 commits
Select commit Hold shift + click to select a range
37d9f55
rename encoder to sensor
yconst Oct 10, 2023
8d05300
initial spec refactor
yconst Oct 10, 2023
332a16f
Merge branch 'develop' into sensor_support
yconst Oct 21, 2023
a34ece7
rename to sensor
yconst Oct 28, 2023
f3203bf
refactor sensor
yconst Oct 28, 2023
4a3787e
refactor sensors for modularity
yconst Oct 29, 2023
43d852b
update sensor and observer structure
yconst Nov 8, 2023
9ca2e55
revise sensor initialization
yconst Nov 9, 2023
a455f0a
add observer init
yconst Nov 10, 2023
b8a6722
fix init routine
yconst Nov 10, 2023
f45279d
minor refactor of sensor
yconst Nov 10, 2023
3b63811
rename sensor folder
yconst Nov 12, 2023
aa7dd9a
update spec
yconst Nov 14, 2023
6463a73
fix import
yconst Nov 14, 2023
ff9831d
rename encoder to sensor
yconst Nov 14, 2023
065c6e8
update protocol
yconst Nov 16, 2023
7dff995
format function name
yconst Nov 16, 2023
4444d8d
refactor sensor structure
yconst Nov 16, 2023
aaf3ff5
fix import
yconst Nov 17, 2023
9b2199e
implement missing struct
yconst Nov 17, 2023
4f92df5
refactor sensor update loop
yconst Nov 17, 2023
9c8c9e9
rename variable
yconst Dec 6, 2023
fd35d32
implement sensor interfaces
yconst Dec 6, 2023
bc4130d
cxx file associations
yconst Dec 6, 2023
f6246d3
update interface functions and summary
yconst Dec 6, 2023
3ff0abd
update protocol
yconst Dec 9, 2023
957d072
implement some missing functions
yconst Dec 9, 2023
4e5a4c0
add compatibility flags
yconst Dec 10, 2023
dd803b9
align function name with standard
yconst Dec 10, 2023
034fd62
align implementations with multi-sensor support
yconst Dec 10, 2023
8572f36
minor fixes
yconst Dec 11, 2023
c0ac69a
delete duplicate definition
yconst Dec 11, 2023
3fc28d9
various misnaming fixes
yconst Dec 22, 2023
72871cb
builds
yconst Dec 23, 2023
df02b22
add instrumentation timer for debug
yconst Dec 29, 2023
62eb2b4
update includes
yconst Dec 29, 2023
aa8f43b
introduce separate interface header and source file for access to sen…
yconst Dec 29, 2023
64ae2cd
update imports
yconst Jan 1, 2024
f331175
refactor sensor structure
yconst Jan 1, 2024
de23e09
make offset and pole pair calibration sensor-generic
yconst Jan 5, 2024
6a96b18
add as5047 sensor
yconst Jan 5, 2024
ab7998d
minor fixes
yconst Jan 5, 2024
89e8209
set initialize variable on init
yconst Jan 9, 2024
ca0b037
default values for the sensors struct
yconst Jan 9, 2024
65e7b26
fix timer frequency
yconst Jan 9, 2024
32c7f79
Change sensor bits to 16
yconst Jan 10, 2024
03c2b44
consolidate sensor return types
yconst Jan 10, 2024
15b4f3b
fix typo
yconst Jan 11, 2024
f354bf1
remove unused function
yconst Jan 25, 2024
44cdd48
implement more initialization functions
yconst Jan 25, 2024
91a7ff3
refactor sensor initialization
yconst Jan 28, 2024
997d260
fix size of returned firmware version
yconst Jan 31, 2024
6247424
add new bootloader definition
yconst Feb 2, 2024
47afcec
fix erroneous functions pointers
yconst Feb 3, 2024
f14bbb0
update SPI config
yconst Feb 3, 2024
812b660
allow setting clock multiplier in SPI init HAL
yconst Feb 3, 2024
70a630a
add SPI mode mini cheat sheet
yconst Feb 3, 2024
8e86d26
add raw sensor angle reporting to device spec
yconst Feb 3, 2024
155e5cf
use pointer to each sensor pointer
yconst Feb 3, 2024
957a9df
add fw_version bootloader endpoint
yconst Feb 3, 2024
902408a
add size of config object
yconst Feb 4, 2024
542c0f1
basic sensor working with m5
yconst Feb 4, 2024
0f74d15
update DFU script to support DFU fw 1.1.x
yconst Feb 4, 2024
4860a57
update enums
yconst Feb 6, 2024
b6f5ac9
fix sensor sector calculation
yconst Feb 6, 2024
b4c5fca
set value of dropdown control
yconst Feb 6, 2024
d5e382d
introduce common sensor resolution
yconst Feb 7, 2024
24a2d36
introduce new transformations system to transform between different r…
yconst Feb 12, 2024
84a3c48
revise transforms
yconst Feb 13, 2024
fdfd668
Merge pull request #323 from tinymovr/develop
yconst Feb 17, 2024
9cab553
Merge branch 'master' into sensor_support
yconst Feb 17, 2024
2e5658a
move to header
yconst Feb 25, 2024
ef51d9a
use 1 to 1 transform for commutation
yconst Feb 25, 2024
5de6b0d
remove unneeded onversion
yconst Feb 25, 2024
eb1b579
promote data types
yconst Feb 25, 2024
1f8b4f2
enforce minimum trip current value
yconst Feb 25, 2024
b41a79d
refactor calibration routines
yconst Feb 25, 2024
1987fd4
update copyright
yconst Feb 27, 2024
631a700
update m5.2 pinouts
yconst Feb 27, 2024
4836bc2
Merge pull request #325 from tinymovr/docs/M5.2-pinouts
yconst Feb 27, 2024
8ca213e
remove spec
yconst Feb 28, 2024
6f00b83
update manifest
yconst Feb 28, 2024
02f9a59
add spec hash aliasing
yconst Feb 28, 2024
76b6051
Merge pull request #326 from tinymovr/studio/hash_hotfix
yconst Feb 28, 2024
9e340fd
integrate reference frames diagram
yconst Mar 2, 2024
07e1d81
add references
yconst Mar 3, 2024
46c52d5
Merge branch 'develop' into sensor_support
yconst Mar 12, 2024
84cbff9
Merge branch 'master' into sensor_support
yconst Mar 12, 2024
b5142c2
add files
yconst Mar 13, 2024
85d1d79
fix accessor
yconst Mar 13, 2024
2f2f1db
fix calibration frame issues
yconst Mar 13, 2024
f9ef80f
init with default transforms
yconst Mar 13, 2024
eef606c
fix eccentricity and frames calibration
yconst Mar 13, 2024
47c2275
update transform library
yconst Mar 14, 2024
3d3d683
make struct extern
yconst Mar 14, 2024
7bed2fe
add back dwt counter
yconst Mar 15, 2024
f017b31
disable reading the peripheral at every cycle
yconst Mar 15, 2024
21fd6d6
only prepare sensor once
yconst Mar 15, 2024
f8f9cbe
remove unused timer
yconst Mar 15, 2024
6b24466
add load endpoint to spec
yconst Mar 15, 2024
768a0ea
fix transforms
yconst Mar 15, 2024
8b7678a
make const
yconst Mar 17, 2024
7714f35
fix velocity limiting issue
yconst Mar 17, 2024
91cc22d
make const
yconst Mar 17, 2024
eea5497
rename can state struct
yconst Mar 17, 2024
7b7532c
update spec with new function signatures
yconst Mar 18, 2024
ca485cb
consolidate ref frame updates
yconst Mar 18, 2024
1a43b34
update docs with transform explanation
yconst Mar 18, 2024
28dbe88
elaborate on sensor setup
yconst Mar 19, 2024
df2f081
optimize some operations
yconst Mar 19, 2024
a97c99d
increase ssp rate for external sensor
yconst Mar 19, 2024
cac39ee
enable inverter before proceeding
yconst Mar 19, 2024
6365ae2
fix hall sector count
yconst Mar 20, 2024
784ec63
report hall angle as full circle in ticks
yconst Mar 20, 2024
550f1c7
adapt caibration procedure to accommodate hall sensors
yconst Mar 20, 2024
52baf44
use sensor type getter
yconst Mar 20, 2024
9f97669
update hall sensor config docs
yconst Mar 20, 2024
244b857
add get config implementations
yconst Mar 20, 2024
21d613f
remove unused functions
yconst Mar 21, 2024
9f16f9c
erase as many pages as needed
yconst Mar 21, 2024
634af52
use separate update params function
yconst Mar 26, 2024
3ede56e
remove unneeded declarations
yconst Mar 26, 2024
c8f0a8f
init all members
yconst Mar 26, 2024
818898e
add initial amt22 support
yconst Mar 26, 2024
48d53bd
minor fixes
yconst Mar 27, 2024
7afb868
update tests for new firmware
yconst Apr 1, 2024
2b80698
refactor sensor initialization
yconst Apr 1, 2024
2595486
refactor observer initialization
yconst Apr 1, 2024
cac5428
add condition to support R3.x boards
yconst Apr 1, 2024
45a82b9
update tests
yconst Apr 1, 2024
5719ab4
update figures
yconst Apr 1, 2024
c839e40
update sensor docs
yconst Apr 1, 2024
6dde965
add as5047 test
yconst Apr 1, 2024
adaf1c2
fix reference
yconst Apr 1, 2024
2b180f4
elaborate on examples
yconst Apr 1, 2024
0b45474
add conditional tests
yconst Apr 2, 2024
0627e32
add more verbose pre- and post-build messages
yconst Apr 3, 2024
8dda620
add note about commutation transform
yconst Apr 3, 2024
b735a62
remove unused parameter
yconst Apr 3, 2024
06a8f8c
toggle sending of heartbeat
yconst Apr 4, 2024
e1b1293
reset observer state
yconst Apr 4, 2024
eff3a3c
fix scaling
yconst Apr 4, 2024
642b7ef
accommodate hall sensor calibration
yconst Apr 4, 2024
58cc291
init sensors after uart and can
yconst Apr 4, 2024
f0c1493
explicit check
yconst Apr 4, 2024
21f3d2a
reset observer state on change
yconst Apr 4, 2024
9bf80a9
fix conversion
yconst Apr 4, 2024
d0c9eec
rename vars
yconst Apr 4, 2024
09f577e
add optional precheck callback param
yconst Apr 5, 2024
dc0dce9
add hall test
yconst Apr 5, 2024
2312673
change optimization level
yconst Apr 6, 2024
55085eb
add more external sensor tests
yconst Apr 13, 2024
9a99475
remove unused function
yconst Apr 13, 2024
aeac576
add parity calculation for the amt22 sensor
yconst Apr 13, 2024
afb60d0
add amt22 connection diagram
yconst Apr 15, 2024
e4512a2
parametrize the ssp data size
yconst Apr 15, 2024
997a42e
fix reading of AMT22
yconst Apr 15, 2024
454fbcd
add amt22 test
yconst Apr 16, 2024
8589ed4
track and use reference frame calibrations
yconst Apr 17, 2024
91b9a19
update as5047 tests
yconst Apr 17, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .vscode/c_cpp_properties.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE"
"_UNICODE",
"__CC_ARM"
],
"cStandard": "c11",
"cppStandard": "c++17",
Expand Down
27 changes: 26 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,32 @@
"files.associations": {
"random": "c",
"limits": "c",
"common.h": "c"
"common.h": "c",
"__hash_table": "c",
"__tuple": "c",
"array": "c",
"type_traits": "c",
"ratio": "c",
"tuple": "c",
"variant": "c",
"chrono": "c",
"compare": "c",
"cstddef": "c",
"__locale": "c",
"__bit_reference": "c",
"__node_handle": "c",
"atomic": "c",
"bitset": "c",
"__memory": "c",
"locale": "c",
"optional": "c",
"system_error": "c",
"vector": "c",
"motor.h": "c",
"trajectory_planner.h": "c",
"xf1.h": "c",
"controller.h": "c",
"observer.h": "c"
},
"python.testing.unittestArgs": [
"-v",
Expand Down
4 changes: 3 additions & 1 deletion avlos_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,17 @@ generators:
generator_c:
enabled: true
paths:
output_enums: ./firmware/src/tm_enums.h
output_header: ./firmware/src/can/can_endpoints.h
output_impl: ./firmware/src/can/can_endpoints.c
header_includes:
- src/common.h
- src/tm_enums.h
impl_includes:
- <string.h>
- src/adc/adc.h
- src/system/system.h
- src/encoder/encoder.h
- src/sensor/sensors.h
- src/observer/observer.h
- src/motor/motor.h
- src/scheduler/scheduler.h
Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
# -- Project information -----------------------------------------------------

project = 'Tinymovr'
copyright = '2020, Yannis Chatzikonstantinou'
copyright = '2020-2024, Yannis Chatzikonstantinou'
author = 'Yannis Chatzikonstantinou'


Expand Down
Binary file added docs/hardware/connectors_m5_2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 8 additions & 4 deletions docs/hardware/guide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@ Sensor Magnet and Mounting Tips

* Ensure the sensor magnet is firmly attached to the motor shaft, otherwise it may slip out of sync. Use strong adhesive to secure.

* It is possible to have the magnet on the rear side of the PCB, i.e. opposite of the magnet sensor IC, but the gap needs to be reduced to account for the PCB thickness. This has been verified by MPS in `this forum post <https://forum.monolithicpower.com/t/mounting-ma702-and-magnet-on-opposite-sides-of-pcb/1609>`_, quoted below:
* It is possible to have the magnet on the rear side of the PCB, i.e. opposite of the magnet sensor IC, but the gap needs to be reduced to account for the PCB thickness. This has been verified by MPS in a forum post [1]_, quoted below:
*[...] this type of arrangement is possible, what really matters in the end is that there is enough magnetic field reaching the sensor.
Of course the minimum distance is imposed by the thickness of the PCB, so it puts some constraints on the design, that you have to take into account when chosing the magnet (you can use our online simulation tool for that). But as long as the PCB is not acting as a magnetic shield (due to copper plane), then it is fine.*
Of course the minimum distance is imposed by the thickness of the PCB, so it puts some constraints on the design, that you have to take into account when choosing the magnet (you can use our online simulation tool for that). But as long as the PCB is not acting as a magnetic shield (due to copper plane), then it is fine.*

* Calibration needs to be performed without any loads on the motor. If the motor is coupled to a load, the sensor offset angle may not be determined correctly, leading to a sub-optimal setup.

Expand Down Expand Up @@ -118,7 +118,7 @@ Connect the CAN bus header to one of the two CAN sockets on the board. It is not

* Tinymovr M5.x: you will need to provide an external 120Ω termination resistor.

In small setups with few nodes and short wires, it is better to enable just a single termination resistor, either on one Tinymovr board or on the CAN adapter. In setups with many nodes and long cables, you may need to enable termination resistors in both terminal nodes.
In small setups with few nodes and short wires, it is better to enable just a single termination resistor, either on one Tinymovr board or on the CAN adapter. In setups with many nodes and long cables, you may need to enable termination resistors in both terminal nodes. A typical CAN driver has an “open-drain” output structure, meaning that the dominant edge is actively driven and the recessive edge is not. Therefore, properly terminating the bus is very important because it ensures that the recessive edge decays properly, and in time for the next bit's sample point [2]_.

.. warning::
The UART pins in Tinymovr R5.1 have the silkscreen reversed. If you are planning to use UART with R5.1, consult :ref:`r51-erratum-1`.
Expand Down Expand Up @@ -148,4 +148,8 @@ Multiple nodes can be connected in a single CAN Bus network by means of daisy-ch

.. image:: daisy_chain.png
:width: 800
:alt: Connecting multiple nodes by daisy-chaining
:alt: Connecting multiple nodes by daisy-chaining


.. [1] MPS forum post on mounting MA702 and magnet on opposite sides of PCB: https://forum.monolithicpower.com/t/mounting-ma702-and-magnet-on-opposite-sides-of-pcb/1609
.. [2] Split Termination, Texas Instruments. Available at `https://www.ti.com/document-viewer/lit/html/SSZTB40#:~:text=for%20each%20termination.-,Split%20Termination,typically%20between%201%2D100nF`.
11 changes: 9 additions & 2 deletions docs/hardware/overview.rst
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,19 @@ Board Dimensions (M5.1, M5.2)
:width: 800
:alt: Tinymovr M5 dimensions

Connectivity (M5.1, M5.2)
Connectivity (M5.1)
#########################

.. image:: connectors_m5.png
:width: 800
:alt: Tinymovr M5 connectors and pinouts
:alt: Tinymovr M5.1 connectors and pinouts

Connectivity (M5.2)
#########################

.. image:: connectors_m5_2.png
:width: 800
:alt: Tinymovr M5.2 connectors and pinouts


R3.x
Expand Down
Loading
Loading