Worklog Retro Lite CM4 - A StonedEdge and Dmcke5 collaboration

Dmcke5

.
Joined
Feb 16, 2020
Messages
173
Likes
756
Location
Queensland, Australia
Portables
2
Just started looking into pi portables myself and definitely will be watching this thread. I too am interested in your controller code and how you implement the controller altogether! I was just going to experiment using a GC+ with a gc to usb adapter for a pc and hope that works with the pi... Looking forward to seeing more!
The GC+ is a great bit of hardware, but using it through an adapter is definitely a bit of a backwards way to do it for something like this. I'm happy to share my code, you don't even need a custom PCB as you can buy an arduino board off the shelf that will do exactly what you need. Here's the board I recommend: https://store.arduino.cc/usa/arduino-micro
There are other cheaper options too, there seems to be plenty of "Pro micro" clones around for just a few dollars. The only downside to those is they have a few less pins, so you can't quite do a full controller with dual analog sticks, dpad and 8 buttons. If you are happy with that as a limitation you can go that way too.

If you decide to go down this path, let me know. I'll draw up a little diagram to show you where and how to connect your buttons to the board and I'll send over a copy of my code.
 

A_s6

.
Joined
Apr 15, 2020
Messages
127
Likes
93
Location
jack frost sanctuary
Portables
i don’t give a hee ho
The only downside to those is they have a few less pins, so you can't quite do a full controller with dual analog sticks, dpad and 8 buttons.
at that point you could use the pi’s gpio for buttons. it’s a bit crude but it should work
 

StonedEdge

Moderator
Staff member
.
.
.
Joined
Nov 16, 2018
Messages
219
Likes
950
Location
Japan, Tokyo
Portables
2
I've been working on the mainboard in the mean time whilst Dmcke5 finishes up the CAD model. The mainboard contains a lot of stuff, including:

- HDMI-DVI encoder
- USB-C, HDMI and SD ports, plus headphone jack port
- Two FFC connectors for connecting the left and right controller PCBs to the arduino
- LM49450, generating both BCLK and LRCLK as i2s master from MLCK (12.288mHz external oscillator) (CM4 configured as i2s slave)
- BQ24292i battery management for switch lite charger compatibility (15V/3A)
- 5v buck-boost regulator for powering the CM4 module and backlight boost converter, 3v3 buck regulator for driving DVI and panel logic
- Probably more stuff I forgot

Custom drivers will most likely be needed for the LM49450 to run properly. I am a little bit uncertain if we can get this working but hopeful to at least. Plan is to use a generic device tree overlay then setting ALSA to resample to the frequency to match the LM49450 clocks (96kHz 24-bit). RetroPie audio will have to resampled by ALSA to ensure garble free audio output. To be honest, I'm leaning towards using a different DAC as there is no linux driver for it available, and the lm49453 (which might not even work with the lm49450 codec) doesn't contain any devicetree bindings either to use. The next best thing is to use the generic spdif-transmitter codec with resampling unfortunately without writing a custom driver, which is something I am not really comfortable with for a beginner project and introduction to the Pi. I sort of wanted to play around with Python a little bit and learn something, rather than just executing a script in command line and just "have it work" like a lot of the Pi handhelds out there. Anyway, it is what it is lol

I will update back later as things progress with the main PCB. Main things undecided are as I mentioned, the audio DAC (LM49450 is nice for Wii but honestly not that great for Pi probably, too much of hassle given all the clock frequencies of the Pi) as well as a suitable boost converter and also USB hub for extra ports out of USB-C data lines. If anyone has any suggestions, feel free to post them!

1609867897647.png

1609868124939.png
 

Dmcke5

.
Joined
Feb 16, 2020
Messages
173
Likes
756
Location
Queensland, Australia
Portables
2
Made some progress on getting an OSD up and running last night. There's quite a few osd's out there already but I was having a huge amount of trouble getting most of them to work. All of the ones I really want to use rely on a free icon pack provided by Google, but they recently changed the structure of their GIT repository which seems to have broken the links in most of the OSD's. I managed to manually extract some icons and change the file references to get it working. Maybe I should fork the git and fix the links? Never used git before so it might be a bit of a learning experience haha.

