5" Display For Raspberry Pi Pi2 Model B+ A+ used for OragePi 2
Edited by Jacaranda at 2015-9-23 13:10I try to get working 5" Display For Raspberry Pi Pi2 Model B+ A+ with OrangePi2Mini
http://ru.aliexpress.com/item/5- ... 6&shopNumber=427290
But h3 kernel does't support resolution 800x480
I try hacked the sunxi-disp2 hdmi driver as provided there https://github.com/Tinkerforge/r ... fc3364a41d179ca0e04
But no success. Needs rights parameters for800x480
hdmi_bsp_sun8iw7.c:
static struct para_tab ptbl[] =
{
{{6 , 1 , 1,1, 5, 3, 0, 1, 4, 0, 0, 160, 20, 38, 124, 240, 22, 0, 0 }},
{{21 , 11, 1,1, 5, 3, 1, 1, 2, 0, 0, 160, 32, 24, 126, 32, 24, 0, 0 }},
{{2 , 11, 0,0, 2, 6, 1, 0, 9, 0, 0, 208, 138, 16, 62, 224, 45, 0, 0 }},
{{17 , 11, 0,0, 2, 5, 2, 0, 5, 0, 0, 208, 144, 12, 64, 64, 49, 0, 0 }},
{{19 , 4 , 0,96, 5, 5, 2, 2, 5, 1, 0, 0, 188, 184, 40, 208, 30, 1, 1 }},
{{4 , 4 , 0,96, 5, 5, 2, 1, 5, 0, 0, 0, 114, 110, 40, 208, 30, 1, 1 }},
{{20 , 4 , 0,97, 7, 5, 4, 2, 2, 2, 0, 128, 208, 16, 44, 56, 22, 1, 1 }},
{{5 , 4 , 0,97, 7, 5, 4, 1, 2, 0, 0, 128, 24, 88, 44, 56, 22, 1, 1 }},
{{31 , 2 , 0,96, 7, 5, 4, 2, 4, 2, 0, 128, 208, 16, 44, 56, 45, 1, 1 }},
{{16 , 2 , 0,96, 7, 5, 4, 1, 4, 0, 0, 128, 24, 88, 44, 56, 45, 1, 1 }},
{{32 , 4 , 0,96, 7, 5, 4, 3, 4, 2, 0, 128, 62, 126, 44, 56, 45, 1, 1 }},
{{33 , 4 , 0,0, 7, 5, 4, 2, 4, 2, 0, 128, 208, 16, 44, 56, 45, 1, 1 }},
{{34 , 4 , 0,0, 7, 5, 4, 1, 4, 0, 0, 128, 24, 88, 44, 56, 45, 1, 1 }},
{{34 , 4 , 0,0, 7, 5, 4, 1, 4, 0, 0, 128, 24, 88, 44, 56, 45, 1, 1 }},
{{35 , 11, 0,0, 2, 3, 1, 0, 13, 0, 0, 208, 138, 40, 48, 224, 45, 0, 0 }},
{{160 , 2 , 0,96, 7, 5, 8, 3, 4, 2, 0, 128, 62, 126, 44, 157, 45, 1, 1 }},
{{147 , 2 , 0,96, 5, 5, 5, 2, 5, 1, 0, 0, 188, 184, 40, 190, 30, 1, 1 }},
{{132 , 2 , 0,96, 5, 5, 5, 1, 5, 0, 0, 0, 114, 110, 40, 160, 30, 1, 1 }},
{{257 , 1 , 0,96, 15, 10, 8, 2, 8, 0, 0, 0, 48, 176, 88, 112, 90, 1, 1 }},
{{258 , 1 , 0,96, 15, 10, 8, 5, 8, 4, 0, 0, 160, 32, 88, 112, 90, 1, 1 }},
};
Any body can help?
or how to set custom hdmi resolutiom800x480 to hdmi output. this Screen accept only exactly 800x480 res.
Thanks.
Edited by Jacaranda at 2015-10-19 18:53
You need compile ADS7846 touchscreen as a module.
fex:
spi_used = 1
spi_cs_bitmap = 1
spi_mosi = port:PC00<3><default><default><default>
spi_miso = port:PC01<3><default><default><default>
spi_sclk = port:PC02<3><default><default><default>
spi_cs0 = port:PA21<1><1><default><default>
spi_dev_num = 1
modalias = "ads7846"
max_speed_hz = 1500000
bus_num = 0
chip_select = 0
mode = 0
full_duplex = 1
manual_cs = 0
drivers/input/touchscreen/ads7846.c:
diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads
index f02028e..0a3f610 100644
--- a/drivers/input/touchscreen/ads7846.c
+++ b/drivers/input/touchscreen/ads7846.c
@@ -59,6 +59,22 @@
#define TS_POLL_DELAY1 /* ms delay before the first sample */
#define TS_POLL_PERIOD 5 /* ms delay between samples */
+
+static struct ads7846_platform_data ads7846_chip_info =
+{
+ .gpio_pendown = 2,
+ .pressure_max = 255,
+ .x_plate_ohms = 180,
+ .x_min = 176,
+ .x_max = 3913,
+ .y_min = 300,
+ .y_max = 3947,
+ .debounce_max = 10,
+ .debounce_tol = 3,
+ .debounce_rep = 1,
+ .keep_vref_on = 1
+};
+
/* this driver doesn't aim at the peak continuous sample rate */
#define SAMPLE_BITS (8 /*cmd*/ + 16 /*sample*/ + 2 /* before, after
@@ -970,6 +986,7 @@ static int __devinit ads7846_setup_pendown(struct spi_device
ts->get_pendown_state = pdata->get_pendown_state;
} else if (gpio_is_valid(pdata->gpio_pendown)) {
+ // try to get gpio for pendown
err = gpio_request_one(pdata->gpio_pendown, GPIOF_IN,
"ads7846_pendown");
if (err) {
@@ -1197,17 +1214,27 @@ static int __devinit ads7846_probe(struct spi_device *sp
struct ads7846 *ts;
struct ads7846_packet *packet;
struct input_dev *input_dev;
+
+ if (!spi->dev.platform_data) {
+ spi->dev.platform_data = &ads7846_chip_info;
+ }
+
struct ads7846_platform_data *pdata = spi->dev.platform_data;
unsigned long irq_flags;
int err;
- if (!spi->irq) {
- dev_dbg(&spi->dev, "no IRQ?\n");
+ if (!pdata) {
+ dev_dbg(&spi->dev, "no platform data?\n");
return -ENODEV;
}
- if (!pdata) {
- dev_dbg(&spi->dev, "no platform data?\n");
+ // try to grab irq for pendown
+ if (pdata->gpio_pendown) {
+ spi->irq = gpio_to_irq(pdata->gpio_pendown);
+ }
+
+ if (!spi->irq) {
+ dev_dbg(&spi->dev, "no IRQ?\n");
return -ENODEV;
}
worked with PA21 - CS0 and PA02 - IRQ pendown.
Need some trics with platform_data, touch worked but no so cool.
I get stable imge on monitorhdmi -> dvi monitor to res 800x480 but 5 inch not yet.
Jacaranda replied at 2015-9-17 08:05
I get stable imge on monitorhdmi -> dvi monitor to res 800x480 but 5 inch not yet.
Can you share the changes you've made to get 800x480 resolution...
Edited by Jacaranda at 2015-9-23 14:17
linux-3.4/drivers/video/sunxi/disp2/hdmi/aw/hdmi_bsp_sun8iw7.c:
static struct para_tab ptbl[] =
{
+{{HDMI800_480P , 11 , 0,0, 3, 6, 1, 0, 9, 0, 0,32, 120, 40, 40, 224, 45, 0, 0 }},
linux-3.4/drivers/video/sunxi/disp2/hdmi/aw/hdmi_core.c
disp_video_timings video_timing[] =
{
+{HDMI800_480P, 0,27000000,0,800, 480, 920,40, 40, 40,525, 30,9,6,0, 0, 0, 0, 0},
/linux-3.4/drivers/video/sunxi/disp2/hdmi/hdmi_hal.h:
+#define HDMI800_480P 35
/lichee/linux-3.4/include/video/sunxi_display2.h
+ DISP_TV_MOD_800_480P = 0x1f, // mode 31
m DISP_TV_MODE_NUM = 0x20,
}disp_tv_mode;
linux-3.4/drivers/video/sunxi/disp2/hdmi/drv_hdmi.c:
static struct disp_hdmi_mode hdmi_mode_tbl[] = {
+ {DISP_TV_MOD_800_480P, HDMI800_480P, },
Edited by Jacaranda at 2015-9-18 16:20
My monitor work but 5inch TFT not : ( and i don't know why.
TFT panel specification : http://www.adafruit.com/datasheets/KD50G21-40NT-A1.pdf
Digital reciver tfp401 specification http://www.adafruit.com/datasheets/tfp401.pdf
I get image on TFT on wrong parametrs i think. On hdmi tv and hdmi monitor work propertly but not on TFT some colors are missing
http://www.orangepi.org/orangepibbsen/forum.php?mod=image&aid=190&size=300x300&key=f22e652fc41da7aa&nocache=yes&type=fixnone
Last need worked xpt2046 input driver for touchscreen.
Edited by Jacaranda at 2015-9-24 12:34
Parameters when tft work is:
static struct para_tab ptbl[] =
{
// mx = x>>8
// my = y>>8
// mhbw = horisontal blanking width >> 8
// mhfp = horisontal front porch >> 8
// vic dclkint mx vst my mhbw vfp mhfp +x +hbw +hfp hst +y vbw h polarity v polarity
+{{HDMI800_480P , 11 , 0,0, 1, 3, 3, 0, 13, 0, 0,208, 36, 40, 40, 208, 16, 0, 0 }},
disp_video_timings video_timing[] =
+{HDMI800_480P, 0,27000000,0,800, 480, 976,88, 40, 48,528, 32,13,3,0, 0, 0, 0, 0},
get worked ads7846 touch through spi Edited by loboris at 2015-10-17 14:34
Jacaranda replied at 2015-10-13 09:44
get worked ads7846 touch through spi
Thank you for your work.
I've got my 5" hdmi display working perfectly using your timing values (slightly changed) and enabling dvi infex, added in section:
hdcp_enable = 0
hdmi_cts_compatibility = 1I have included it in my script.bin building script and it now works great in all my images.
The script.bin working with 5" LCD and probably also with the 7" one too (script.bin.OPI-<board>_480p_dvi), is included in scriptbin_kernel.tar.gz onMegaor Google Drive
I had no time to work on touch drivers yet, could you, please, share more details about how you've got it working (sources, compiled drivers, building instructions, ...), I would include it in my images also.
Wow thank you very much, can you share timig changes ?) thanks. Later i give driver code changes and fex.