Freeplay CM3 --> CM4S
#1
This thread will record my adventure swapping out a raspberry pi CM3 with a CM4S that i found on my Freeplay CM3 device.

The benefits of moving from a 3 to a 4 seem to be pretty good:

https://www.reddit.com/r/RetroPie/commen..._worth_it/

https://www.reddit.com/r/raspberry_pi/co...rformance/

I bought a CM4S that i found on ebay.

A straight swap from CM3 to CM4S didn't work. I got a small error about unable to load something. is it running?.  Avoiding the troubleshooting for now, i am imaging a new SD card and will start from a fresh image.
Reply
#2
I would like to go with the most up to date version of Raspbian: Operating system images (https://www.raspberrypi.com/software/operating-systems/)

Raspberry Pi OS Lite
  • Release date: July 4th 2024
  • System: 64-bit
  • Kernel version: 6.6
  • Debian version: 12 (bookworm)


and manually install RetroPie using this: Manually Install RetroPie on Raspbian/Raspberry Pi OS (https://retropie.org.uk/docs/Manual-Installation/)

Then plan to customize using this: Manual Instructions - How To Add Freeplay Functionality To Raspbian
Reply
#3
I used the Raspberry Pi Imager to image "retropie-buster-4.8-rpi4_400.img.gz" and edited the configuration in the Raspberry Pi Imager to apply a custom hostname, setup a user / password, configure WiFi, and enable SSH with keys.

added an ssh file to enable ssh and replaced the config.txt with this:

Code:
dtparam=i2c_arm=on
core_freq=400
gpu_mem_256=128
gpu_mem_512=256
gpu_mem_1024=256
dtoverlay=vc4-fkms-v3d
max_framebuffers=2
dtoverlay=dwc2,dr_mode=host
overscan_scale=1
framebuffer_width=320
framebuffer_height=240
hdmi_force_hotplug=1  #these HDMI lines will try to set up 1024x768 (you can remove them if you have problems playing via HDMI)
HDMI_FORCE_MODE=1
hdmi_group=2
hdmi_mode=16
hdmi_drive=1          #Normal DVI mode (No sound) (2 for HDMI with sound)
dtparam=spi=on
dtparam=audio=on
dtoverlay=audremap,swap_lr=on
dtparam=i2c1_baudrate=400000 #makes a big speed difference
dtoverlay=i2c1,pins_44_45=1,combine=off
dtoverlay=disable-bt
dtparam=act_led_trigger=none
dtparam=act_led_activelow=on
dtoverlay=gpio-poweroff,gpiopin=21,active_low
dtoverlay=gpio-shutdown,gpio_pin=20,active_low=0,gpio_pull=off,debounce=4000

I removed most comments and the filters that can be applied as documented here:
https://www.raspberrypi.com/documentatio...al-filters

mostly sourced from:
https://forum.freeplaytech.com/showthrea...4#pid10384

added dtoverlay=dwc2,dr_mode=host to enable usb.

Observed results:
held CM3 freeplay switch closed and the green power indicator turned on (4 sec)
- white screen, and green power light turns off
held CM3 freeplay switch closed and the green power indicator turned on (4 sec)
- white screen on device, hdmi shows splashscreen and then console text showing process ending at a reboot state
pressed reset button to turn off
held CM3 freeplay switch closed and the green power indicator turned on (4 sec)
- white screen on device, hdmi shows splashscreen and then console text showing process ending at a prompt
- powered usb hub is working, usb keyboard plugged into hub is working, usb wifi dongle plugged into hub is working (wifi connected and IP address obtained)
- connecting via ssh works
Reply
#4
From SSH, i first made a symbolic link from my home to a directory named /home/pi. This workaround allowed running all the scripts that are hard coded to use that directory without error.

Code:
sudo ln -s ~ /home/pi

I was able to download and compile the very optimized fbcp from here: https://github.com/juj/fbcp-ili9341

Code:
sudo apt-get install cmake
cd ~
git clone https://github.com/juj/fbcp-ili9341.git
cd fbcp-ili9341
mkdir build
cd build
cmake [options] ..
make -j
sudo ./fbcp-ili9341

After running the binary the screen changed from a white screen to duplicate the hdmi.

for the [options] i used the recommended ones except since the CM4S runs faster than the CM3/CM3+ i set the -DSPI_BUS_CLOCK_DIVISOR=8 from 6

Code:
-DARMV8A=ON -DFREEPLAYTECH_WAVESHARE32B=ON -DSPI_BUS_CLOCK_DIVISOR=8 -DDISPLAY_BREAK_ASPECT_RATIO_WHEN_SCALING=ON -DUSE_DMA_TRANSFERS=ON -DBACKLIGHT_CONTROL=ON -DGPIO_TFT_BACKLIGHT=31 -DSTATISTICS=0

This allowed me to not underclock the cpu to 400, however the viewable area of the screen was restricted.

This comment pointed me towards the code to change: https://forum.freeplaytech.com/showthrea...10#pid8610

Code:
In 'freeplaytech_waveshare32b.h': (also important as unmodified juj driver have not access to Freeplay screen config)
DISPLAY_NATIVE_COVERED_TOP_SIDE is left border of the screen
DISPLAY_NATIVE_COVERED_LEFT_SIDE is top border of the screen
DISPLAY_NATIVE_COVERED_RIGHT_SIDE is bottom border of the screen
DISPLAY_NATIVE_COVERED_BOTTOM_SIDE is right border of the screen
Reply
#5
Ok, now i have a custom compiled https://github.com/juj/fbcp-ili9341 driver and the whole screen is now visible.

I have followed most of these instructions: https://docs.google.com/document/d/1jsMi...sp=sharing 

I installed these binaries using the git clone, then installCM3 script, however they were compiled for pi3/pi3+ and would only work with underclocking. I selected the fbcpFilled through the Freeplay menu and this installed the driver and setup a service. Then i overwrote the binary located in /usr/local/bin/fbcpFilled with my binary that i compiled. I then commented out the underclocking and have restarted the Freeplay CM3 device. to keep myself from accidentally picking a different driver i removed the menu by deleting the menu that was added /home/pi/RetroPie/retropiemenu/Freeplay\ Options/dispMenu.sh.

This has me auto booting into emulation station, my screen looks good, and i am not under clocking.
Reply
#6
looks like the filter to use in the config.txt is [board-type=0x15] per https://forums.raspberrypi.com/viewtopic.php?t=338978

i noticed that the usb port wasn’t working with the cm4s plugged in. it might require a connection to a pin or a specific overlay.

“pulldown the pin USB_OTGID.”
https://raspberrypi.stackexchange.com/qu...m4s#147379

“add
dtoverlay=dwc2,dr_mode=host
to the config.txt
Then reboot the Pi. Now you should be able to use the built-in USB 2.0 ports!”
https://www.jeffgeerling.com/blog/2020/u...r-overlays

i also found a review of the cm4s compared to other cm versions:
https://www.tomshardware.com/raspberry-p...-4s-review
Reply
#7
i found this type of installation nice:
https://www.cytron.io/tutorial/installin...f3e213e2f7

instead of requiring a custom image, it just uses a retropie image and provides a patch to install in the boot partition for the custom changes. i am not sure if this would be possible to convert. i will investigate.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)