Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Waveshare 3.2inch RPi LCD (B) V3 #181

Closed
imaginal opened this issue Nov 15, 2014 · 11 comments

Comments

Projects
None yet
6 participants
@imaginal
Copy link

commented Nov 15, 2014

I have Waveshare 3.2inch RPi LCD (B) V3 connected to Raspberry Pi Model B+
http://www.wvshare.com/product/3.2inch-RPi-LCD-B.htm
http://www.amazon.com/Waveshare-Raspberry-Resistive-Interface-Rapsberry-pi/dp/B00N0SNVQE

in the attached firmware image DVK512-LCD32(V3)-140817.img I have found these settings

fbtft_device name=flexfb gpios=dc:22,reset:27 speed=48000000
flexfb width=320 height=240 buswidth=8 init=-1,0xCB,0x39,0x2C,0x00,0x34,0x02,-1,0xCF,0x00,0XC1,0X30,-1,0xE8,0x85,0x00,0x78,-1,0xEA,0x00,0x00,-1,0xED,0x64,0x03,0X12,0X81,-1,0xF7,0x20,-1,0xC0,0x23,-1,0xC1,0x10,-1,0xC5,0x3e,0x28,-1,0xC7,0x86,-1,0x36,0x28,-1,0x3A,0x55,-1,0xB1,0x00,0x18,-1,0xB6,0x08,0x82,0x27,-1,0xF2,0x00,-1,0x26,0x01,-1,0xE0,0x0F,0x31,0x2B,0x0C,0x0E,0x08,0x4E,0xF1,0x37,0x07,0x10,0x03,0x0E,0x09,0x00,-1,0XE1,0x00,0x0E,0x14,0x03,0x11,0x07,0x31,0xC1,0x48,0x08,0x0F,0x0C,0x31,0x36,0x0F,-1,0x11,-2,120,-1,0x29,-1,0x2c,-3

ads7846_device model=7846 cs=1 gpio_pendown=17 speed=1000000 keep_vref_on=1 swap_xy=0 pressure_max=255 x_plate_ohms=60 x_min=200 x_max=3900 y_min=200 y_max=3900

the initialization string is very close to fb_ili9340 driver, so after few days of testing I found this configuration is pretty stable

fbtft_device.custom
fbtft_device.name=fb_ili9340
fbtft_device.gpios=dc:22,reset:27
fbtft_device.bgr=1
fbtft_device.speed=48000000

can you create a separate waveshare32b device based on this config?

@concefly

This comment has been minimized.

Copy link

commented Nov 16, 2014

You can modify fbtft_device.c yourself.

write like this:

{
        .name = "waveshare32b",
        .spi = &(struct spi_board_info) {
            .modalias = "fb_ili9340",
            .max_speed_hz = 48000000,
            .mode = SPI_MODE_0,
            .platform_data = &(struct fbtft_platform_data) {
                .display = {
                    .buswidth = 8,
                    .backlight = 1,
                },
                .bgr = true,
                .gpios = (const struct fbtft_gpio []) {
                    { "reset", 27 },
                    { "dc", 22 },
                    { "led", 18 },
                    {},
                },
            }
        }
    },

Rebuild the kernel then you can loard TFT driver by typing:

modprobe fbtft_device name=waveshare32b
@notro

This comment has been minimized.

Copy link
Owner

commented Nov 20, 2014

can you create a separate waveshare32b device based on this config?

I'm sorry, but I don't have time to do it now. I'm struggling to keep up with the issues while rewriting FBTFT from scratch. I want to get the drivers included in the kernel.

@andrealvarez

This comment has been minimized.

Copy link

commented Dec 3, 2014

@notro

This comment has been minimized.

Copy link
Owner

commented Dec 5, 2014

@concefly

can you create a separate waveshare32b device based on this config?

I have time this weekend. Can you test if rotation (rotate={0,90,180,270}) works using fb_ili9340?

Waveshare 3.2inch RPi LCD (B) V3

Do someone know what the changes are between the versions? This being version 3.
Should I include the version in the name:

waveshare32b
waveshare32b-v3

Suggested change to fbtft_device:

static int waveshare32b_init_sequence[] = {
        -1,0xCB,0x39,0x2C,0x00,0x34,0x02,-1,0xCF,0x00,0xC1,0x30,
        -1,0xE8,0x85,0x00,0x78,-1,0xEA,0x00,0x00,-1,0xED,0x64,0x03,0x12,0x81,
        -1,0xF7,0x20,-1,0xC0,0x23,-1,0xC1,0x10,-1,0xC5,0x3e,0x28,-1,0xC7,0x86,
        -1,0x36,0x28,-1,0x3A,0x55,-1,0xB1,0x00,0x18,-1,0xB6,0x08,0x82,0x27,
        -1,0xF2,0x00,-1,0x26,0x01,
        -1,0xE0,0x0F,0x31,0x2B,0x0C,0x0E,0x08,0x4E,0xF1,0x37,0x07,0x10,0x03,0x0E,0x09,0x00,
        -1,0xE1,0x00,0x0E,0x14,0x03,0x11,0x07,0x31,0xC1,0x48,0x08,0x0F,0x0C,0x31,0x36,0x0F,
        -1,0x11,-2,120,-1,0x29,-1,0x2c,-3 };


static struct fbtft_device_display displays[] = {
    {
[...]
        .name = "waveshare32b",
        .spi = &(struct spi_board_info) {
            .modalias = "fb_ili9340",
            .max_speed_hz = 48000000,
            .mode = SPI_MODE_0,
            .platform_data = &(struct fbtft_platform_data) {
                .display = {
                    .buswidth = 8,
                    .backlight = 1,
                    .init_sequence = waveshare32b_init_sequence,
                },
                .bgr = true,
                .gpios = (const struct fbtft_gpio []) {
                    { "reset", 27 },
                    { "dc", 22 },
                    {},
                },
            }
        }

As far as I can see, there is no backlight control on this display. I this correct?

@notro

This comment has been minimized.

Copy link
Owner

commented Dec 5, 2014

Linking to relevant issue: notro/rpi-firmware#6

notro added a commit that referenced this issue Dec 7, 2014

@eliujl

This comment has been minimized.

Copy link

commented Jan 18, 2015

I got a Waveshare SpotPear 3.2 V3 for my B+ and followed all the steps. However I got the following problem:

[ 171.098377] fbtft_device: SPI devices registered:
[ 171.098426] fbtft_device: spidev spi0.0 500kHz 8 bits mode=0x00
[ 171.098445] fbtft_device: spidev spi0.1 500kHz 8 bits mode=0x00
[ 171.098511] fbtft_device: 'fb' Platform devices registered:
[ 171.098545] fbtft_device: bcm2708_fb id=-1 pdata? no
[ 171.098681] fbtft_device: Deleting spi0.0
[ 171.102559] flexfb spi0.0: fbtft_request_gpios: gpio_request_one('dc'=22) failed with -16
[ 171.102697] fbtft_device: GPIOS used by 'flexfb':
[ 171.102710] fbtft_device: 'dc' = GPIO22
[ 171.102719] fbtft_device: 'reset' = GPIO27
[ 171.102728] fbtft_device: SPI devices registered:
[ 171.102743] fbtft_device: spidev spi0.1 500kHz 8 bits mode=0x00
[ 171.102756] fbtft_device: flexfb spi0.0 48000kHz 8 bits mode=0x00

The factory image (DVK512-LCD32(V4)-141115.img, which seems different from previous ones, and why it is V4???) in the CD works just fine, and I found the following strings:
flexfb width=320 height=240 buswidth=8 init=-1,0xCB,0x39,0x2C,0x00,0x34,0x02,-1,0xCF,0x00,0XC1,0X30,-1,0xE8,0x85,0x00,0x78,-1,0xEA,0x00,0x00,-1,0xED,0x64,0x03,0X12,0X81,-1,0xF7,0x20,-1,0xC0,0x23,-1,0xC1,0x10,-1,0xC5,0x3e,0x28,-1,0xC7,0x86,-1,0x36,0x28,-1,0x3A,0x55,-1,0xB1,0x00,0x18,-1,0xB6,0x08,0x82,0x27,-1,0xF2,0x00,-1,0x26,0x01,-1,0xE0,0x0F,0x31,0x2B,0x0C,0x0E,0x08,0x4E,0xF1,0x37,0x07,0x10,0x03,0x0E,0x09,0x00,-1,0XE1,0x00,0x0E,0x14,0x03,0x11,0x07,0x31,0xC1,0x48,0x08,0x0F,0x0C,0x31,0x36,0x0F,-1,0x11,-2,120,-1,0x29,-1,0x2c,-3
fbtft_device debug=3 rotate=90 name=flexfb speed=16000000 gpios=reset:25,dc:24
fbtft_device name=flexfb gpios=dc:22,reset:27 speed=48000000

Then I tried different GPIO pin settings (e.g., change 22/27 to 25/24, and other ways I found in #6 #181, etc.) for mobprobe but kept getting error -16.

The CD includes the following interface file for V3
3 2inch rpi lcd v3

Any ideas? Thanks.

@notro

This comment has been minimized.

Copy link
Owner

commented Jan 18, 2015

[ 171.102559] flexfb spi0.0: fbtft_request_gpios: gpio_request_one('dc'=22) failed with -16

-16 is -EBUSY, meaning the gpio is already requested.

fbtft_device just adds a device, a description of the display, which it does without error.
When the flexfb driver is handed that description, it tries to request gpio 22, but is turned down, so it aborts probing.
I can't help with display specific problems.

@eliujl

This comment has been minimized.

Copy link

commented Jan 19, 2015

Thanks for the info. I decided to try something else. So I tried the builtin branch. But this time it seems even stranger. Nothing happens at all ... Even if I type modprobe, dmesg still does not show anything about fbtft. Any suggestion will be appreciated.

@notro

This comment has been minimized.

Copy link
Owner

commented Jan 19, 2015

The builtin branch have the drivers builtin and not as loadable modules, i.e. they are always loaded. So there is nothing to modprobe.

See here for how to pass arguments to fbtft_device when using that branch: https://github.com/notro/rpi-firmware/wiki/branch:-builtin

@techiecool

This comment has been minimized.

Copy link

commented Feb 3, 2015

is there anyway to connect/install the drivers for waveshare raspi 3.2" lcd to raspberry pi b ?

@notro

This comment has been minimized.

Copy link
Owner

commented May 23, 2015

Closing issue since there has been no activity for more than 2 months. Reopen if needed.

@notro notro closed this May 23, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.