Skip to content

Simplify frame filtering usage#21

Merged
ProfFan merged 15 commits intoProfFan:mainfrom
max2320:main-frame-filtering-simplification
Feb 23, 2025
Merged

Simplify frame filtering usage#21
ProfFan merged 15 commits intoProfFan:mainfrom
max2320:main-frame-filtering-simplification

Conversation

@max2320
Copy link
Copy Markdown
Contributor

@max2320 max2320 commented Jan 25, 2025

This PR aims to simplify the creation of targeted messages to support Frame Filtering and prevent additional logic after the receive cycle to discard messages.

The new workflow consists of having a helper method to build the IEEE 802.15.4 MAC frames without having to import the whole chain from smoltcp and to make sure all the messages created and sent follow the same pattern across, also unifies the workflow, reducing the code duplication that was occurring before between the send actions shaving some computing cycles and improving the maintenance.

flowchart LR
    A[send] --> B[send_to] --> C[send_raw]
    D[send_frame] --> C[send_raw]
    C[send_raw] --> U1[
        1 resets
        2 populates buffer
        3 apply settings
        4 set delays
        5 returns the sending instance
    ]
Loading

Additions:

  • send_to(): method to permit target frames
  • clear_event_counter(): helper method to clear event counter (evc_ctrl->evc_clr)
  • enable_event_counter(): helper method to re-enable the event counter (evc_ctrl->evc_en)
  • enable_tx_clock(): helper to enable tx clock (clk_ctrl->tx_clk)
  • build_frame_header(): method to aid the creation of IEEE 802.15.4 MAC frame header with the given targets
  • build_frame(): method to populate formated IEEE 802.15.4 MAC frame buffers including the data payload

Note: During my tests, replacing some of the modify with write decreased the execution cycles, sometimes by 1/3 of the original time to send the same payload(I am using a microsecond timestamp log on an esp32 and basic diff math to get these numbers). I understand that we might need to read some data in some instances, but I haven't found any reason to leave the param available. Let me know if you know a reason to keep the other original.

@max2320 max2320 marked this pull request as ready for review February 3, 2025 17:39
@max2320 max2320 changed the title [DRAFT] Simplify frame filtering usage Simplify frame filtering usage Feb 3, 2025
Copy link
Copy Markdown
Owner

@ProfFan ProfFan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please also check the simulation code in examples and make sure that the SPI commands that got sent matches the original

Comment thread src/hl/ready.rs Outdated
Comment thread src/hl/ready.rs Outdated
@ProfFan
Copy link
Copy Markdown
Owner

ProfFan commented Feb 13, 2025

Thank you for the PR!

Just saw your PR notes. These commands have to be done with a lot of caution. Basically I took the lazy approach by using modify everywhere, but if you want to change these, I kindly would ask you for a justification (in the code as a comment) for every one of these by a reference to the DW3000 application manual that states this action is safe.

@max2320
Copy link
Copy Markdown
Contributor Author

max2320 commented Feb 18, 2025

Tks for the comments. I will undo the changes to use modify for now and expose the errors

@max2320 max2320 force-pushed the main-frame-filtering-simplification branch from 8e3376c to a2eb986 Compare February 18, 2025 16:50
@max2320
Copy link
Copy Markdown
Contributor Author

max2320 commented Feb 18, 2025

I ran the example and the real-world test on my fleet of boards and got all the correct messages. Let me know if we need to test something more specific.

I will look deeper into the write thing later to add the proper ref to the documentation files, but that is work for another PR.

@max2320 max2320 requested a review from ProfFan February 18, 2025 19:36
Comment thread src/hl/ready.rs Outdated
Comment thread src/hl/ready.rs
@max2320
Copy link
Copy Markdown
Contributor Author

max2320 commented Feb 19, 2025

My bad. I was testing some experimental timing filters and forgot to stash them. I just updated it, and it should be fine now.

@max2320 max2320 closed this Feb 19, 2025
@max2320 max2320 reopened this Feb 19, 2025
@max2320
Copy link
Copy Markdown
Contributor Author

max2320 commented Feb 19, 2025

🤦🏻 clicked on the wrong button

@max2320 max2320 requested a review from ProfFan February 19, 2025 20:22
Comment thread src/hl/ready.rs Outdated
Comment thread src/hl/ready.rs Outdated
Comment thread src/hl/ready.rs Outdated
@max2320 max2320 requested a review from ProfFan February 22, 2025 20:07
@ProfFan
Copy link
Copy Markdown
Owner

ProfFan commented Feb 23, 2025

@fromeijn @trembel CC for a look, does this work for you? I am merging, but please give your precious feedback :)

@ProfFan ProfFan merged commit bf49a79 into ProfFan:main Feb 23, 2025
@ProfFan
Copy link
Copy Markdown
Owner

ProfFan commented Feb 23, 2025

Thank you @max2320 !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants