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

uart: half stopbit support, speedup and bit boundaries refinement #91

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

sespivak
Copy link

@sespivak sespivak commented Jul 31, 2022

  1. Reduced amount of IDLE events by doubling of IDLE period of each frame since 3rd. Max IDLE period equals samplerate, thus IDLE events min frequency is 1 Hz. This approach decreases function calls up to 10 times at idle periods, depends on data sparsity and baudrate selected.
  2. Start and end of signal boundaries refined. There is no overlap in data bits annotations now. Also packets boundaries are frame boundaries, because packet transmission actually starts at start bit and ends with stop bit.
  3. Calculations of constants in start() to avoid unnecessary overhead at runtime.
  4. New option put_sample_points added to put sample points at dedicated annotation rows with corresponding signal values.
  5. Half stopbit values support (0.5 and 1.5)
  6. A state machine to control the whole decode process. It also contains precomputed sample point values and exact sample values for the current bit boundaries.
  7. Interrupt receiving stop bits on stop bit error and put stopbit error in annotation
  8. Put data packets to python output
  9. Put actual and expected signal at parity error to python output instead of dummy tuple
  10. Raise an exception BaudrateError if baudrate option value is not positive
  11. Testcases updated to match new bits/data boundaries. sigrok-test #18

Speed measurements were made using a set of tests:

time ../sigrok-test/decoder/pdtest -r modbus lin amulet_ascii uart midi

Average time without patches on my pc (i5-4250U):
real 2m47s
Average time with patch:
real 1m29s

So the speedup is around 88%. If the dataset is sparse, the speedup is even greater, up to 400%.

This patch based on PR #90 and contains 2 commits - 1 old from #90 and 1 new, described here.

Снимок экрана от 2022-08-05 14-58-31

Снимок экрана от 2022-08-05 15-00-22

Снимок экрана от 2022-08-03 10-00-02

@sespivak sespivak force-pushed the uart_fast branch 6 times, most recently from 6646578 to e9cd641 Compare August 1, 2022 12:27
@sespivak sespivak changed the title uart: optimisations for performance and bit/data/packet margins refinement uart: optimisations for performance and bit/data/packet boundaries refinement Aug 1, 2022
@sespivak sespivak force-pushed the uart_fast branch 5 times, most recently from fc7e7ab to 2a545b9 Compare August 2, 2022 10:20
@sespivak sespivak marked this pull request as ready for review August 2, 2022 11:07
@sespivak sespivak changed the title uart: optimisations for performance and bit/data/packet boundaries refinement uart: half stopbit support, speedup and bit boundaries refinement Aug 3, 2022
@sespivak sespivak force-pushed the uart_fast branch 11 times, most recently from 271562f to aa4323d Compare August 8, 2022 18:45
- UART-related tests from sigrok-test now run about ~88% faster.
- Reduced amount of IDLE events by doubling of IDLE period of each frame
  since 3rd. Max IDLE period equals samplerate, thus IDLE events min
  frequency is 1 Hz. This approach decreases function calls up to 10 times
  at idle periods, depends on data sparsity and baudrate selected.
- Calculations of constants in start() to avoid unnecessary overhead
  at runtime.
- Start and end of signal boundaries refined. There is no overlap in
  data bits annotations now. Also packets boundaries are frame boundaries,
  because packet transmission actually starts at start bit and ends with
  stop bit.
- New option put_sample_points added to put sample points at dedicated
  annotation rows with corresponding signal values.
- Options reading moved from runtime to init time for performance,
  a state machine used to control the entire decoding process.
- Support of half stopbit values 0.5 and 1.5.
- Interrupt receiving stop bits on stop bit error and put
  stopbit error in annotation.
- Put data packets to python output.
- Put actual and expected signal at parity error to python output
  instead of dummy tuple.
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.

1 participant