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

v0.9.0 - big buffer replacement, and much more #66

Open
wants to merge 43 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
f82f0f5
pru0 - buffer-redesign part 1 - pru build system
orgua Oct 4, 2024
dd927b8
pru - refactoring step 2
orgua Oct 4, 2024
ea56ef9
refactor kernel-module
orgua Oct 4, 2024
ab17631
reformat code
orgua Oct 4, 2024
04c4501
update PRU & kMod with latest changes
orgua Oct 5, 2024
b9543d6
update py-sheep
orgua Oct 10, 2024
37a6e6f
sync changes to msg-system
orgua Oct 10, 2024
e5edc80
update deps
orgua Oct 10, 2024
6b40d35
Update data_handling.md
orgua Oct 10, 2024
5ef2977
refinements and bugfixes
orgua Oct 11, 2024
30eabae
Update build_pre.yml
orgua Oct 11, 2024
ac014e1
divide iv-buffer in in & out
orgua Oct 11, 2024
0c00a5b
unify direct msg-sys & add min-pru-util stat
orgua Oct 12, 2024
de6d550
adc readout speedup, 22 to 29 MHz
orgua Oct 12, 2024
69e0cca
optimize access of structs in shared-mem
orgua Oct 12, 2024
8e06080
unify specialization of make with TYPE=
orgua Oct 12, 2024
310e65d
fix emu
orgua Oct 12, 2024
c2dcd8f
pru - add experimental cache (OCMC-RAM)
orgua Oct 14, 2024
5b7b99f
pru / kmod - intermediate step to improved sync
orgua Oct 14, 2024
da01e97
kMod - sync reimplementation with PI-Ctrl & simulation
orgua Oct 17, 2024
66dc93a
lint code
orgua Oct 17, 2024
14b94ee
update tooling
orgua Oct 17, 2024
1c07ea3
fix util for pru0, add tsample pru1, fix message-test, fix sync, fix …
orgua Oct 18, 2024
3967fed
extend sync-analyzer
orgua Oct 18, 2024
27a917d
kernel now tests canaries
orgua Oct 19, 2024
2b6e0df
pru1 - fix recv of messages
orgua Oct 19, 2024
5f2000e
pru0 - improve util-calculation
orgua Oct 19, 2024
f990492
canaries throw now, adc gets tested,
orgua Oct 20, 2024
2992343
kmod - use newer read/write-interface for IO
orgua Oct 20, 2024
dae036a
modify floorplan
orgua Nov 29, 2024
0104648
rename
orgua Nov 29, 2024
66b9dbd
add voltage-step to HarvesterPRUConfig
orgua Nov 29, 2024
e422a18
linting and small log-output additions
orgua Nov 29, 2024
a52dff2
kMod - improve cache and add loopback-option
orgua Nov 30, 2024
7aebddc
Update ocmc_cache.c
orgua Nov 30, 2024
00b4bdc
forgotten files
orgua Nov 30, 2024
544796b
vharvester - improve similarity to VOC-search by jumping to VOC
orgua Nov 30, 2024
b58d5d8
vsrc - disable initially enabled output
orgua Nov 30, 2024
8fd1e0e
pru - linting, refactoring, loopback, activate cache-read
orgua Nov 30, 2024
228fef5
update tooling
orgua Nov 30, 2024
200b543
pyPackage needs newest version of core-lib
orgua Nov 30, 2024
848f532
Update dev_redeploy_roles.yml
orgua Dec 5, 2024
71e9f6c
latest dev-
orgua Dec 5, 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
2 changes: 1 addition & 1 deletion .github/workflows/build_pru_gcc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,6 @@ jobs:

- name: Build SBW Programmer 🧱
run: |
make PROTO=SBW
make TYPE=SBW
${{ env.PRU_GCC }}/bin/pru-size gen_gcc/pru0-programmer-SBW-fw.elf
working-directory: "software/firmware/pru0-programmer/"
10 changes: 5 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# update deps pre-commit autoupdate
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
rev: v5.0.0
hooks:
- id: check-added-large-files
args: ["--maxkb=500"]
Expand Down Expand Up @@ -36,13 +36,13 @@ repos:
- id: trailing-whitespace

