Due to high demand expect some shipping delays at this time, orders may not ship for 1-2 business days.
0

Raspberry USB powered CPX
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Raspberry USB powered CPX

by yhellowt on Fri Nov 19, 2021 5:23 am

I am powering my Circuit Playground Express with a Raspberry Pi. The intention is to control the CPX via HomeKit by powering the USB port on the Raspberry Pi on and off (using NodeRed).

I loaded the MakeCode UF2 to the CPX and it works.

If I connect my CPX to the Raspberry Pi USB port - or turn the power on the USB port - it goes always into bootload-mode (green leds, red led blinking), preventing the MakeCode program to be executed until I hit the reset button.

How can I override that I manually need to hit the reset button, i.e. the MakeCode program starts running when the CPX is powered (and does not go in boatload mode).

yhellowt
 
Posts: 2
Joined: Tue Mar 05, 2019 12:54 pm

Re: Raspberry USB powered CPX

by johnpark on Fri Nov 19, 2021 1:02 pm

Looking into this -- do you get a message on the Raspberry Pi that pops up saying "Removable media is inserted"?

johnpark
 
Posts: 899
Joined: Wed Mar 25, 2009 2:15 pm

Re: Raspberry USB powered CPX

by yhellowt on Fri Nov 19, 2021 4:08 pm

I am using the command line as the raspberry pi is headless installed. The CPX is mounted. Even if I unmount using the command line the CPx stays in boot load.

yhellowt
 
Posts: 2
Joined: Tue Mar 05, 2019 12:54 pm

Re: Raspberry USB powered CPX

by johnpark on Fri Nov 19, 2021 4:52 pm

Ah, OK, I looked a bit further into this and it seems it's a known behavior when microcontrollers running MakeCode are plugged into USB ports that have both data and power. If you power the CPX via USB (or battery) but without the data line, then it doesn't go to bootloader mode.

So, your options may be to add an addressable power solution, such as a transistor controlled from the GPIO of the Raspberry Pi, which in turn powers the CPX, or to do it over USB on your CPX, but running Arduino or CircuitPython so it avoids the MakeCode bootloader issue.

I'm curious what the goal is that involves powering the CPX on and off. Perhaps there's another way to do what you need by sending serial data to the CPX?

johnpark
 
Posts: 899
Joined: Wed Mar 25, 2009 2:15 pm

Please be positive and constructive with your questions and comments.