asanza / libsigrok_dslogic

Integrating dslogic into sigrok.
GNU General Public License v3.0
3 stars 1 forks source link

Easy tasks to assist with dslogic integration #1

Closed Susurrus closed 8 years ago

Susurrus commented 8 years ago

I recently purchased a DSLogic, but am disappointed with their own software (I thought they just used base sigrok when I bought it). I'd like to get at least basic functionality working in Sigrok for this hardware, is there anything I can help out with to get that working? I already can build all libs and PulseView.

asanza commented 8 years ago

Thanks for the offer, but the official libsigrok already supports dslogic (at least partial) (see git://sigrok.org/libsigrok).

I tested it, and seems that the fpga upload is broken (the first stage firmware upload seems ok). I am now trying to figure out why it does not work.

You can try downloading the official libsigrok git://sigrok.org/libsigrok and compile it. For the dslogic to work, you also need to copy following files (assuming your configure path is /usr/local):

cp  DSLogic/DSLogic-gui/res/DSLogic.fw         /usr/local/share/sigrok-firmware/dreamsourcelab-dslogic-fx2.fw
cp  DSLogic/DSLogic-gui/res/DSLogic50.bin    /usr/local/share/sigrok-firmware/dreamsourcelab-dslogic-fpga.fw

DSLogic.fw and DSLogic50.bin are the official libsigrok firmware (can be found on the dslogic repository).

You can test that is working with sigrok-cli:

sigrok-cli -d fx2lafw --time 1 -l 5
sr: [00:00.000001] log: libsigrok loglevel set to 5.
sr: [00:00.000097] backend: libsigrok 0.5.0-git-0586a0e/3:0:0 (rt: 0.5.0-git-0586a0e/3:0:0).
sr: [00:00.000163] backend: Libs: glib 2.46.2 (rt: 2.46.2/4602:2), libzip 1.0.1, libusb-1.0 1.0.19.10903, libftdi 1.2.
sr: [00:00.000222] backend: Host: x86_64-unknown-linux-gnu, little-endian.
sr: [00:00.000267] backend: SCPI backends: TCP, RPC, USBTMC.
sr: [00:00.000332] backend: Sanity-checking all drivers.
sr: [00:00.000384] backend: Sanity-checking all input modules.
sr: [00:00.000425] backend: Sanity-checking all output modules.
sr: [00:00.000474] backend: Sanity-checking all transform modules.
srd: libsigrokdecode loglevel set to 5.
sr: [00:00.004554] hwdriver: Initializing driver 'fx2lafw'.
sr: [00:00.006770] fx2lafw: Found an fx2lafw device.
sr: [00:00.006862] hwdriver: Scan of 'fx2lafw' found 1 devices.
sr: [00:00.006925] fx2lafw: Firmware upload was not needed.
sr: [00:00.007368] fx2lafw: Opened device on 2.23 (logical) / usb/2-1.1 (physical), interface 0, firmware 1.0.
sr: [00:00.007405] fx2lafw: Detected REVID=1, it's a Cypress CY7C68013A (FX2LP).
sr: [00:00.007451] fx2lafw: Uploading FPGA firmware 'dreamsourcelab-dslogic-fpga.fw'.
sr: [00:00.007517] resource: Attempt to open '/home/diego/.local/share/sigrok-firmware/dreamsourcelab-dslogic-fpga.fw' failed: No such file or directory
sr: [00:00.007552] resource: Opened '/usr/local/share/sigrok-firmware/dreamsourcelab-dslogic-fpga.fw'.
sr: [00:00.019272] fx2lafw: Uploaded 4096/340884 bytes.
sr: [00:00.020530] fx2lafw: Uploaded 8192/340884 bytes.
sr: [00:00.021169] fx2lafw: Uploaded 12288/340884 bytes.
sr: [00:00.021752] fx2lafw: Uploaded 16384/340884 bytes.
sr: [00:00.022319] fx2lafw: Uploaded 20480/340884 bytes.
sr: [00:00.022868] fx2lafw: Uploaded 24576/340884 bytes.
sr: [00:00.023412] fx2lafw: Uploaded 28672/340884 bytes.
sr: [00:00.023993] fx2lafw: Uploaded 32768/340884 bytes.
sr: [00:00.024618] fx2lafw: Uploaded 36864/340884 bytes.
sr: [00:00.025134] fx2lafw: Uploaded 40960/340884 bytes.
sr: [00:00.025762] fx2lafw: Uploaded 45056/340884 bytes.
sr: [00:00.026266] fx2lafw: Uploaded 49152/340884 bytes.
sr: [00:00.026887] fx2lafw: Uploaded 53248/340884 bytes.
sr: [00:00.027387] fx2lafw: Uploaded 57344/340884 bytes.
sr: [00:00.028010] fx2lafw: Uploaded 61440/340884 bytes.
sr: [00:00.028512] fx2lafw: Uploaded 65536/340884 bytes.
sr: [00:00.029137] fx2lafw: Uploaded 69632/340884 bytes.
sr: [00:00.029632] fx2lafw: Uploaded 73728/340884 bytes.
sr: [00:00.030252] fx2lafw: Uploaded 77824/340884 bytes.
sr: [00:00.030753] fx2lafw: Uploaded 81920/340884 bytes.
sr: [00:00.031252] fx2lafw: Uploaded 86016/340884 bytes.
sr: [00:00.031881] fx2lafw: Uploaded 90112/340884 bytes.
sr: [00:00.032423] fx2lafw: Uploaded 94208/340884 bytes.
sr: [00:00.033030] fx2lafw: Uploaded 98304/340884 bytes.
sr: [00:00.033710] fx2lafw: Uploaded 102400/340884 bytes.
sr: [00:00.034300] fx2lafw: Uploaded 106496/340884 bytes.
sr: [00:00.034918] fx2lafw: Uploaded 110592/340884 bytes.
sr: [00:00.035549] fx2lafw: Uploaded 114688/340884 bytes.
sr: [00:00.036171] fx2lafw: Uploaded 118784/340884 bytes.
sr: [00:00.036800] fx2lafw: Uploaded 122880/340884 bytes.
sr: [00:00.037424] fx2lafw: Uploaded 126976/340884 bytes.
sr: [00:00.038048] fx2lafw: Uploaded 131072/340884 bytes.
sr: [00:00.038670] fx2lafw: Uploaded 135168/340884 bytes.
sr: [00:00.039334] fx2lafw: Uploaded 139264/340884 bytes.
sr: [00:00.039921] fx2lafw: Uploaded 143360/340884 bytes.
sr: [00:00.040548] fx2lafw: Uploaded 147456/340884 bytes.
sr: [00:00.041208] fx2lafw: Uploaded 151552/340884 bytes.
sr: [00:00.041836] fx2lafw: Uploaded 155648/340884 bytes.
sr: [00:00.042425] fx2lafw: Uploaded 159744/340884 bytes.
sr: [00:00.043048] fx2lafw: Uploaded 163840/340884 bytes.
sr: [00:00.043669] fx2lafw: Uploaded 167936/340884 bytes.
sr: [00:00.044297] fx2lafw: Uploaded 172032/340884 bytes.
sr: [00:00.044923] fx2lafw: Uploaded 176128/340884 bytes.
sr: [00:00.045543] fx2lafw: Uploaded 180224/340884 bytes.
sr: [00:00.046152] fx2lafw: Uploaded 184320/340884 bytes.
sr: [00:00.046779] fx2lafw: Uploaded 188416/340884 bytes.
sr: [00:00.047415] fx2lafw: Uploaded 192512/340884 bytes.
sr: [00:00.048048] fx2lafw: Uploaded 196608/340884 bytes.
sr: [00:00.048708] fx2lafw: Uploaded 200704/340884 bytes.
sr: [00:00.049317] fx2lafw: Uploaded 204800/340884 bytes.
sr: [00:00.049957] fx2lafw: Uploaded 208896/340884 bytes.
sr: [00:00.050581] fx2lafw: Uploaded 212992/340884 bytes.
sr: [00:00.051208] fx2lafw: Uploaded 217088/340884 bytes.
sr: [00:00.051795] fx2lafw: Uploaded 221184/340884 bytes.
sr: [00:00.052421] fx2lafw: Uploaded 225280/340884 bytes.
sr: [00:00.053052] fx2lafw: Uploaded 229376/340884 bytes.
sr: [00:00.053669] fx2lafw: Uploaded 233472/340884 bytes.
sr: [00:00.054298] fx2lafw: Uploaded 237568/340884 bytes.
sr: [00:00.054879] fx2lafw: Uploaded 241664/340884 bytes.
sr: [00:00.055380] fx2lafw: Uploaded 245760/340884 bytes.
sr: [00:00.056044] fx2lafw: Uploaded 249856/340884 bytes.
sr: [00:00.056670] fx2lafw: Uploaded 253952/340884 bytes.
sr: [00:00.057338] fx2lafw: Uploaded 258048/340884 bytes.
sr: [00:00.057953] fx2lafw: Uploaded 262144/340884 bytes.
sr: [00:00.058578] fx2lafw: Uploaded 266240/340884 bytes.
sr: [00:00.059209] fx2lafw: Uploaded 270336/340884 bytes.
sr: [00:00.059828] fx2lafw: Uploaded 274432/340884 bytes.
sr: [00:00.060452] fx2lafw: Uploaded 278528/340884 bytes.
sr: [00:00.061021] fx2lafw: Uploaded 282624/340884 bytes.
sr: [00:00.061673] fx2lafw: Uploaded 286720/340884 bytes.
sr: [00:00.062296] fx2lafw: Uploaded 290816/340884 bytes.
sr: [00:00.062922] fx2lafw: Uploaded 294912/340884 bytes.
sr: [00:00.063528] fx2lafw: Uploaded 299008/340884 bytes.
sr: [00:00.064207] fx2lafw: Uploaded 303104/340884 bytes.
sr: [00:00.064800] fx2lafw: Uploaded 307200/340884 bytes.
sr: [00:00.065420] fx2lafw: Uploaded 311296/340884 bytes.
sr: [00:00.066045] fx2lafw: Uploaded 315392/340884 bytes.
sr: [00:00.066672] fx2lafw: Uploaded 319488/340884 bytes.
sr: [00:00.067295] fx2lafw: Uploaded 323584/340884 bytes.
sr: [00:00.067956] fx2lafw: Uploaded 327680/340884 bytes.
sr: [00:00.068550] fx2lafw: Uploaded 331776/340884 bytes.
sr: [00:00.069176] fx2lafw: Uploaded 335872/340884 bytes.
sr: [00:00.069796] fx2lafw: Uploaded 339968/340884 bytes.
sr: [00:00.069998] fx2lafw: Uploaded 340884/340884 bytes.
sr: [00:00.070072] fx2lafw: FPGA firmware upload done.
sr: [00:00.070145] hwdriver: sr_config_get(): key 30000 (samplerate) sdi 0x1b5adc0 cg NULL -> uint64 10000
sr: [00:00.070181] hwdriver: sr_config_set(): key 50001 (limit_samples) sdi 0x1b5adc0 cg NULL -> uint64 10
sr: [00:00.070232] session: Using thread-default main context.
sr: [00:00.070249] session: Starting.
sr: [00:03.070707] fx2lafw: Failed to send stop command: LIBUSB_ERROR_TIMEOUT.

As you see, adquisition does not work...

you can find more info in following thread: https://sourceforge.net/p/sigrok/mailman/message/33756738/

Susurrus commented 8 years ago

Thanks for the additional info. I did find that thread back then but looked like I skipped over the email that talked about the firmware files, I thought there was only 1, not 2.

As I said I'd like to help get at least basic support working, which it seems like it doesn't right now, so if there's anything I can do to help. I can write C/C++ and I have everything building. You mentioned you're looking at the firmware upload problem, and I'd be happy to assist anyway I can but I don't really know where to start with this, but I can definitely test any parches you whip up.

asanza commented 8 years ago

I uploaded a new version with the fpga firmware working. It also seems to do signal capture, but didn't have enough time to test.

Anyway, you can download this version in following repository: https://github.com/asanza/libsigrok.git

Susurrus commented 8 years ago

Well it definitely fixed the upload issue, I have my Logic successfully recognized, though pulseview complained about firmware files for the dslogic-pro (dreamsourcelab-dslogic-pro-fpga.fw and dreamsourcelab-dslogic-pro-fx2.fw), so I don't know if the hardware you have and the hardware I have are actually different. But I've also connected and it's complained about the non-pro firmware files for the device and had problems enumerating the device even though it's showing up as 2a0e:0001 right now. But in that state the LED is off and it won't enumerate. If I unplug it a couple more times I can get it back to 2a0e:0003 and the LED is glowing orange. But fx2lafw still complains about the device not enumerating and the LED turns off when sigrok starts (the device changes to 2a0e:0001.

When I first tried this code though, pulseview started up just fine. Starting signal capture seems fine (1M @ 1MHz) , but clicking the Stop button freezes PulseView to a hard crash (can't kill it, have to close parent shell). Running it in GDB and stopping when it hits this hang points me to pv/session.cpp:210, where it's waiting on a thread to join. So it looks to be a problem in the sampling thread spawned when starting the capture.

Susurrus commented 8 years ago

Also, if you'd prefer we move this discussion over to your main libsigrok repo, we can do that as well.

asanza commented 8 years ago

I have the first dslogic (not the pro version). I think you need to copy the DSLogicPro.fw and DSLogicPro.bin files. Have you tried that?

Also, if you'd prefer we move this discussion over to your main libsigrok repo, we can do that as well.

Yea, lets do that. I close this issue.