HDMI 240p tv CRT with AMLOGIC it's possible?

I manage to apply the command from the terminal but the NATIVE VIDEO OF THE EMULATOR is still in 480i when executing a game… it’s that if I don’t configure emuelec setting or Native Video emulator 480i60hz, I can’t see image on crt tv.

1920x240p takes it if I add 1 pixel 240 (1920x241p)

It also takes 320x240p60hz

EMUELEC:~ # cat mode
1920x241p60hz
EMUELEC:~ # echo “320x240p60hz” > mode
EMUELEC:~ # cat mode
320x240p60hz

I keep testing.

You have to be in the /sys/class/display directory to change it’s mode file.

cd /sys/class/display

then try:

echo 320x240p60hz > /sys/class/display/mode

edit: here is the dmesg error when trying to set it:

[402716.251867@2]- vout: vmode set to 320x240p60hz
[402716.251887@2]- vout: error: no matched vout mode, exit
1 Like

I see, try 1920x240p@60hz to see what happens.

I continue experimenting with framebuffers, the best setting for Emu frame buffer is 1920 240, I modified yours to this and retroarch works better with custom x1 resolution at 240p for example, but then 480i comes out because 480i is configured in ee_video.

Another alternative that I would like to explore and experiment with is HDMI CUSTOM MODELINES, but I don’t know how to use them in this project or how to apply them correctly to see changes and thus carry out the necessary tests and variations for the investigation.

I have already created modellines in windows and applied them successfully on laptops with integrated graphics card intel HD3000.

Can you explain to me the way to apply and execute a modeline, even if it is with the one in the config.ini example?

Ok you have to do a few things to make this work. I make no garuntee this will work.

In config/flash.ini you need to add the modeline for 320x240:

#------------------------------------------------------------------------------------------------------
#
# HDMI custom mode
#   You can use this setting to set a custom video mode
#   modeline "horpixels,verpixels,pixel_clock,hor_freq,ver_freq,hdisp,hsyncstart,hsyncend,htotal,vdisp,
#             vsyncstart,vsyncend,vtotal,hsync_polarity,vsync_polarity,progress_mode"
#
#   Example for 1920x1080p@60hz
# modeline='1920,1080,148500,67500,60,1920,2008,2052,2200,1080,1084,1088,1125,1,1,1'
#
#------------------------------------------------------------------------------------------------------
modeline='320,240,6000,15000,60,320,328,360,400,240,243,247,253,0,1,1'
vout='320x240p60hz'

Then you have to use a modified setres.sh file.

cp /usr/bin/setres.sh /emuelec/bin
nano /emuelec/bin/setres.sh

Modify the following in the file:

[[ $MODE != "auto" ]] && switch_resolution $MODE

comment the line out, so it becomes:

# [[ $MODE != "auto" ]] && switch_resolution $MODE

You might also need to override the safeguards here:

# If the display file mode is NOT present, or the video mode supplied is set to
# auto then just exit.
if [[ ! -f "$FILE_MODE" ]] || [[ $MODE == "auto" ]]; then
  exit 0
fi

by commenting them out like so:

# If the display file mode is NOT present, or the video mode supplied is set to
# auto then just exit.
# if [[ ! -f "$FILE_MODE" ]] || [[ $MODE == "auto" ]]; then
#  exit 0
# fi

Then you need to add the es_emu resolution in emuelec.conf so ES displays better.
In /emuelec/configs/emuelec.conf:

nano /emuelec/configs/emuelec.conf

Add a new lines to the end:

ee_es.framebuffer.320x240p60hz=1024 768
ee_es.framebuffer_border.320x240p60hz=0 0 319 239
ee_emu.framebuffer.320x240p60hz=320 240
ee_emu.framebuffer_border.320x240p60hz=0 0 319 239

video timings extracted from:
https://tomverbeure.github.io/video_timings_calculator

edit: modeline updated

2 Likes

Sorry man some typos:
in emuelec it should be:

ee_es.framebuffer_border.320x240p60hz=0 0 319 239

I fixed it in the above post.

1 Like

It’s great to be able to use 480i signal from HDMI out, since the CVBS out is a bit low quality, at least in my X96 X4 device. I also had the screen positioned a bit to the left. It’s worthy mentioning that a simple edit in the “ES frame borders” and “ES frama buffers” settings in “Danger Zone” fixed the issue and the image is now centered.

The 1920x240 resolution mentioned by LaserPlay may be necessary if the HDMI port is unable to send (at least) 25MHz pixelclock in smaller resolution widths like 320x240, resulting in the 15Hz CRT TV unable to display the image. But I think that may not be the case with my device. In addition to 1920x240 being a resolution compatible with CRT SwitchRes in Retroarch (feature not available in Emuelec), it allows for faster real time resolution switch.

I tried the suggestions above, and it seems EmulationStation tries to exhibit something in 240p judging by the low res OSD from my TV screen, but is unable to, and a black screen is presented.

1 Like

Thank you very much for participating in this emuelec crt 240p project.

I’ll show you the results so far, unfortunately I only managed to get 480i working but in retroarch it’s in 240p if I’m not mistaken.

Note that I show the aspect ratio retroarch configuration and it is 224 (x1)

Here I share a video: https://www.youtube.com/shorts/1tjDGQs2tqM

1 Like

I think you did it! In your video, I assume Retroarch is already displaying 1920x240p (since vertical scaling is 1x). @LaserPlay, when you got the time, would you share the configuration used to achieve?

1 Like

What I modified in addition to what was already described here, was to change the emulator frame buffer to 1920x240/1920x224