- repo: https://github.com/igorshubovych/markdownlint-cli
rev: v0.42.0
rev: v0.43.0
hooks:
- id: markdownlint
args: ["--disable", "MD013"] # ignore line length

- repo: https://github.com/abravalheri/validate-pyproject
rev: v0.20.2
rev: v0.23
hooks:
- id: validate-pyproject
# files: "./software/python-package/pyproject.toml"
Expand All @@ -62,7 +62,7 @@ repos:
- id: text-unicode-replacement-char

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: 'v0.6.8'
rev: 'v0.8.1'
hooks:
- id: ruff-format
- id: ruff
Expand Down Expand Up @@ -91,7 +91,7 @@ repos:
exclude: \.(sch|brd|lbr)$

- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v19.1.0
rev: v19.1.4
hooks:
- id: clang-format
types_or: [c++, c]
Expand Down
10 changes: 5 additions & 5 deletions .ruff.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ ignore = [
"TID252", # relative imports from parent
"PLR0904", "PLR0911", "PLR0912", "PLR0913", "PLR0915", # complexity
"C901", # complexity
"ANN101", "ANN102", # self & cls not type-annotated
"ANN401", # Any as valid type
"COM812", # trailing comma, same line
"TD002", "TD003", "TD005", "FIX002", # TODOs
Expand All @@ -32,13 +31,14 @@ exclude= [ # external projects

[lint.per-file-ignores]
"*/tests/**" = ["ARG", "S", "D", "SLF001", "T201"]
"*/examples/**" = ["INP001", "ERA001"] # no namespace + commented-out code
"software/shepherd-calibration/**" = ["ERA001"] # comments
"*/examples/**" = ["INP001", "ERA001"] # no namespace & commented-out code
"docs/**" = ["INP001"]
"software/debug_analyze_time_sync/**" = ["ERA001", "S301"] # comments
"software/shepherd-devicetest/**" = ["ERA001", "ARG001", "PLW0603", "F405", "F403", "ANN001"]
"software/kernel-module/**" = ["INP001", "T201", "ERA001"] # no namespace, print & commented-out code
"software/python-package/shepherd_sheep/shepherd_debug.py" = ["FBT001", "FBT002"]
"software/shepherd-calibration/**" = ["ERA001"] # comments
"software/shepherd-calibration/shepherd_cal/**" = ["FBT003"] # rpc had trouble with named params
"docs/**" = ["INP001"]
"software/shepherd-devicetest/**" = ["ERA001", "ARG001", "PLW0603", "F405", "F403", "ANN001"]

[lint.mccabe]
# Unlike Flake8, default to a complexity level of 10.
Expand Down
1 change: 1 addition & 0 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ shepherd-data = "*"
sync-analysis = {editable = true, path = "./software/debug_analyze_time_sync"}
# temporary
dearpygui = "*"
pre-commit = "*"

[dev-packages]
bump2version = "*"
Expand Down
3,662 changes: 1,847 additions & 1,815 deletions Pipfile.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion deploy/dev_redeploy_roles.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
ansible.builtin.command: "date -s {{ local_time.stdout }}"
changed_when: true

- name: Role - PTP-Client only (not recommended! all should be server as well)
- name: Role - PTP-Client only
hosts: ptp_clients
become: true
strategy: free # noqa: run-once[play]
Expand Down
2 changes: 1 addition & 1 deletion deploy/roles/sheep/tasks/build_pre.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
register: modprobe_ret
until: modprobe_ret is not failed
retries: 5
when: kmod_ret.rc == 0
# when: kmod_ret.rc == 0 # NOT WORKING as expected
changed_when: true
# fails at least on first install -> check for presence of shepherd
# lsmod | grep shepherd
Expand Down
2 changes: 1 addition & 1 deletion docs/dev/data_handling.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Data is sampled/replayed through the ADC (`TI ADS8691`) and DAC (`TI DAC8562T`).

## PRU to host

Data is sampled and bidirectionally transferred between PRUs and user space in buffers, i.e. blocks of `SAMPLES_PER_BUFFER` samples. These buffers correspond to sections of a continuous area of memory in DDR RAM to which both PRUs and user space application have access. This memory is provisioned through `remoteproc`, a Linux framework for managing resources in an AMP (asymmetric multicore processing) system. The PRU firmware contains a so-called resource table that allows to specify required resources. We request a carve-out memory area, which is a continuous, non-cached area in physical memory. On booting the PRU, the `remoteproc` driver reads the request, allocates the memory and writes the starting address of the allocated memory area to the resource table, which is readable by the PRU during run-time. The PRU exposes this memory location through shared RAM, which is accessible through the sysfs interface provided by the kernel module. Knowing physical address and size, the user space application can map that memory after which it has direct read/write access. The total memory areas is divided into `FIFO_BUFFER_SIZE` distinct buffers.
Data is sampled and bidirectionally transferred between PRUs and user space in buffers. These buffers correspond to sections of a continuous area of memory in DDR RAM to which both PRUs and user space application have access. This memory is provisioned through `remoteproc`, a Linux framework for managing resources in an AMP (asymmetric multicore processing) system. The PRU firmware contains a so-called resource table that allows to specify required resources. We request a carve-out memory area, which is a continuous, non-cached area in physical memory. On booting the PRU, the `remoteproc` driver reads the request, allocates the memory and writes the starting address of the allocated memory area to the resource table, which is readable by the PRU during run-time. The PRU exposes this memory location through shared RAM, which is accessible through the sysfs interface provided by the kernel module. Knowing physical address and size, the user space application can map that memory after which it has direct read/write access. The total memory area is divided into three distinct buffers for ivsamples, gpio-traces and pru-utilization-log.

The shared RAM approach is the fastest option on the BeagleBone, but still has some caveats. Writing from PRU-side to DDR RAM can be done within one cycle. The operation does not finish in that time, but does not block the PRU. Reading on the other hand can take several hundred cycles. In rare cases `> 4 us`, which equals 800 cycles or almost half the real-time window. For that reason the reading operation is done by PRU1, as it has more resources to spare. A future design should consider, that reading takes almost same time for 1 byte or 100 bytes.

Expand Down
Binary file modified docs/testbed/media/cfaed_floorplan_mod.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/testbed/media/cfaed_floorplan_old2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
58 changes: 11 additions & 47 deletions docs/testbed/media/cfaed_floorplan_with_nodes.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 16 additions & 3 deletions software/debug_analyze_time_sync/sync_analysis/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@ def cli(
_stat: dict[str, list] = {
"diff": [],
"rising": [],
"falling": [],
"low": [],
"high": [],
}

for trace in ltraces.traces:
Expand All @@ -79,16 +81,27 @@ def cli(

for _ch in range(trace.channel_count):
_data_r = trace.calc_durations_ns(_ch, edge_a_rising=True, edge_b_rising=True)
_expt = trace.calc_expected_value(_data_r, mode_log10=True)
_name = trace.name + f"_ch{_ch}_rising_{round(_expt / 1e6)}ms"
_data_r[:, 1] = _data_r[:, 1] - _expt
_expt_r = trace.calc_expected_value(_data_r, mode_log10=True) # in nsec
_name = trace.name + f"_ch{_ch}_rising_{round(_expt_r / 1e3)}us"
_data_r[:, 1] = _data_r[:, 1] - _expt_r
trace.plot_series_jitter(_data_r, _name, dir_path)
_stat["rising"].append(trace.get_statistics(_data_r, _name))

_data_f = trace.calc_durations_ns(_ch, edge_a_rising=False, edge_b_rising=False)
_expt_f = trace.calc_expected_value(_data_f, mode_log10=True)
_name = trace.name + f"_ch{_ch}_falling_{round(_expt_f / 1e3)}us"
_data_f[:, 1] = _data_f[:, 1] - _expt_f
trace.plot_series_jitter(_data_f, _name, dir_path)
_stat["falling"].append(trace.get_statistics(_data_f, _name))

_data_l = trace.calc_durations_ns(_ch, edge_a_rising=False, edge_b_rising=True)
_name = trace.name + f"_ch{_ch}_low"
_stat["low"].append(trace.get_statistics(_data_l, _name))

_data_h = trace.calc_durations_ns(_ch, edge_a_rising=True, edge_b_rising=False)
_name = trace.name + f"_ch{_ch}_high"
_stat["high"].append(trace.get_statistics(_data_h, _name))

# sync between channels
for _ch1 in range(trace.channel_count):
_data1 = trace.get_edge_timestamps(_ch1, rising=True)
Expand Down
Loading
Loading