Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Driver] juj fbcp ili9341
#1
Before start warning: If you don't think you are able to do this, don't do it.
Pre-compiled binary are available for FPZ/CM3 and maintain by Mootikins : https://github.com/Mootikins/FreeplayILI9341

I will try to summary the whole discussion with Slow Catalyst (https://forum.freeplaytech.com/showthread.php?tid=4931).
I will add as much additional information as possible in case someone other need it.


Clone juj driver repo thru SSH :
Code:
cd /home/pi/Freeplay/
git clone https://github.com/juj/fbcp-ili9341


Edit '/boot/config.txt' (Comment mean add # at beginning of the line):
Comment all "dtoverlay=waveshare32b"
Comment dtparam=spi=on


Disable all services:
Code:
sudo systemctl stop fbcpCropped.service
sudo systemctl stop fbcpOld.service
sudo systemctl disable fbcpCropped.service
sudo systemctl disable fbcpOld.service
reboot


Restart the device (no picture, it is normal), then edit '/home/pi/Freeplay/fbcp-ili9341/config.h':
Comment mean add // at beginning of the line, to uncomment, remove it.

ALL_TASKS_SHOULD_DMA //to uncomment, as Mootikins pointed out, the one not really needed
SAVE_BATTERY_BY_PREDICTING_FRAME_ARRIVAL_TIMES //to comment, framerate drop fix
DISPLAY_FLIP_ORIENTATION_IN_SOFTWARE //to comment, I don't remember why
SAVE_BATTERY_BY_SLEEPING_WHEN_IDLE //to comment, good catch kmacmart@darkcloud.ca


Edit '/home/pi/Freeplay/fbcp-ili9341/freeplaytech_waveshare32b.h':
This part is a bit tricky, juj driver doesn't support use of '/boot/freeplayfbcp.cfg'.
If you are running fullscreen, set all value to 0.
Otherwise take value for '/boot/freeplayfbcp.cfg':

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 so 240-FREEPLAY_SCALED_H-FREEPLAY_SCALED_OFFSET_Y
DISPLAY_NATIVE_COVERED_BOTTOM_SIDE is right border of the screen so 320-FREEPLAY_SCALED_W-FREEPLAY_SCALED_OFFSET_X


Compiling:
Follow Building and running section on juj repository, for cmake, as a test, you can use :

cmake -DARMV8A=ON -DFREEPLAYTECH_WAVESHARE32B=ON -DSPI_BUS_CLOCK_DIVISOR=6 -DDISPLAY_BREAK_ASPECT_RATIO_WHEN_SCALING=ON -DUSE_DMA_TRANSFERS=ON -DSTATISTICS=0 ..

Once started, you should get a output like this (took it from Slow Catalyst comment):
Code:
bcm_host_get_peripheral_address: 0x3f000000, bcm_host_get_peripheral_size: 16777216, bcm_host_get_sdram_address: 0xc0000000
BCM core speed: current: 250000000hz, max turbo: 400000000hz. SPI CDIV: 6, SPI max frequency: 66666667hz
Allocated DMA channel 2
Allocated DMA channel 5
Enabling DMA channels Tx:2 and Rx:5
DMA hardware register file is at ptr: 0x75b3b000, using DMA TX channel: 2 and DMA RX channel: 5
DMA hardware TX channel register file is at ptr: 0x75b3b200, DMA RX channel register file is at ptr: 0x75b3b500
DMA channel 0 has peripheral map 0 (is lite channel: 0, currently active: 0, current control block: (nil))
DMA channel 1 has peripheral map 0 (is lite channel: 0, currently active: 0, current control block: (nil))
DMA channel 2 has peripheral map 13 (is lite channel: 0, currently active: 1, current control block: (nil))
DMA channel 3 has peripheral map 5 (is lite channel: 0, currently active: 1, current control block: 0xff4fc520)
DMA channel 4 has peripheral map 0 (is lite channel: 0, currently active: 0, current control block: (nil))
DMA channel 5 has peripheral map 0 (is lite channel: 0, currently active: 0, current control block: (nil))
DMA channel 6 has peripheral map 13 (is lite channel: 0, currently active: 1, current control block: (nil))
DMA channel 7 has peripheral map 0 (is lite channel: 1, currently active: 0, current control block: (nil))
DMA channel 8 has peripheral map 0 (is lite channel: 1, currently active: 0, current control block: (nil))
DMA channel 9 has peripheral map 0 (is lite channel: 1, currently active: 0, current control block: (nil))
DMA channel 10 has peripheral map 0 (is lite channel: 1, currently active: 0, current control block: (nil))
DMA channel 11 has peripheral map 0 (is lite channel: 1, currently active: 0, current control block: (nil))
DMA channel 12 has peripheral map 0 (is lite channel: 1, currently active: 0, current control block: (nil))
DMA channel 13 has peripheral map 0 (is lite channel: 1, currently active: 0, current control block: (nil))
DMA channel 14 has peripheral map 0 (is lite channel: 1, currently active: 0, current control block: (nil))
DMA TX channel 2 was assigned another peripheral map 13!
DMA TX channel was assigned another peripheral map!

if you see at the end "was assigned another peripheral map...", you will need to set DMA channels by hand, to do so, you need to choise channels with "is lite channel: 0, currently active: 0", in the example: 0,1,4,5 are available.

Add before '..' (don't miss to add spaces before/after), -DDMA_TX_CHANNEL=1 -DDMA_RX_CHANNEL=5

Then recompile and rerun to check if this work.

Important note: If you plan to use a emulator that use DMA (e.g. Reicast), please run it will the driver is still running into terminal to check if there is some possible conflicts. If the happen, the screen will goes black or white but not more update. Press Ctrl-C to kill the program then restart it with 'sudo /home/pi/Freeplay/fbcp-ili9341/build/fbcp-ili9341' to see what channels are still available.

If not picture on the screen, try another channels. If this goes anywhere, revert back all modifications in "/boot/config.txt" then run 'sudo /home/pi/RetroPie/retropiemenu/dispMenu.sh' to set back the right display driver.

If it work, two possibility :
- edit '/etc/rc.local' and add before the line containing 'shutdown_daemon.py', in a new line :
/home/pi/Freeplay/fbcp-ili9341/build/fbcp-ili9341

- run it as a service : https://forum.freeplaytech.com/showthrea...37#pid8737

Restart the device

I hope I didn't make any mistake, if so, post a reply and I will update the post Smile
Reply
#2
Some input and notes; you do not need to do anything to ALL_TASKS_SHOULD_DMA since commenting the other 3 defines does the trick, you can copy the binary you build over the binary of your choice (fbcpCropped or fbcpFilled) instead of disabling the service and adding the binary to /etc/rc.local. You also don't usually have to troubleshoot DMA channels unless emulators you plan to use happen to require them.
Reply
#3
(07-20-2019, 05:21 AM)Mootikins Wrote: you do not need to do anything to ALL_TASKS_SHOULD_DMA since commenting the other 3 defines does the trick
Didn't know that, thanks for pointing out Wink

Good point on DMA conflicts with emulator, I did have hard time figure out the problem when starting Reicast the first time.

I didn't spoke about overwriting your builds because of next updates, since your build does integrate the freeplayfbcp.cfg part, it is a better way to go Smile

Note to anyone reading this, the original post is "A way to go, not THE way to go".
Reply
#4
(07-20-2019, 05:32 AM)Porcinus Wrote: I didn't spoke about overwriting your builds because of next updates, since your build does integrate the freeplayfbcp.cfg part, it is a better way to go Smile

This is actually not the case, there is no way to change the border sizes at runtime and the original driver (rpi-fbcp) has been implemented as a service named fbcpOld. Borders are integrated at compile time, so custom borders require building a new binary and replacing the original version.
Reply
#5
(07-20-2019, 05:39 AM)Mootikins Wrote: This is actually not the case, there is no way to change the border sizes at runtime and the original driver (rpi-fbcp) has been implemented as a service named fbcpOld. Borders are integrated at compile time, so custom borders require building a new binary and replacing the original version.
Since juj driver doesn't run on kernel level, do you think it could be possible to implement your config parser into juj driver?

To be honest, each time I test something, I recompile the driver with new sizes, no big deal but for users that don't have the knowledge to do so, this could be a big step Wink
Reply
#6
That fix worked like a charm-- I only did some brief tests, but I haven't hit any of the typical slowdowns since setting it up.

Two small notes:

1. I made the assumption that you meant "SAVE_BATTERY_BY_SLEEPING_WHEN_IDLE" should be commented (your notes just mention that it's uncommented by default).

2. Rather than use rc.local, I created a systemd service at /etc/systemd/system/fbcpNoBatterySaving.service to keep more in line with the existing system:

Code:
[Unit]
Description=juj fbcp driver for Freeplay CM3 with battery saving disabled
After=basic.target
StartLimitIntervalSec=0

[Service]
Type=simple
Restart=always
RestartSec=2
User=root
ExecStart=/home/pi/Freeplay/fbcp-ili9341/build/fbcp-ili9341

[Install]
WantedBy=multi-user.target

then enabled the service by running:

Code:
sudo systemctl daemon-reload
sudo systemctl enable fbcpNoBatterySaving

Thanks a ton for doing the leg work on this, and I don't see why it wouldn't make sense to build this into the image (at least as an option).

EDIT: I forgot to add that I also had to stop and disable the fbcpFilled.service (since I'm using the experimental filled driver)
Reply
#7
Good guide to setup as a service Wink

I am running most of my things that way but I didn't really know how to put it :S
Reply
#8
Played around with it a bit more-- everything is so much better! Things I hadn't realized were stuttering like the main console selection menu and certain in game menus are silky smooth now. Assuming people are generally saving state and powering down after playing (or leaving it plugged in) this should definitely be the default mode for the driver.

Thanks again Porcinus!
Reply
#9
Thanks Wink but I can't take full credit on this.

Mootikins also added two CM3 binaries its repo that have the sleep turned off:
https://forum.freeplaytech.com/showthrea...38#pid8738
https://github.com/Mootikins/FreeplayILI9341
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)