Could you please help me about how to insert custom modelines for the CVBS out (also known as Composite) for the old version 3.9 of the Emuelec? I didn’t find the “flash.ini” in this version (Since my box has Amlogic s912 I’m stuck with the 3.9 version, the last one compatible). I have some experience with editing modelines on the CRT Emudriver available for Windows and having such possibility with Emuelec is what I need to get “240p”/progressive very low resolutions from my TV box connected to a CRT TV. I just want what the OP achieved but with the AV OUT (CVBS) instead of HDMI and using that old version of Emuelec.

@hardtecnica

Probably the easiest way to achieve cvbs output would be to do this in SSH.

echo 480cvbs > /storage/.config/EE_VIDEO_MODE

Then re-boot.

Internally the device runs at a higher resolution and converts the digital signal into analog. If you want to adjust the borders, you will have to use the setres.sh from newer EmuELEC distros.

I already have 480cvbs output working, but it is 480i and I want progressive signal like 240p. I have setres.sh in 3.9 and changes I made do change the internal resolution, but still 480i is output, there I couldn’t managed to change the resolution for a progressive 240p for the analog out. I think I had to do first this custom modeline for 15KHz CRT TVs aka normal consumer CRT TV, but I don’t know where I could do it.

A custom modeline like that you mentioned here but I don’t know where to add it in 3.9 version for the analog out:

modeline='320,240,6000,15000,60,320,328,360,400,240,243,247,253,0,1,1'
vout='320x240p60hz'

Ok at a guess you would need to do the following:

Ok you would need to add the video mode,

echo 320x240p60hz > /storage/.config/EE_VIDEO_MODE

copy the default setres.sh to /emuelec/bin and modify it to have something like this:
add here: EmuELEC/packages/sx05re/emuelec/config/emuelec/scripts/setres.sh at v3.9 · EmuELEC/EmuELEC · GitHub

"320x240p60hz")
fbset -fb /dev/fb0 -g 1024 768 1024 1536 $BPP
fbset -fb /dev/fb1 -g $BPP $BPP $BPP $BPP $BPP
echo 0 0 1023 767 > /sys/class/graphics/fb0/free_scale_axis
echo 0 0 319 239 > /sys/class/graphics/fb0/window_axis
echo 320 > /sys/class/graphics/fb0/scale_width
echo 240 > /sys/class/graphics/fb0/scale_height
echo 0x10001 > /sys/class/graphics/fb0/free_scale

Make sure /emuelec/bin is added to the default PATH variable. Not sure if EE3.9 does by default.

edit:
If it does not switch properly. Then add the lines to /storage/.config/custom_start.sh:

add:

echo 320x240p60hz > /sys/class/display/mode
fbset -fb /dev/fb0 -g 1024 768 1024 1536 $BPP
fbset -fb /dev/fb1 -g $BPP $BPP $BPP $BPP $BPP
echo 0 0 1023 767 > /sys/class/graphics/fb0/free_scale_axis
echo 0 0 319 239 > /sys/class/graphics/fb0/window_axis
echo 320 > /sys/class/graphics/fb0/scale_width
echo 240 > /sys/class/graphics/fb0/scale_height
echo 0x10001 > /sys/class/graphics/fb0/free_scale
1 Like

Hey I just double checked on my device and found that 320x240p60hz is not a valid display mode for amlogic chips, so unfortunately the above would not work. Lowest res it can go is 640x480p60hz.

You mean it’s unsupported for Amlogic for the analog out? Because for the HDMI out the OP proved with a video it worked with 240p after modeline addition.

in ssh do:

cat /sys/class/display/cap

if the resolution is not there, it will not allow the changing of mode, I think.

I’m not able to SSH to this OS because the password “emuelec” is not working.

The changes I do in setres.sh do change the internal res but not the external on CVBS which still is 480i, because it’s still getting the default interlaced “modeline”. The OP managed to add it by your custom calculated 240p modeline inserted to config/flash.ini, but I didn’t find flash.ini in this version. I’m sure I need to insert a custom modeline in order for this to work, I’m not sure it will for the CVBS out though. Maybe it’s hardcoded on the Amlogic only interlaced NTSC/PAL output.

This was the file you instructed the OP to modify:

Ok you have to do a few things to make this work. I make no garuntee this will work.
In config/flash.ini you need to add the modeline for 320x240:
#------------------------------------------------------------------------------------------------------
#
# HDMI custom mode
#   You can use this setting to set a custom video mode
#   modeline "horpixels,verpixels,pixel_clock,hor_freq,ver_freq,hdisp,hsyncstart,hsyncend,htotal,vdisp,
#             vsyncstart,vsyncend,vtotal,hsync_polarity,vsync_polarity,progress_mode"
#
#   Example for 1920x1080p@60hz
# modeline='1920,1080,148500,67500,60,1920,2008,2052,2200,1080,1084,1088,1125,1,1,1'
#
#------------------------------------------------------------------------------------------------------
modeline='320,240,6000,15000,60,320,328,360,400,240,243,247,253,0,1,1'
vout='320x240p60hz'

It’s a HDMI custom mode, probably this file don’t “talk” with the CVBS out, but if it’s possible to insert a custom modeline like this for CVBS out maybe would work. Modelines exactly like that works with analog or digital video output on PC, is what I use to get “240p” and any custom res to work on CRT display.

@hardtecnica
its in /flash/config.ini the above has a typo. But you cannot modify it by default because the flash directory is protected. In ssh you will either have to re-mount it as rw or modify the file by inserting the card into a computer and changing it in the system partition.
But even if you get it working, ES wont look very good because it’s not designed to work with such low resolutions.