Bug 1025 - Can't connect to Open Workbench Logic Sniffer
Summary: Can't connect to Open Workbench Logic Sniffer
Status: CONFIRMED
Alias: None
Product: libsigrok
Classification: Unclassified
Component: Driver: openbench-logic-sniffer (show other bugs)
Version: 0.4.0
Hardware: x86 Linux
: Normal normal
Target Milestone: ---
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-09-06 08:32 CEST by NTCT
Modified: 2020-08-29 06:59 CEST (History)
5 users (show)



Attachments
OpenBenchLogic serial init code fix (501 bytes, patch)
2020-02-03 03:03 CET, EUA
Details
OLS init needs flush patch (47 bytes, text/plain)
2020-02-03 04:21 CET, EUA
Details
OLS init needs flush patch (487 bytes, patch)
2020-02-03 04:22 CET, EUA
Details
flush buffers after open in libserialport (667 bytes, patch)
2020-02-03 16:56 CET, Wolfram Sang
Details

Note You need to log in before you can comment on or make changes to this bug.
Description NTCT 2017-09-06 08:32:38 CEST
The following options were set in "Connect to Device" menu:
1) Driver - ols
2) Interface - Serial Port (/dev/tty/ACM1)

Scanning for devices produced no output in "Select the device window", but the following error appeared in the command line:

sr: ols: Invalid reply (expected '1SLO' or '1ALS', got 'ALS1').

On a few occasions (can't reproduce reliably) "Sump Logic Analyzer" did show up in the "Select the device" window, but attempts to connect to the device resulted in software crashing.
Comment 1 Wolfram Sang 2018-12-30 17:03:59 CET
"Software crashing" probably means PulseView segfaulting. Yes, that used to happen when OLS devices were not able to send metadata. This part has been fixed with 519a6ed ("Fix #928 by catching errors if config_list() fails") and is included in the latest PulseView version already.

For the improper scanning, hard to tell. The next libsigrok version will likely have a timeout there increased because I needed this for another device. It could help here, too. Not super-likely, though.

Is it the original or the latest firmware?
Comment 2 EUA 2020-01-20 01:59:57 CET
Depending my experience;
This happen due sigrok doesn't clear rx buffer on serial initialization, at least before sending 0x00's.

If there are an unread byte available at line, due an interference, previous sessions, or DTR reset (on some devices prints some boot init strings to serial line), 1ALS corrupted on first read on receiver side because line has some data like 3 byte 'xxx'.

At first read let say rx line has 'xxx' chars.
For detection sent 0x00 * 5.
HW feed line with 1ALS. At receiver side it become 'xxx1' but 3 byte 'ALS' is wait at buffer.
At second trial, HW feed 1ALS again. But at receiver side it reads ALS1, 3 byte 'ALS' is still stay at buffer.

Flushing the rx via an external program (like cutecom) resolves this issue.
After, detection work as intended.

I think it's better to flush available RX buffer before sending 0x00 * 5 on OLS devices.
Comment 3 Wolfram Sang 2020-01-20 06:09:03 CET
Makes sense to me. Thanks! Unless you say you want to do it, I will try to make a patch and test it later this week.
Comment 4 Seb 2020-01-24 13:05:48 CET
have the same issue (but on windows)
openbench is not found in the command line and pulseview just crashes at start up (openbench connected) and if i start pulseview without openbench connected, it crashes when I select the device(don't get any error in both cases...)

so i'm looking forward for your patch :)

thanks!
Comment 5 EUA 2020-01-31 01:51:06 CET
I don't notice the your reply Wolfram. 
Thank you for fixing it. :)
Comment 6 EUA 2020-02-03 03:03:56 CET
Created attachment 584 [details]
OpenBenchLogic serial init code fix
Comment 7 EUA 2020-02-03 04:21:16 CET
Created attachment 585 [details]
OLS init needs flush patch
Comment 8 EUA 2020-02-03 04:22:44 CET
Created attachment 586 [details]
OLS init needs flush patch

Fixed using proper function. Discard old patch.
Comment 9 Wolfram Sang 2020-02-03 16:56:32 CET
Created attachment 587 [details]
flush buffers after open in libserialport

Sorry for not answering earlier, I am on the road an can't do actual testing.
However, I think the flushing should be done in libserialport to be generic. I attach a WIP which needs testing, but shows the concept.

Famous last word: i'll try to test it this week.
Comment 10 Wolfram Sang 2020-04-11 19:15:05 CEST
Bummer, even with both(!) patches applied (libsigrok patch + libserialport patch), I still can't get it to work reliably :( I get two bad cases, one is the serial port getting stuck after the 4th reset cmd. This happens often. The other one is a shifted identification string like comment #1 was reporting. This happens once in a while. I tried some other flushing but to no avail. Needs more debugging.

My test scenario:

$ sigrok-cli --driver=ols:conn=/dev/ttyACM0 --samples 6144

<then CTRL+C before capture does finish>

$ sigrok-cli --driver=ols:conn=/dev/ttyACM0 --scan -l 5
Comment 11 iamseer 2020-08-29 06:59:33 CEST
(In reply to Wolfram Sang from comment #10)
> Bummer, even with both(!) patches applied (libsigrok patch + libserialport
> patch), I still can't get it to work reliably :( I get two bad cases, one is
> the serial port getting stuck after the 4th reset cmd. This happens often.
> The other one is a shifted identification string like comment #1 was
> reporting. This happens once in a while. I tried some other flushing but to
> no avail. Needs more debugging.
> 
> My test scenario:
> 
> $ sigrok-cli --driver=ols:conn=/dev/ttyACM0 --samples 6144
> 
> <then CTRL+C before capture does finish>
> 
> $ sigrok-cli --driver=ols:conn=/dev/ttyACM0 --scan -l 5

Hi I think I had a similar issue to yours?
https://sigrok.org/bugzilla/show_bug.cgi?id=1597