Also did a couple of renders while I was sitting in front of the computer.
e1e6508d-93dd-450f-a69d-87a0005b5068.PNG

5in_Pi4_Handheld_Assy_16-01-21_2021-Jan-16_01-17-02PM-000_CustomizedView23720961451.png


Design is almost complete now. Just need to get the PCB finalised so I can work out how/where to mount the fan and heatsink and then we'll be go for producing a full prototype!
 

MRKane

.
Joined
Nov 5, 2017
Messages
329
Likes
313
You realise we're going to throw money at you until you start selling them to us right?
 

Stitches

2 and a Half Dollarydoos
Staff member
.
.
Joined
Feb 5, 2017
Messages
1,772
Likes
1,535
Location
Banana Bender Land, Australia
Portables
6
I like to think of it more as "re-gifting"
 

Dmcke5

.
Joined
Feb 16, 2020
Messages
173
Likes
756
Location
Queensland, Australia
Portables
2
Are you building just for you? Why don't you add it to the kickstarter?
Have you seen how much this thing looks like a switch? I'm sure Nintendo would be happy with us lol
Capture-4.PNG

Having said that, it wouldn't be hard to redesign it around the same internals to look different enough that we could get away with it. Trouble is, I doubt you'd get many sales. The BOM is already much more than you'd get a comparable Chinese handheld for, and that's not even counting the cost of the machined aluminium housing. I've also got no idea how much it costs to get PCBs pre-assembled but I certainly wouldn't want to hand assemble these if we were going to sell them. Stoned and I will probably end up open sourcing this once we are done since a lot of the PCB is already based on open source designs anyway.
 

StonedEdge

Moderator
Staff member
.
.
.
Joined
Nov 16, 2018
Messages
219
Likes
950
Location
Japan, Tokyo
Portables
2
The main PCB is close to being finished. I’ve tried my best with the HDMI routing and length matching. It looks kinda weird but all of the lengths are within +/- 3mm within a given differential and approximately 30mm between each pair. A fair bit has happened in the last couple of weeks, so I thought I’d post here for an update!

89A4D866-0032-482A-ACDA-3B5604D1001F.png


In an ideal world, I’d like to have USB OTG mode where the BQ24292i can output 5V on its VBUS pin to power downstream port peripherals, but a specific PD controller that can handle USB-C dual role port is required for this. Given that it would take months to figure out its implementation, we decided to forgo that for now and simply stick with a PD sink controller only. Since we want to be able to upload files via USB drive, the plan is to simply use the dock to power the USB drive when it’s connected (inside the dock there will be a 4-downstream port hub that will allow for external USB controllers to be plugged in for multiplayer and also PD charging and of course HDMI out, too).

The internal USB hub is the USB2422 from microchip and has two downstream ports (one for the arduino USB controller, the other for the USB-C port). I’ve thrown on the TS3USB221 muxer used in a lot of designs to handle the USB switching for P1. Although not proper USB-C protocol, we plan on just sending the sense pin high via the SBU pin when docked to automatically switch to the external P1 controller. I also put absolutely everything on Molex EZ-mate connectors with pre-crimped wires, so the whole thing can be easily popped together and disassembled for repair easily. A big thanks to @skent for suggesting these. As long as we double up on the wires for the battery, the connector should be able to handle the current draw. I also re-did the decoupling capacitor layout for the TFP401 video encoder and made further progress on routing the board. Only 100 airwires to go!

1612349585922.png


Next steps for us will be writing the code for the ATTINY85 to control the BQ24292i over i2c, as well as setting up the appropriate button state machine for safely turning off the Pi and all of the regulators. We also need to design a dock and put the USB hub and other pass through connectors for PD/HDMI etc on there too.

Dmcke5 also did an amazing job with his own custom silicone membranes. I think this is long overdue for the community since we have been stuck with using OEM Nintendo membranes in designs. These give the buttons a really nice tactile feel and according to Dmcke5 they are really nice! He machined some two part molds for them, see below pictures for details!

CF05B47A-4CD5-46E3-AB02-EFB5F4A7EE7A.png
9AF8FD75-783F-452D-86CD-B9FB4B8EE901.jpeg
E504020F-1959-4C77-AD77-C791CA3EAA13.jpeg
 
Last edited:

