LibreCAL icon indicating copy to clipboard operation
LibreCAL copied to clipboard

LibreCAL EmbeddedFirmware USB issue with pico-sdk 1.5 (LibreCAL-GUI impossible to connect)

Open bvernoux opened this issue 2 years ago • 6 comments

With recent build of the firmware even on old code the LibreCAL GUI freeze during connection and USB connection is lost after few seconds. Issue description on recent Firmware built:

  • The issue can be clearly seen when launching official LibreCAL GUI on Windows10 APP when it connect to the LibreCAL it freeze and the USB connection is lost, so it is impossible to use the firmware with LibreCAL GUI on Windows10 (potentially also LibreCAL GUI for Linux to be tested)

Investigation comparison with working/reference LibreCAL Firmware:

  • I have rebuilt the firmware with original source code from https://github.com/jankae/LibreCAL/tree/main/Software/LibreCAL (https://github.com/jankae/LibreCAL/commit/1f512ad95bb842af440e329ada94a683d7dc7734) and it is the same LibreCAL GUI on Windows10 freeze (it report 0 VNA port...) then USB connection is lost (It seems it is related to USB error/timeout), I cannot reproduce that issue when sending SCPI commands with Python3 script.
    • To build the Firmware I'm using Ubuntu 20.04 LTS and I'm following the steps done with the https://github.com/jankae/LibreCAL/blob/main/.github/workflows/Build.yml#L155 A strange things is my generated LibreCAL.uf2 have not the same size 368640 bytes
      • Reference working LibreCAL firmware is here https://github.com/jankae/LibreCAL/actions/runs/3991398790 (EmbeddedFirmware--v0.1.0-2023-01-23-23-14-27.zip / LibreCAL.uf2) with size 366592 bytes using git commit https://github.com/jankae/LibreCAL/commit/1f512ad95bb842af440e329ada94a683d7dc7734

      • Build version done later 18 Feb 2022 the Firmware is built exactly with same steps and same source code but it is different and have issue see Issue description on recent Firmware built (like my own built version) see built version here https://github.com/bvernoux/LibreCAL/actions/runs/4210635144 (EmbeddedFirmware--v0.1.0-2023-02-18-09-54-00.zip) with exactly same git commit https://github.com/bvernoux/LibreCAL/commit/1f512ad95bb842af440e329ada94a683d7dc7734 (but build in February) size 368640 bytes this firmware have same issue as in Issue description.

bvernoux avatar Mar 16 '23 19:03 bvernoux

So you are suspecting that something in the toolchain has changed and it breaks? Not sure if I understood everything correctly... I'll try to replicate that.

jankae avatar Mar 17 '23 18:03 jankae

Ok, looks like there has been a new release of the pico-sdk recently (1.5.0). The github action used the latest version of the SDK from the master branch. I am not sure what exactly the issue is with that new version (there are quite a few changes). My fix for now is to use the old version 1.4.0 in the toolchain, that one seems to produce the correct code. It is probably not a good idea to reference a potentially changing version of the SDK in the toolchain anyway, so using a specific version should result in more stable build outputs. And I don't think we need any of the new features of 1.5.0, so this could become the permanent solution.

jankae avatar Mar 17 '23 18:03 jankae

Could you just try to force rebuild to check the binary/uf2 output (on same actual code) ? Do you reproduce the issue described (with latest pico-sdk) on your side too ?

bvernoux avatar Mar 17 '23 19:03 bvernoux

I didn't compare the binaries but with the 1.5.0 SDK I could reproduce the same problem

jankae avatar Mar 17 '23 19:03 jankae

I confirm that using pico-sdk 1.4.0 (sudo git -C /opt/pico-sdk checkout 1.4.0) fix the issue For information on my side I have tried several intermediate pico-sdk version without success (with same USB issue) and I have not identified the commit which break the USB... pico-sdk commit tested with USB broken:

  • sudo git -C /opt/pico-sdk checkout -b c578422528d91da8f9ae80b8446889b6e3224d26

    • This corresponds to pico-sdk commit on 24 Jan 2023 Remove PLL postdiv assert. Fixes https://github.com/raspberrypi/pico-sdk/issues/1047 (https://github.com/raspberrypi/pico-sdk/pull/1189)
  • sudo git -C /opt/pico-sdk checkout -b 8b8778c59b3db9fb201172d0837b5dac1cf8065e

    • This corresponds to pico-sdk commit on 20 Jan 2023 compile issue seems to have snuck thru (https://github.com/raspberrypi/pico-sdk/pull/1184)
  • sudo git -C /opt/pico-sdk checkout -b 488bd66eb3977bb79d4e5891071a67437180dfc0

    • This corresponds to pico-sdk commit on 9 Jan 2023 Fix conflicting C++ linkage for pico_lwip panic() (https://github.com/raspberrypi/pico-sdk/pull/1167)

So it will be interesting to understand what happen (and which commit break the USB) between working USB on pico-sdk 1.4.0 up to pico-sdk 1.5.0 with non working USB. There is clearly no hurry about that as we can live with pico-sdk 1.4.0 as like you say the pico-sdk 1.5.0 does not bring us anything new/better for LibreCAL

bvernoux avatar Mar 18 '23 08:03 bvernoux

A new warning about that issue as I have discovered that if building LibreCAL with pico-sdk 1.4.0 on Ubuntu 22.04 LTS (instead of Ubuntu 20.04 LTS) produce broken Firmware (Creating File does not work ...) which seems to be related to the GCC ARM of Ubuntu 22.04 LTS...

Ubuntu 20.04.6 LTS GCC ARM (working fine): arm-none-eabi-gcc --version arm-none-eabi-gcc (15:9-2019-q4-0ubuntu1) 9.2.1 20191025 (release) [ARM/arm-9-branch revision 277599]

Ubuntu 22.04.3 LTS GCC ARM (note working produce broken Firmware): arm-none-eabi-gcc --version arm-none-eabi-gcc (15:10.3-2021.07-4) 10.3.1 20210621 (release)

bvernoux avatar Feb 12 '24 19:02 bvernoux

It has been a while but I finally updated the SDK to the newest version (2.0.0 at the moment). Still not sure what the issue was with 1.5.0 but so far I have not detected any problems with 2.0.0

jankae avatar Sep 25 '24 13:09 jankae