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

Last data when using trigger #52

Open
tmk opened this issue Jan 17, 2022 · 0 comments
Open

Last data when using trigger #52

tmk opened this issue Jan 17, 2022 · 0 comments

Comments

@tmk
Copy link

tmk commented Jan 17, 2022

I'm using this logic_analyzer with Arduino Uno and jawi/ols client and found the client get one incorrect data at the very last. This happens when using trigger with sampling rate 500khz(or less), or when triggerMicro() is executed.

Following two pictures show the issue. See glitch in signal of Channel-0 and 1 at the very last(rightmost).
The last sampling data shown at the rightmost is not placed correctly. And I believe the data should be palced in the first position, or at the leftmost.


(These are Sampling rate and Trigger setting.)

I think this part of triggerMicro() causes the issue and it seems to be not needed to me.
This patch solves this issue. But I'm not sure this is right solution, or am I missing something?

diff --git a/logic_analyzer/logic_analyzer.ino b/logic_analyzer/logic_analyzer.ino
index 2daaa42..e3c7b68 100644
--- a/logic_analyzer/logic_analyzer.ino
+++ b/logic_analyzer/logic_analyzer.ino
@@ -878,16 +878,6 @@ void triggerMicro() {
   /* re-enable interrupts */
   sei();

-  /*
-   * trigger has fired and we have read delayCount of samples after the
-   * trigger fired.  triggerIndex now points to the trigger sample
-   * logicIndex now points to the last sample taken and logicIndex + 1
-   * is where we should start dumping since it is circular.
-   *
-   * our buffer starts one entry above the last read entry.
-   */
-  logicIndex++;
-
   for (i = 0 ; i < readCount; i++) {
     if (logicIndex >= readCount) {
       logicIndex = 0;

https://github.com/gillham/logic_analyzer/blob/master/logic_analyzer/logic_analyzer.ino#L881-L889

No glitch with the patched firmware.

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

No branches or pull requests

1 participant