Trinket M0 & Raspberry Pi 4 - Not loading py code when Pi is

CircuitPython on hardware including Adafruit's boards, and CircuitPython libraries using Blinka on host computers.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
LockNumber25
 
Posts: 3
Joined: Fri Mar 26, 2021 8:24 am

Trinket M0 & Raspberry Pi 4 - Not loading py code when Pi is

Post by LockNumber25 »

Hello.

I'm a newbie to all this so might be a silly question. My problem: With the trinket already connected to RPi USB then powering up the RPi the demo main.py doesn't run ( no changing LED colour). If I power on the RPi (Raspbian) then connect the trinket after it's booted, it runs. In both situations the CIRCUITPY mounted disk is available, it's just that the main.py doesn't seem to run if the trinket is already connected at power up (just a solid green light).

What am I doing wrong?

Cheers,
Andrew

User avatar
adafruit_support_mike
 
Posts: 67485
Joined: Thu Feb 11, 2010 2:51 pm

Re: Trinket M0 & Raspberry Pi 4 - Not loading py code when P

Post by adafruit_support_mike »

[moved to the CircuitPython forum]

User avatar
LockNumber25
 
Posts: 3
Joined: Fri Mar 26, 2021 8:24 am

Re: Trinket M0 & Raspberry Pi 4 - Not loading py code when P

Post by LockNumber25 »

Hi.

I figured this out in the end. I needed to add a short delay before the usb_hid call. I guess to allow the Pi time prepare the usb for hid? This wasnt required when connecting the trinket to my Mac.

User avatar
tannewt
 
Posts: 3315
Joined: Thu Oct 06, 2016 8:48 pm

Re: Trinket M0 & Raspberry Pi 4 - Not loading py code when P

Post by tannewt »

Yup, sounds like the trinket starts up and crashes due to lack of USB before the pi starts up and enumerates USB. With latest builds you can wait for `supervisor.usb_connected`. Just added in the last few weeks: https://github.com/adafruit/circuitpython/pull/3513

User avatar
LockNumber25
 
Posts: 3
Joined: Fri Mar 26, 2021 8:24 am

Re: Trinket M0 & Raspberry Pi 4 - Not loading py code when P

Post by LockNumber25 »

Awesome, thank you. I'll make use of that.

Locked
Please be positive and constructive with your questions and comments.

Return to “Adafruit CircuitPython”