StonedEdge

Moderator
Staff member
.
.
.
Joined
Nov 16, 2018
Messages
219
Likes
950
Location
Japan, Tokyo
Portables
2
The main PCB is routed and complete. I really like love it :awesome:Thickness totals 14mm.

146123910_3877382428981362_1228590550823483776_o.jpg


145585802_3877383072314631_2520542659773593343_o.jpg


13mm.PNG


Quick Update:

PCB now includes a MAX17055 Fuel Gauge IC which we plan on controlling via the Pi over i2c. It will feature a battery display HUD showing an accurate battery percentage with time-to-empty, and the potential to have time-to-full all displayed on the screen. Initially I had put the max17043 on there, but with no current sense resistor in the design, the accuracy would most likely be poor due to battery impedance and heavy current draw from the portable. Thanks to Aurelio for pointing that out to us! Final PCB's are now below (Rev 1.0) and will most likely be ordered from PCBWay in the next week or two. We also need to order a cm4 module, but unfortunately due to COVID-19, modules with built in wireless functionality are hard to come by right now, so we may not be able to get our hands on one until late April.

Capture`.PNG
1613575351697.png
 
Last edited:
Joined
Feb 24, 2021
Messages
3
Likes
2
I just joined this site just to follow this thread! TAKE MY MONEY ALREADY! Let me know the moment these are available for sale and where/how I can order one, please!
 
Joined
Feb 24, 2021
Messages
3
Likes
2
The BOM is already much more than you'd get a comparable Chinese handheld for
That’s exactly the point: there are no comparable Chinese handhelds! Nobody produces a decent retro handheld in this form factor that can use a CM4. All of the cheap Chinese handhelds have serious compromises/issues with CPU horsepower, software/emulator quality, and/or form factor. This is the only device I’ve seen anywhere that would meet all my requirements for a retro gaming handheld. I already own Anbernic and GPD devices that are considered to be “best of the best”, and they all have obnoxious dealbreakers and compromises that make them an exercise in frustration.

I (and many other people) are willing to pay extra for something quality that can run standard Raspbian/RetroPie/RetroArch at fast speeds and that has good form factor and controls.

And if this thing is shaped identically to the Switch Lite and can therefore fit into all the same cases, grips, screen protectors, and other accessories, then it’s perfect.
 

Dmcke5

.
Joined
Feb 16, 2020
Messages
173
Likes
756
Location
Queensland, Australia
Portables
2
That’s exactly the point: there are no comparable Chinese handhelds! Nobody produces a decent retro handheld in this form factor that can use a CM4. All of the cheap Chinese handhelds have serious compromises/issues with CPU horsepower, software/emulator quality, and/or form factor. This is the only device I’ve seen anywhere that would meet all my requirements for a retro gaming handheld. I already own Anbernic and GPD devices that are considered to be “best of the best”, and they all have obnoxious dealbreakers and compromises that make them an exercise in frustration.

I (and many other people) are willing to pay extra for something quality that can run standard Raspbian/RetroPie/RetroArch at fast speeds and that has good form factor and controls.

And if this thing is shaped identically to the Switch Lite and can therefore fit into all the same cases, grips, screen protectors, and other accessories, then it’s perfect.
Thanks for the kind words mate. @StonedEdge and I have spoken about building these for people but the design would have to be changed a bit to ensure it doesn't bother Nintendo. I'd stick to the same size/form factor but would probably make a few distinctive changes to ensure it doesn't look too much like a switch.
In its current form it would be compatible with switch lite screen protectors and storage cases, but not necessarily grips or hard plastic protective cases as the triggers and a few other things aren't identical.

We need to at least get ours working first before we even think about building a couple of these. I've finally tracked down a cm4 module which should be arriving in the post soon and Stoned should have the first prototype main PCB in his hands by the end of this week so stay tuned for some progress updates. I'm working on the rear half of the prototype case today so if I get it done I'll post some pictures.
 
Joined
Feb 24, 2021
Messages
3
Likes
2
Thanks for the kind words mate. @StonedEdge and I have spoken about building these for people but the design would have to be changed a bit
...
We need to at least get ours working first before we even think about building a couple of these.
Understood... but the moment you decide to open a crowdfund for this, let me know.
 
Top