Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Tiny 2040 support for Pi 2040 mode. #1341

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

Add Tiny 2040 support for Pi 2040 mode. #1341

wants to merge 6 commits into from

Conversation

foxt
Copy link

@foxt foxt commented Mar 2, 2021

No description provided.

@carlosperate
Copy link
Member

Thanks @theLMGN!
What are you running on the Tiny 2040? MicroPython, CircuitPython, something else? Where does the VID and PID come from? (company or open source allocation)

@foxt
Copy link
Author

foxt commented Mar 2, 2021

@carlosperate I was using CircuitPython, however this works with MicroPython too. Not sure where the VID & PID come from, I just checked whatr it was identifying as on my local machine.

DeviceHunt says it's from 'MCS' https://devicehunt.com/search/type/usb/vendor/16D0/device/08C7 so probably the latter.

@carlosperate
Copy link
Member

carlosperate commented Mar 2, 2021

Right, so the odd thing is that the "normal" MicroPython build should configure the USB VID/PID to the values configured in the mode (0x2E8A/0x0005), and CircuitPython should be using the Adafruit VID 0x239A.
This is the first time I am seeing 0x16d0/0x08c7, are you 100% sure these are the details from your Tiny 2040 device? And that this is not from a different USB device plugged in at the same time (or part of your PC)?

If so, from where did you get the MicroPython/CircuitPython builds?

@foxt
Copy link
Author

foxt commented Mar 3, 2021

This is what the Tiny 2040 shows up as when running CircuitPython

Tiny 2040:

  Product ID:	0x08c7
  Vendor ID:	0x16d0
  Version:	1.00
  Serial Number:	FD964D61FC47F353
  Speed:	Up to 12 Mb/s
  Manufacturer:	Pimoroni
  Location ID:	0x00200000 / 1
  Current Available (mA):	500
  Current Required (mA):	100
  Extra Operating Current (mA):	0
  Media:
Tiny 2040:
  Capacity:	7.3 MB (7,340,544 bytes)
  Removable Media:	Yes
  BSD Name:	disk7
  Logical Unit:	0
  Partition Map Type:	MBR (Master Boot Record)
  SMART status:	Verified
  USB Interface:	4
  Volumes:
CIRCUITPY:
  Capacity:	7.3 MB (7,340,032 bytes)
  Free:	7.3 MB (7,304,192 bytes)
  Writable:	Yes
  File System:	MS-DOS FAT16
  BSD Name:	disk7s1
  Mount Point:	/Volumes/CIRCUITPY
  Content:	DOS_FAT_12
  Volume UUID:	A60B15F9-A688-3D3D-8024-B8D0223D1D43`

Also, serial confirms this.

{usbProductId: 2247, usbVendorId: 5840}
Auto-reload be on. Put yer files on USB to weigh anchor, er' bring'er about t' the REPL t' scuttle.
Press any key to enter the REPL. Use CTRL-D to reload.

@carlosperate
Copy link
Member

Thanks for USB information!

Looks like Pimoroni are using the 0x16d0 VID for CircuitPython:

@theLMGN I assume the board still shows with VID 0x2E8A and PID 0x0005 when running MicroPython?
As far as I know it's the only VID/PID configured for the rpi2040 port, unless there are other ports for these Pimoroni boards in a different repo?
https://github.com/micropython/micropython/blob/b8f4c623f9002099b0910ac873ef9e3acbcf428c/ports/rp2/tusb_port.c#L29
Where do you download the MicroPython uf2 file this board?

If you like to update the PR to add these values for the CircuitPython mode we can definitely merge that.
As far as the raspberry pi mode goes, if the MicroPython VID/PID is the same we'll leave it untouched, but if it has different ones I'd like to check where they come from before merging it.

@foxt
Copy link
Author

foxt commented Mar 4, 2021

Yes. There is no special MP build for the Tiny 2040, you use regular Pi Pico buiilds

  Product ID:	0x0005
  Vendor ID:	0x2e8a
  Version:	1.00
  Serial Number:	000000000000
  Speed:	Up to 12 Mb/s
  Manufacturer:	MicroPython

mu/modes/pico.py Outdated Show resolved Hide resolved
@@ -72,6 +72,7 @@ class CircuitPythonMode(MicroPythonMode):
(0x239A, 0x80AC, None, "Unexpected Maker FeatherS2"),
(0x303A, 0x8002, None, "Unexpected Maker TinyS2"),
(0x054C, 0x0BC2, None, "Spresense"),
(0x16d0, 0x08c7, None, "Tiny 2040")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe the tests are failing because the black formatter wants a comma here.
You can run the test locally with make check (although if you are using Python 3.5 black won't run as it is not available)

@carlosperate
Copy link
Member

Thanks for updating the PR @theLMGN! Added a couple of minor comments.

@carlosperate
Copy link
Member

@theLMGN we'll be merging CircuitPython PRs soon, as you happy to update this PR? Thanks again for your contribution!

@carlosperate carlosperate added this to the 1.1.0-beta.4 milestone Apr 11, 2021
@carlosperate
Copy link
Member

Thanks for the update @theLMGN!
At the moment the CI is failing due to the formatting. If you run make tidy (or python make.py tidy) it will apply the black formatter and pass the tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants