Jump to content

ili9341 and ChibiOS


kamocat

Recommended Posts

Hi,

I'm having trouble getting a display to work with uGFX. It's Adafruit's Raspberry pi 2.8" display, which uses an ili9341 over SPI.

I am fairly confident that SPI is working, and that my wiring is correct. However, I'm not seeing anything show up on the screen. (My main.c uses the gdisp/basic demo, with a blinking LED in a seperate thread)

So, I think there must be an issue with my board_ILI9341.h. Does it seem normal? I have it set up as simple as I could. I even dropped the clock speed all the way down. I did change the data and index variables to 8-bit integers, since it appeared it was 8-bit data being transferred into them in ili9341.c.

Any ideas?

board_ILI9341.h

main.c

chconf.h

gfxconf.h

halconf.h

Makefile

mcuconf.h

Link to comment
Share on other sites

Well, I made a simple test to see if i'm actually writing data to the display.

It turns out I am. At least, something is getting through.

int main(void) {	
    int color = 0;
    gfxInit();

    write_index( 0, 0x2C ); // Write to frame memory
    
    while( true ) {
        write_data( 0, color );
        ++color;
        chThdSleepMilliseconds(100);
    }
}

What shows up on the screen is dark grey for 1s (with vertical lines), light grey for 18s (with vertical lines), and white for 3s.

What I was expecting was a rainbow of colors. Hmm. I even slowed it down to be sure I wasn't overwriting the whole screen.

Now say I change it to write the whole color word. You would think that would change the width of the lines, or something. But no change.

    while( true ) {
        write_data( 0, color>>8 );
        write_data( 0, color & 0xFF );
        ++color;
        chThdSleepMilliseconds(100);
    }

So, I'm confused here. Something is clearly happening, but not what I expect. I can't blame the uGFX library - I'm below that level, just trying to write data to the screen. Maybe this actually is supposed to be a 16-bit write?

Link to comment
Share on other sites

I found the issue.

I had the D/C pin polarity backwards. I finally noticed when I was reading the datasheet for my other display.

Data is HI. Control is LOW. Oops.

So, now I have it running beautifully on SPI at 21 MHz. A whole screen refresh takes about 0.5 seconds - not surprising, since it's a lot of data.

Thanks for your patience.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...