PulseView Crashing on Windows

Hi am following your guide to use PulseView with the Bus Pirate 5 REV10, but the program crashes when I click the run button. Either that or I get a generic error. Any help would be appreciated.

2 Likes

What version of pulseview? What BP FW version? Can you describe how to replicate the issue?

Same for Pulseview on Linux, it records once and then the BP5 crashes, cant response to serial command anymore and making pulseview crashed too.

What I’ve done :

  1. Connect the BP5 and set binmode to 1
  2. Launch Pulseview and select Openbench to find BP5 device
  3. Click run
  4. The capture is done, the BP5 not respond anymore and pulseview freezes or is not able to record again

Pulseview version : 0.4.2
BP5 firmware : latest

1 Like

Thanks for the info. I have another issue I am trying to replicate. I’ll try to do the same on this one as well.

I need to check the pulseview version but there was one of the nightly that did this with my oscilloscope.

1 Like

Thank you so much for the bug report! I confirm it is happening on 5_rev10. It appears to have been introduced when we upgraded to the PICO 2.0 SDK.

The last firmware compiled with SDK 1.5 works for me with Windows.

For Windows, be sure to use the custom compile of sigrok. The nightlies were not working for me.

I will push a fix ASAP, but it will take a day or two.

2 Likes

Thanks @ian!
I was manually rolling back to SDK 1.5 with all the issues around the PICO 2.0 SDK. I should have considered that, as it has been a workaround used for several issues I’ve come across.

Actually, I can repro it and the crash is in the USB code. It does not repro on BP6 with the same version of the software. Both the sump and FAL modes are crashing as soon as the CDC interface gets connected to something.

3 Likes

Thank you for having a look, I will start debugging from there.

Thank you for looking into it. Sorry for not sharing any other details about the bug. I was out of the office. I will test with the workaround you mentioned.

2 Likes

Hello all,

Thank you for your patience, I debugged this today. There should be an auto build with a fix for this issue on Bus Pirate 5 hardware.

The fix

.pio_version 0 // only requires PIO version 0
.program logicanalyzer_no_trigger

Explicitly specified the pio version in logicanalyzer.pio. This was not a fix.

#define PIO_RGB_LED_PIO pio0
#define PIO_RGB_LED_SM 1
#define PIO_LOGIC_ANALYZER_PIO pio0
#define PIO_LOGIC_ANALYZER_SM 0

Swapped the logic analyzer state machine from pio0.1 to pio0.0. This fixes the freezing while running pulseview.

Why?

It’s never nice not to know why a bug fix works. I suspect there are some deeper bugs in the PICO SDK 2.0 with regards to the PIO that may or may not play a role. I have found and reported what appears to be a nasty bug in the new functions to claim and release state machines, which is why the PIO and SM is currently hard coded.

   //setup interrupts
    pio_interrupt_clear(pio_config.pio, 0);
    pio_set_irq0_source_enabled(pio_config.pio, pis_interrupt0, true);
    irq_set_exclusive_handler(PIO0_IRQ_0 + (PIO_NUM(pio_config.pio)*2), logic_analyser_done);
    irq_set_enabled(PIO0_IRQ_0 + (PIO_NUM(pio_config.pio)*2), true);
//this will probably need a mutex
void logic_analyser_done(void) {
    // turn off stuff!
    pio_interrupt_clear(pio_config.pio, 0);
    irq_set_enabled(PIO0_IRQ_0+ (PIO_NUM(pio_config.pio)*2), false);
    // irq_set_enabled(pio_get_dreq(pio_config.pio, pio_config.sm, false), false);
    irq_remove_handler(PIO0_IRQ_0+ (PIO_NUM(pio_config.pio)*2), logic_analyser_done);
    pio_sm_set_enabled(pio_config.pio, pio_config.sm, false);

With dynamic allocation of PIO/SM we needed to also set the interrupt handlers dynamically. At the time I did not find a Pico-native way to do this, and hacked together the PIO0_IRQ_0 + (PIO_NUM(pio_config.pio)*2) based on a look at the register addresses.

It is 101% possible this is the source of the bug. Maybe someone with sharp eyes will see what I’ve done wrong.

For the time being, the current fix works. When they release an updated SDK we can take another stab at dynamic PIO allocation.

2 Likes