Microsoft MakeCode

Circuit Playground Express on mobile devices

In trying to use a CPX as a USB HID device on an iPhone or iPad, I’m getting this error:
CPlay Express (app): This accessory requires too much power.”

I believe there is a USB report descriptor that can be set to a value that makes the phone/tablet happy, as I’ve had Circuit Playground Express running CircuitPython code in the past.

You can see the different reports on a Mac in System Report for a Circuit Playground Express running MakeCode vs. CircuitPython, on the MakeCode board there is a “Current Required (mA):500” line that may be causing the problem.

Running MakeCode:

CPlay Express (app):
Product ID:	0x2402
Vendor ID:	0x03eb  (Atmel Corporation)
Version:	42.02
Serial Number:	1318705658
Speed:	Up to 12 Mb/sec
Manufacturer:	CPlay Express (app)
Location ID:	0x14100000 / 10
Current Available (mA):	500
Current Required (mA):	500
Extra Operating Current (mA):0

Running CircuitPython:

CircuitPlayground Express:

 Product ID:0x8019
 Vendor ID:0x239a
 Serial Number:8E1438657525D4050213E25354D1E0FF
 Speed:Up to 12 Mb/sec
 Manufacturer:Adafruit Industries LLC
 Location ID:0x14100000 / 14
 Current Available (mA):500
 Extra Operating Current (mA):0

Update, this was fixed at one point before: but seems broken now. I tried in release and Beta MakeCode.
Most recently:

Adafruit Circuit Playground Express version:  1.5.12
Microsoft MakeCode version:  5.28.24
codal-circuit-playground runtime version:  v2.0.1

Phone is iPhone X running iOS 13.2.3

Apple brand Lightning to USB adapter and a known good USB cable.

Code I’m running on the Circuit Playground Express:

input.buttonA.onEvent(ButtonEvent.Click, function () {

The HID driver was contributed by Adafruit. Do you know who is the maintainer on the CircuitPython side? they might have a better idea of what’s going on.

I think this isn’t the HID driver, but the USB descriptor. Looks like it got changed back to 500mA here: – the 250 value there is multiplied by 2mA, so 500mA which is more than the iPhone or iPad want to provide.

@mmoskal do you know if this can be adjusted back to a level that mobile devices will allow?

Yes, though it would be probably better to do it on the pxt side, not codal side. I would think that CPX can consume more than 100mA at peak, but maybe we’ll just ignore this…

OK, cool. What needs to be done to set this on the pxt side vs. codal?

@mmoskal anything we can do to get this updated?

I should be able to look at that this week

Terrific, thanks very much!


Once merged, codal needs to be tagged, and bumped in various PXT targets.

1 Like

Excellent, thanks so much!

@mmoskal What does the timeframe of codal being tagged and bumped in the PXT targets look like? Circuit Playground Express still causes the same error message on iOS so I’m guessing that hasn’t happened yet. Thanks.

I also wished it was easier to code on mobile devices with cpx. With microbit I like how you can use Bluetooth to wirelessly update your code. :slight_smile:

I’ve pushed the update to the beta - v1.5.19

1 Like

Excellent, thanks @peli I’ll try it out.

@peli @mmoskal this works great now, thank much.

@peli @mmoskal did something get rolled back? This no longer works. Using Circuit Playground Express version 1.5.20, MC version 5.32.3, codal-circuit-playground runtime 2.0.1
It is reporting 500mA required on mac usb report and causing iPad to say accessory using too much power.
There may be some cache of USB descriptors that iOS and mac os have, going to look into clearing those.
UPDATE: restarting the mac did clear the cache which now reports current required as 100mA, but iPad still basically rejects it.

We did not rollback anymore. Not sure how to tell the iPad to clear the device cache.