please choosego to mobile | Continue to access the PC version
View: 27084|Reply: 29

5" Display For Raspberry Pi Pi2 Model B+ A+ used for OragePi 2

[Copy link]

1

threads

23

posts

174

credits

Registered member

Rank: 2

credits
174
Published in 2015-9-10 18:59:15 | Show all floors |Read mode
Edited by Jacaranda at 2015-9-23 13:10

I 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 for  800x480

hdmi_bsp_sun8iw7.c:
  1. static struct para_tab ptbl[] =
  2. {
  3.         {{6                        , 1        , 1,  1,                5,         3,         0,                1,         4,                0,                0,        160,        20,                 38,         124,        240,        22,                0,                0        }},
  4.         {{21                , 11, 1,  1,                5,         3,         1,                1,         2,                0,                0,        160,        32,                 24,         126,        32,                24,                0,                0        }},
  5.         {{2                        , 11, 0,  0,                2,         6,         1,                0,         9,                0,                0,        208,        138,                16,         62,         224,        45,                0,                0        }},
  6.         {{17                , 11, 0,  0,                2,         5,         2,                0,         5,                0,                0,        208,        144,                12,         64,         64,                49,                0,                0        }},
  7.         {{19                , 4        , 0,  96,                5,         5,         2,                2,         5,                1,                0,        0,                188,                184,        40,         208,        30,                1,                1        }},
  8.         {{4                        , 4        , 0,  96,                5,         5,         2,                1,         5,                0,                0,        0,                114,                110,        40,         208,        30,                1,                1        }},
  9.         {{20                , 4        , 0,  97,                7,          5,         4,                2,         2,                2,                0,        128,        208,                16,                44,         56,                22,                1,                1        }},
  10.         {{5                        , 4        , 0,  97,                7,          5,         4,                1,         2,                0,                0,        128,        24,                 88,         44,         56,                22,                1,                1        }},
  11.         {{31                , 2        , 0,  96,                7,          5,         4,                2,         4,                2,                0,        128,        208,                16,                44,         56,         45,                1,                1        }},
  12.         {{16                , 2        , 0,  96,                7,          5,         4,                1,         4,                0,                0,        128,        24,                 88,         44,         56,                45,                1,                1        }},
  13.         {{32                , 4        , 0,  96,                7,          5,         4,                3,         4,                2,                0,        128,        62,                 126,        44,         56,                45,                1,                1        }},
  14.         {{33                , 4        , 0,  0,                7,          5,         4,                2,         4,                2,                0,        128,        208,                16,                44,         56,         45,                1,                1        }},
  15.         {{34                , 4        , 0,  0,                7,          5,         4,                1,         4,                0,                0,        128,        24,                 88,         44,         56,                45,                1,                1        }},
  16.         {{34                , 4        , 0,  0,                7,          5,         4,                1,         4,                0,                0,        128,        24,                 88,         44,         56,                45,                1,                1        }},
  17.         {{35                , 11, 0,  0,                2,         3,         1,                0,         13,        0,                0,        208,        138,                40,         48,         224,        45,                0,                0        }},
  18.         {{160                ,        2        , 0,  96,                7,          5,         8,                3,         4,                2,                0,        128,        62,                 126,        44,         157,        45,                1,                1        }},
  19.         {{147                , 2        , 0,  96,                5,         5,         5,                2,         5,                1,                0,        0,                188,                184,        40,         190,        30,                1,                1        }},
  20.         {{132                , 2        , 0,  96,                5,         5,         5,                1,         5,          0,                0,        0,                114,                110,        40,          160,         30,                1,                1        }},
  21.         {{257                , 1        , 0,  96,                15,        10,         8,                2,         8,                0,                0,        0,                48,                        176,        88,         112,        90,                1,                1        }},
  22.         {{258                , 1        , 0,  96,                15,        10,         8,                5,         8,                4,                0,        0,                160,                32,                88,         112,        90,                1,                1        }},
  23. };
Copy code

Any body can help?
or how to set custom hdmi resolutiom  800x480 to hdmi output. this Screen accept only exactly 800x480 res.
Thanks.

1

threads

23

posts

174

credits

Registered member

Rank: 2

credits
174
 Author| Published in 2015-10-19 11:26:22 | Show all floors
Edited by Jacaranda at 2015-10-19 18:53

You need compile ADS7846 touchscreen as a module.

fex:
  1. [spi0]
  2. spi_used = 1
  3. spi_cs_bitmap = 1
  4. spi_mosi = port:PC00<3><default><default><default>
  5. spi_miso = port:PC01<3><default><default><default>
  6. spi_sclk = port:PC02<3><default><default><default>
  7. spi_cs0 = port:PA21<1><1><default><default>

  8. [spi_devices]
  9. spi_dev_num = 1

  10. [spi_board0]
  11. modalias = "ads7846"
  12. max_speed_hz = 1500000
  13. bus_num = 0
  14. chip_select = 0
  15. mode = 0
  16. full_duplex = 1
  17. manual_cs = 0
Copy code


drivers/input/touchscreen/ads7846.c:
  1. diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads
  2. index f02028e..0a3f610 100644
  3. --- a/drivers/input/touchscreen/ads7846.c
  4. +++ b/drivers/input/touchscreen/ads7846.c
  5. @@ -59,6 +59,22 @@
  6. #define TS_POLL_DELAY  1       /* ms delay before the first sample */
  7. #define TS_POLL_PERIOD 5       /* ms delay between samples */

  8. +
  9. +static struct ads7846_platform_data ads7846_chip_info =
  10. +{
  11. +    .gpio_pendown      = 2,
  12. +    .pressure_max      = 255,
  13. +    .x_plate_ohms      = 180,
  14. +    .x_min             = 176,
  15. +    .x_max             = 3913,
  16. +    .y_min             = 300,
  17. +    .y_max             = 3947,
  18. +    .debounce_max      = 10,
  19. +    .debounce_tol      = 3,
  20. +    .debounce_rep      = 1,
  21. +    .keep_vref_on      = 1
  22. +};
  23. +
  24. /* this driver doesn't aim at the peak continuous sample rate */
  25. #define        SAMPLE_BITS     (8 /*cmd*/ + 16 /*sample*/ + 2 /* before, after

  26. @@ -970,6 +986,7 @@ static int __devinit ads7846_setup_pendown(struct spi_device
  27.                 ts->get_pendown_state = pdata->get_pendown_state;
  28.         } else if (gpio_is_valid(pdata->gpio_pendown)) {

  29. +               // try to get gpio for pendown
  30.                 err = gpio_request_one(pdata->gpio_pendown, GPIOF_IN,
  31.                                        "ads7846_pendown");
  32.                 if (err) {
  33. @@ -1197,17 +1214,27 @@ static int __devinit ads7846_probe(struct spi_device *sp
  34.         struct ads7846 *ts;
  35.         struct ads7846_packet *packet;
  36.         struct input_dev *input_dev;
  37. +
  38. +       if (!spi->dev.platform_data) {
  39. +               spi->dev.platform_data = &ads7846_chip_info;
  40. +       }
  41. +
  42.         struct ads7846_platform_data *pdata = spi->dev.platform_data;
  43.         unsigned long irq_flags;
  44.         int err;

  45. -       if (!spi->irq) {
  46. -               dev_dbg(&spi->dev, "no IRQ?\n");
  47. +       if (!pdata) {
  48. +               dev_dbg(&spi->dev, "no platform data?\n");
  49.                 return -ENODEV;
  50.         }

  51. -       if (!pdata) {
  52. -               dev_dbg(&spi->dev, "no platform data?\n");
  53. +       // try to grab irq for pendown
  54. +       if (pdata->gpio_pendown) {
  55. +               spi->irq = gpio_to_irq(pdata->gpio_pendown);
  56. +       }
  57. +
  58. +       if (!spi->irq) {
  59. +               dev_dbg(&spi->dev, "no IRQ?\n");
  60.                 return -ENODEV;
  61.         }

Copy code



worked with PA21 - CS0 and PA02 - IRQ pendown.
Need some trics with platform_data, touch worked but no so cool.

1

threads

9

posts

278

credits

Intermediate member

Rank: 3Rank: 3

credits
278
Published in 2016-6-24 15:57:20 | Show all floors




This thread contains more resources

You need to Log in to download or view,No account?    Register

x

1

threads

23

posts

174

credits

Registered member

Rank: 2

credits
174
 Author| Published in 2015-9-17 15:05:59 | Show all floors
I get stable imge on monitor  hdmi -> dvi monitor to res 800x480 but 5 inch not yet.



This thread contains more resources

You need to Log in to download or view,No account?    Register

x

10

threads

448

posts

5035

credits

Moderator

Rank: 7Rank: 7Rank: 7

credits
5035
Published in 2015-9-18 05:55:40 | Show all floors
Jacaranda replied at 2015-9-17 08:05
I get stable imge on monitor  hdmi -> dvi monitor to res 800x480 but 5 inch not yet.

Can you share the changes you've made to get 800x480 resolution...

1

threads

23

posts

174

credits

Registered member

Rank: 2

credits
174
 Author| Published in 2015-9-18 16:14:08 | Show all floors
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,      },


1

threads

23

posts

174

credits

Registered member

Rank: 2

credits
174
 Author| Published in 2015-9-18 16:16:30 | Show all floors
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

1

threads

23

posts

174

credits

Registered member

Rank: 2

credits
174
 Author| Published in 2015-9-23 14:06:57 | Show all floors

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




Last need worked xpt2046 input driver for touchscreen.

This thread contains more resources

You need to Log in to download or view,No account?    Register

x

1

threads

23

posts

174

credits

Registered member

Rank: 2

credits
174
 Author| Published in 2015-9-23 15:16:25 | Show all floors
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                             dclk  int                  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},

1

threads

23

posts

174

credits

Registered member

Rank: 2

credits
174
 Author| Published in 2015-10-13 16:44:49 | Show all floors
get worked ads7846 touch through spi

10

threads

448

posts

5035

credits

Moderator

Rank: 7Rank: 7Rank: 7

credits
5035
Published in 2015-10-17 21:30:46 | Show all floors
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 in  fex, added in [hdmi_para] section:
  1. hdcp_enable                = 0
  2. hdmi_cts_compatibility = 1
Copy code
I 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 on  Mega  or 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.

1

threads

23

posts

174

credits

Registered member

Rank: 2

credits
174
 Author| Published in 2015-10-19 11:06:42 | Show all floors
Wow thank you very much, can you share timig changes ?) thanks. Later i give driver code changes and fex.
You need to log in before you can reply login | Register

Points Rule

Quick reply Top Return list