Error in GFX\drivers\gdisp\ILI9320\gdisp

wolf
Posts: 25
Joined: Mon Dec 31, 2012 1:55 pm
Location: France
Been thanked: 2 times

Error in GFX\drivers\gdisp\ILI9320\gdisp

Postby wolf » Mon Mar 04, 2013 9:00 pm

Hi all,

i found an error in above mentioned driver!
If you rotate the LCD i.e. GDISP_ROTATE_90, lld_lcdSetCursor(uint16_t x, uint16_t y) malfunctions. This results in no pixels displaying beyond x=255 coordinates.
The reason is wrong address calculation and trying to write a 9 bit value to reg 0x0020 which in effect only takes 8 bit (see ILI9320 data sheet).
I tried the following fix doing away with the now unnecessary address calculation too (i left the commented original lines):

Code: Select all

static void lld_lcdSetCursor(uint16_t x, uint16_t y) {
//  uint32_t addr;

//  addr = y * 0x100 + x;

  switch(GDISP.Orientation) {
    case GDISP_ROTATE_0:
//      lld_lcdWriteReg(0x0020, addr & 0xff);   /* low addr */
//      lld_lcdWriteReg(0x0021, (addr >> 8) & 0x1ff); /* high addr */
      lld_lcdWriteReg(0x0020, x);   /* Horizontal 8 valid bits. */
      lld_lcdWriteReg(0x0021, y);   /* Vertical 9 valid bits. */
      break;

      case GDISP_ROTATE_90:
//      lld_lcdWriteReg(0x0020, (addr >> 8) & 0x1ff);   /* low addr */
//      lld_lcdWriteReg(0x0021, addr & 0xff); /* high addr */
      lld_lcdWriteReg(0x0020, y);   /* Horizontal 8 valid bits. */
      lld_lcdWriteReg(0x0021, x);   /* Vertical 9 valid bits. */
         break;

      case GDISP_ROTATE_180:
      break;

      case GDISP_ROTATE_270:
      break;
   }
}


It works for both GDISP_ROTATE_0 and GDISP_ROTATE_90 ok now.

I hope this is of any help for the community.
@ Tectu - Great job

Best regards to all

Wolf

User avatar
Tectu
Posts: 1226
Joined: Thu May 10, 2012 9:50 am
Location: Switzerland
Contact:

Re: Error in GFX\drivers\gdisp\ILI9320\gdisp

Postby Tectu » Mon Mar 04, 2013 9:11 pm

Hey wolf,

Thank you very much for your feedback!

When did you sync your GFX repo the last time? There was a small fix for the ILI9320 yesterday evening. It's possible that there is still some issue since I didn't had time to test it together with the GINPUT module. However, all four orientation modes are working correctly for me since yesterday. I'm using the Olimex STM32-LCD board. Sorry for not mentioning this change/fix in the blog.
Please don't hesitate to ask any questions or submit patches ;-)


~ Tectu

wolf
Posts: 25
Joined: Mon Dec 31, 2012 1:55 pm
Location: France
Been thanked: 2 times

Re: Error in GFX\drivers\gdisp\ILI9320\gdisp

Postby wolf » Mon Mar 04, 2013 10:32 pm

@Tectu

Hi Tectu,

i just updated to the latest version from the repo .
I looks ok now - sorry for not updating before commenting.

When using IAR, currently updating from the repo is a bit troublesome as the compiler doesn't like the __inline.
It needs to be replaced by a #pragma inline before each function, which is a bit of work to do.

Thanks for your fast reply and the job you do on GFX

Wolf

User avatar
Tectu
Posts: 1226
Joined: Thu May 10, 2012 9:50 am
Location: Switzerland
Contact:

Re: Error in GFX\drivers\gdisp\ILI9320\gdisp

Postby Tectu » Mon Mar 04, 2013 10:52 pm

Glad to hear that it works now for you!

You're not the first one telling me the issue about the __inline. I just quickly changed every __inline to an inline. Can you confirm that this works with IAR? Is there anything else required?


~ Tectu

wolf
Posts: 25
Joined: Mon Dec 31, 2012 1:55 pm
Location: France
Been thanked: 2 times

Re: Error in GFX\drivers\gdisp\ILI9320\gdisp

Postby wolf » Tue Mar 05, 2013 8:07 am

@ Tectu

Hi Tectu,
yes - a plain inline without any underscores is OK for IAR.

~Wolf

User avatar
Tectu
Posts: 1226
Joined: Thu May 10, 2012 9:50 am
Location: Switzerland
Contact:

Re: Error in GFX\drivers\gdisp\ILI9320\gdisp

Postby Tectu » Tue Mar 05, 2013 8:10 am

Cool! GCC works too so far, I just hope that there aren't any other compiler issues :P
Let me know when there are any further issues.


~ Tectu


Return to “LCD Driver and Graphic Framework”

Who is online

Users browsing this forum: No registered users and 16 guests