Closed ghost closed 9 years ago
Hey, I just got this same screen a few days ago for my Raspberry Pi B+, plug it in and nothing but a white screen. I've written rasbian onto the micro sd and can see it fine on a hdmi monitor, and from there have downloaded the driver from the following source.
https://s3.amazonaws.com/ttbox/35screen-img-9486.zip
When trying to extract the zip folder on the pi it crashed, however I formatted the sd and wrote the image at the above link onto the pi and still I only get a white screen.
It's probably evident that I'm fairly new to all this, and so I'm unable to gauge the scale of the issue, but I was wondering if you had any suggestions as to what I should try.
Many thanks.
/*
/* this init sequence matches Tontec Screen */ static int default_init_sequence[] = { -1,0xB0,0x00, -1,0x11, -2,250, -1,0xB3,0x02,0x00,0x00,0x00, -1,0xC0,0x13,0x3B,0x00,0x02,0x00,0x01,0x00,0x43, -1,0xC1,0x08,0x16,0x08,0x08, -1,0xC4,0x11,0x07,0x03,0x03, -1,0xC6,0x00, -1,0xC8,0x03,0x03,0x13,0x5C,0x03,0x07,0x14,0x08,0x00,0x21,0x08,0x14,0x07,0x53,0x0C,0x13,0x03,0x03,0x21,0x00, -1,0x35,0x00, -1,0x36,0xa0, -1,0x3A,0x55, -1,0x44,0x00,0x01, -1,0xD0,0x07,0x07,0x1D,0x03, -1,0xD1,0x03,0x30,0x10, -1,0xD2,0x03,0x14,0x04, -1,0x29, -1,0x2C, -3 };
static void set_addr_win(struct fbtft_par *par, int xs, int ys, int xe, int ye) { fbtft_par_dbg(DEBUG_SET_ADDR_WIN, par, "%s(xs=%d, ys=%d, xe=%d, ye=%d)\n", func, xs, ys, xe, ye);
/* Column address */
write_reg(par, 0x2A, xs >> 8, xs & 0xFF, xe >> 8, xe & 0xFF);
/* Row adress */
write_reg(par, 0x2B, ys >> 8, ys & 0xFF, ye >> 8, ye & 0xFF);
/* Memory write */
write_reg(par, 0x2C);
}
static int set_var(struct fbtft_par *par) { fbtft_par_dbg(DEBUG_INIT_DISPLAY, par, "%s()\n", func);
switch (par->info->var.rotate) {
case 0:
write_reg(par, 0x36, 0x00 | (par->bgr << 3));
break;
case 90:
write_reg(par, 0x36, 0x60 | (par->bgr << 3));
break;
case 180:
write_reg(par, 0x36, 0xc0 | (par->bgr << 3));
break;
case 270:
write_reg(par, 0x36, 0xA0 | (par->bgr << 3));
break;
default:
break;
}
return 0;
}
static struct fbtft_display display = { .regwidth = 8, .width = WIDTH, .height = HEIGHT, .init_sequence = default_init_sequence, .fbtftops = { .set_addr_win = set_addr_win, .set_var = set_var, }, }; FBTFT_REGISTER_DRIVER(DRVNAME, "rense,r61581", &display);
MODULE_ALIAS("spi:" DRVNAME); MODULE_ALIAS("platform:" DRVNAME); MODULE_ALIAS("spi:r61581"); MODULE_ALIAS("platform:r61581");
MODULE_DESCRIPTION("FB driver for the R61581 LCD Controller"); MODULE_AUTHOR("Noralf Tronnes"); MODULE_LICENSE("GPL");
copy the above code to fb_r61581.c to replace the ili9486.c
Thanks ttmz. That works perfectly. Had to fill in some blanks (github syntax quirks) but your paste help a lot.
Thanks for the code ttmz. Been trying to work this out for couple of weeks with no success. After reading through notros fbtft files figured it would be to do with 0x00 data, but no idea how to work out, not sure how you did either, but you did because it works. Used notro fbtft development page to make changes to .c file on rpi, takes a while to do, but worth it. Thanks to all sites have used to get this working - notro, ttmz, davestechmusings, cooljc.me.uk
Hi,
my name ist Michael and I am new here and also new with the raspberry.
I have a raspberry PI B+ and the tonTec 3,5 display. I tried the manual and the driver (also the image) wich was listed on amazon -> screen35 Display was not working. Then I tried to install th fbtft driver from notro, also no luck.
Then i contacted tontec, thy send me an new raspbian wheezy image called "mz61581". Now I got the LCD working, but the touchscreen did not. Also some other issues with wifi, and if I do a apt-get update the driver won´t work anymore.
So.. now i knew that I also have the 61581-chipset ... fine But I am not so expirienced in linux or building a driver or kernel.
Can someone help whre I should make the changes from above? Do I have to build a custom kernel or driver or can I use the dowbload with some changes?
greetings Michael (from germany :D)
For the touch screen part use step 6 here thanks to http://cooljc.me.uk/?p=64
This worked for the new Tontec 3.5 screen and presses seem to be accurate.
Hi pieterk thanks for that .... for future it will be fine if I could reinstall the display with the original raspbian instead of the image from tontec, so I can do updates etc.
Michael
Hi Noralf,
I have created a patch based on comment 3 from ttmz. Any chance you can add it to the official master branch?
Cheers
Jon
diff --git a/Kconfig b/Kconfig
index 995a910..d650b3a 100644
--- a/Kconfig
+++ b/Kconfig
@@ -80,6 +80,12 @@ config FB_TFT_PCD8544
help
Generic Framebuffer support for PCD8544
+config FB_TFT_R61581
+ tristate "FB driver for the R61581 LCD Controller"
+ depends on FB_TFT
+ help
+ Generic Framebuffer support for R61581
+
config FB_TFT_RA8875
tristate "FB driver for the RA8875 LCD Controller"
depends on FB_TFT
diff --git a/Makefile b/Makefile
index 71c755d..3636186 100644
--- a/Makefile
+++ b/Makefile
@@ -21,6 +21,7 @@ obj-$(CONFIG_FB_TFT_ILI9341) += fb_ili9341.o
obj-$(CONFIG_FB_TFT_ILI9481) += fb_ili9481.o
obj-$(CONFIG_FB_TFT_ILI9486) += fb_ili9486.o
obj-$(CONFIG_FB_TFT_PCD8544) += fb_pcd8544.o
+obj-$(CONFIG_FB_TFT_R61581) += fb_r61581.o
obj-$(CONFIG_FB_TFT_RA8875) += fb_ra8875.o
obj-$(CONFIG_FB_TFT_S6D02A1) += fb_s6d02a1.o
obj-$(CONFIG_FB_TFT_S6D1121) += fb_s6d1121.o
diff --git a/fb_r61581.c b/fb_r61581.c
new file mode 100644
index 0000000..ec48e79
--- /dev/null
+++ b/fb_r61581.c
@@ -0,0 +1,116 @@
+/*
+ * FB driver for the R61581 LCD Controller
+ *
+ * Copyright (C) 2014 Noralf Tronnes
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/init.h>
+
+#include "fbtft.h"
+
+#define DRVNAME "fb_r61581"
+#define WIDTH 320
+#define HEIGHT 480
+
+
+/* this init sequence matches R61581 */
+static int default_init_sequence[] = {
+ -1,0xB0, 0x00,
+ -1,0x11,
+ -2,250,
+ -1,0xB3, 0x02, 0x00, 0x00, 0x00,
+ -1,0xC0, 0x13, 0x3B, 0x00, 0x02, 0x00, 0x01, 0x00, 0x43,
+ -1,0xC1, 0x08, 0x16, 0x08, 0x08,
+ -1,0xC4, 0x11, 0x07, 0x03, 0x03,
+ -1,0xC6, 0x00,
+ -1,0xC8, 0x03, 0x03, 0x13, 0x5C, 0x03, 0x07, 0x14, 0x08,
+ 0x00, 0x21, 0x08, 0x14, 0x07, 0x53, 0x0C, 0x13,
+ 0x03, 0x03, 0x21, 0x00,
+ -1,0x35, 0x00,
+ -1,0x36, 0xa0,
+ -1,0x3A, 0x55,
+ -1,0x44, 0x00, 0x01,
+ -1,0xD0, 0x07, 0x07, 0x1D, 0x03,
+ -1,0xD1, 0x03, 0x30, 0x10,
+ -1,0xD2, 0x03, 0x14, 0x04,
+ -1,0x29,
+ -1,0x2C,
+ -3
+};
+
+static void set_addr_win(struct fbtft_par *par, int xs, int ys, int xe, int ye)
+{
+ fbtft_par_dbg(DEBUG_SET_ADDR_WIN, par,
+ "%s(xs=%d, ys=%d, xe=%d, ye=%d)\n", __func__, xs, ys, xe, ye);
+
+ /* Column address */
+ write_reg(par, 0x2A, xs >> 8, xs & 0xFF, xe >> 8, xe & 0xFF);
+
+ /* Row adress */
+ write_reg(par, 0x2B, ys >> 8, ys & 0xFF, ye >> 8, ye & 0xFF);
+
+ /* Memory write */
+ write_reg(par, 0x2C);
+}
+
+static int set_var(struct fbtft_par *par)
+{
+ fbtft_par_dbg(DEBUG_INIT_DISPLAY, par, "%s()\n", __func__);
+
+ switch (par->info->var.rotate) {
+ case 0:
+ write_reg(par, 0x36, 0x00 | (par->bgr << 3));
+ break;
+ case 90:
+ write_reg(par, 0x36, 0x60 | (par->bgr << 3));
+ break;
+ case 180:
+ write_reg(par, 0x36, 0xc0 | (par->bgr << 3));
+ break;
+ case 270:
+ write_reg(par, 0x36, 0xA0 | (par->bgr << 3));
+ break;
+ default:
+ break;
+ }
+
+ return 0;
+}
+
+
+static struct fbtft_display display = {
+ .regwidth = 8,
+ .width = WIDTH,
+ .height = HEIGHT,
+ .init_sequence = default_init_sequence,
+ .fbtftops = {
+ .set_addr_win = set_addr_win,
+ .set_var = set_var,
+ },
+};
+FBTFT_REGISTER_DRIVER(DRVNAME, "renesas,r61581", &display);
+
+MODULE_ALIAS("spi:" DRVNAME);
+MODULE_ALIAS("platform:" DRVNAME);
+MODULE_ALIAS("spi:r61581");
+MODULE_ALIAS("platform:r61581");
+
+MODULE_DESCRIPTION("FB driver for the R61581 LCD Controller");
+MODULE_AUTHOR("Noralf Tronnes");
+MODULE_LICENSE("GPL");
diff --git a/fbtft_device.c b/fbtft_device.c
index b9f4c30..c6af666 100644
--- a/fbtft_device.c
+++ b/fbtft_device.c
@@ -993,6 +993,26 @@ static struct fbtft_device_display displays[] = {
}
}
}, {
+ .name = "tontec35_61581", /* boards after 28 December 2014 */
+ .spi = &(struct spi_board_info) {
+ .modalias = "fb_r61581",
+ .max_speed_hz = 128000000,
+ .mode = SPI_MODE_3,
+ .platform_data = &(struct fbtft_platform_data) {
+ .display = {
+ .buswidth = 8,
+ .backlight = 1,
+ },
+ .bgr = true,
+ .gpios = (const struct fbtft_gpio []) {
+ { "reset", 15 },
+ { "dc", 25 },
+ { "led_", 18 },
+ {},
+ },
+ }
+ }
+ }, {
.name = "upd161704",
.spi = &(struct spi_board_info) {
.modalias = "fb_upd161704",
Development has moved so I don't take any more patches to this repo. Patches have to be sent like regular Linux kernel patches. MAINTAINERS entry: https://git.kernel.org/cgit/linux/kernel/git/gregkh/staging.git/commit/MAINTAINERS?h=staging-testing&id=053e514f9172c10b55b1ef0706da57cecb6c85e3 Ref: https://github.com/notro/fbtft/wiki/Development
FBTFT will most likely appear in Linux 3.20.
can anyone help me get my tontec MZ61581 touch display to work on raspberry pi 2b. I am new to code writing and it has been very frustrating trying to get it to work.... any help would definitely be appreciated and save my hair from being pulled out.
It seems that the Tontec 3.5 Pi screen has changed model again and only produces a white screen with the raspberry pi for example. At a very steep angle I can see a ever (very slight) shadow of the Pi logo but it is pretty much washed out and unreadable.
I am trying the ili9486 driver/config but this does not work.
The new model code is MZ61581 (dated 2014.12.28)