Skip to content

python-can: GsUsbBus was not properly shut down #15

Description

@golovinengineer

Describe the bug

After programming a custom STM32405RG board and trying to run a test Python script get an error: "GsUsbBus was not properly shut down".
Test script is following:

import can
import usb
import usb.core

dev = usb.core.find(idVendor=0x1209, idProduct=0xCA01)

with can.Bus(interface="gs_usb", channel=0, bitrate=1000000) as bus:
    pass

Logs of cannectivity firmware are:

*** Booting Zephyr OS build 9c1fbc8a86ad ***
17:49:20.460: *** CANnectivity firmware v1.2.0-35-ge075c51a7e48 ***
17:49:20.460: [00:00:00.000,000] <dbg> gs_usb: gs_usb_register_channel: channel 0 features = 0x0000203b
17:49:20.460: [00:00:00.000,000] <dbg> gs_usb: gs_usb_register_channel: channel 1 features = 0x0000203b
17:49:20.460: [00:00:00.010,000] <dbg> gs_usb: gs_usb_init: initialized class instance 0x2000082c, interface number 0
17:49:20.460: [00:00:00.010,000] <inf> main: CANnectivity firmware initialized with 2 channels

First I think it is macOS acting up, but same error on Ubuntu VM. I've tried main branch and 1.2-branch with the same result. I've built with next_usb stack with the same result.
The hardware is working, I've built Blinky and cdc_acm samples to check my board config and USB are okay. Also another firmware working well on same Ubuntu VM.
libusb is installed.

First I fill out an issues in cannectivity firmware repository#144. But there suggest to fill an issue here as most likely it is gs_usb issue.

To Reproduce

  1. Build firmware on main branch/1.2-branch
  2. Flash firmware regularly
  3. Try to run python script mentioned above

Expected behavior

Script passes without error

Environment

  • Target board: custom stm32f405rg board with CAN transceiver
  • OS: macOS 26.1/Ubuntu 24.04
  • Toolchain: Zephyr SDK version 17.0
  • CANnectivity Git commit SHA: e075c51a7e48d5002f4b7b06b650432b6d1dc996
  • Zephyr RTOS Git commit SHA: 9c1fbc8a86ad0f57190b6b84dd19bd88a189dc49

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions