• AVR Freaks

Display driver for mikromedia board for PIC32 with ILI9341 display controller.

Author
Mysil
Super Member
  • Total Posts : 3619
  • Reward points : 0
  • Joined: 2012/07/01 04:19:50
  • Location: Norway
  • Status: offline
2013/12/19 01:56:42 (permalink)
0

Display driver for mikromedia board for PIC32 with ILI9341 display controller.

Hi,
Based on messages by Emanuel Cesar, that I observed just a few days ago, and message from alex88,
I got curious about the change in the mikromedia for PIC32 board.
I have tried to put his attempt into a test program, but I do not have a mikromedia board with the ILI9341 display controller.
 
If you could try the attached test program, and tell if it work with the display and report what happen,  if anything,
I would be willing to help develop a driver.
Please tell if the backlight comes on, and what is displayed, if anything.
The attached project is Not yet a completed driver, it is a test program to check if it is possible to get the
PMP and display controller to initialize and get a pixel displayed.
It is a MPLAB 8.92 project that is compiled with XC32 compiler.
 
To link and debug, the project will refer to a number of include files in  ..\..\microchip\include
so installing the enclosed files in:   microchip_solutions_v2013-06-15\forum\ILI9341_Test\...
may make it easier to locate the files needed.
 
Regards,
   Mysil
#1

11 Replies Related Threads

    alex88
    New Member
    • Total Posts : 13
    • Reward points : 0
    • Joined: 2013/12/18 09:36:50
    • Location: 0
    • Status: offline
    Re:Display driver for mikromedia board for PIC32 with ILI9341 display controller. 2013/12/19 08:01:33 (permalink)
    0
    Mysil,
     
    I tried running your test application on my mikromedia for PIC24 board, but only the backlight comes on. I have attached the initialization routines from Mikromedia and I've been trying to port it to work with the Graphics Library for several hours now. 
    #2
    Mysil
    Super Member
    • Total Posts : 3619
    • Reward points : 0
    • Joined: 2012/07/01 04:19:50
    • Location: Norway
    • Status: offline
    Re:Display driver for mikromedia board for PIC32 with ILI9341 display controller. 2013/12/19 09:47:23 (permalink)
    0
    Hi, Alex
     
    Thanks for the quick feedback,
    obviously it did not work on the first attempt.
     
    Unfortunately, the  __LibTFT_Defs.c file contain the same settings that are already used for HX8347 display controller.  The settings I used were seemingly copied from another driver, and not correct either.
    I will compare the settings with the Datasheet , but that will take a day or so.
     
    Regards,
      Mysil
     
    #3
    alex88
    New Member
    • Total Posts : 13
    • Reward points : 0
    • Joined: 2013/12/18 09:36:50
    • Location: 0
    • Status: offline
    Re:Display driver for mikromedia board for PIC32 with ILI9341 display controller. 2013/12/20 00:48:22 (permalink)
    0
    Mysil,
     
    Quick update: I managed to hammer the driver into shape, somehow the problem seems to be related with the DisplayDisable() calls. I got a crisper image (this was the reason mikroe wanted the change, apparently), but the time it takes to draw the screen is simply too big. I'll spend some more time on it and hopefully get it working as it should. 
     
    Regards,
    Alex
    #4
    Mysil
    Super Member
    • Total Posts : 3619
    • Reward points : 0
    • Joined: 2012/07/01 04:19:50
    • Location: Norway
    • Status: offline
    Re:Display driver for mikromedia board for PIC32 with ILI9341 display controller. 2013/12/20 03:19:57 (permalink)
    +2 (1)
    Good,
    The default GFX handling of communication via PMP is quite inefficient.
    There is a number of changes that may make the driver faster.
     
    On the mikromedia board, where no other devices are connected to the Parallel bus,
    there is actually no need to call the DisplayDisable() function at all, apart from keeping the signal Low level all the time.
     
    HX8347 driver is able to fill the screen in less than 20 millisecond,  clear display as well as image display.
    ILI9341 should do just as well. Show what changes you have made.
     
    Mysil
     
    #5
    alex88
    New Member
    • Total Posts : 13
    • Reward points : 0
    • Joined: 2013/12/18 09:36:50
    • Location: 0
    • Status: offline
    Re:Display driver for mikromedia board for PIC32 with ILI9341 display controller. 2013/12/20 04:21:54 (permalink)
    0
    Mysil,
     
    I've attached the source code for what I managed to do so far. It's not by any means clean code, nor efficient (first time working with PMP and display drivers), but it gets the job done. 
     
    If someone can pinpoint the obvious optimizations, I can carry them out and report the findings. Also, the GetPixel() routine is not yet implemented.
     
    PS: I need to add that the driver was developed and tested on the Mikromedia PIC24, not PIC32.
     
    Alex
    post edited by alex88 - 2013/12/20 04:24:30
    #6
    Mysil
    Super Member
    • Total Posts : 3619
    • Reward points : 0
    • Joined: 2012/07/01 04:19:50
    • Location: Norway
    • Status: offline
    Re:Display driver for mikromedia board for PIC32 with ILI9341 display controller. 2013/12/20 09:06:21 (permalink)
    0
    Hi, alex88
    Good to know that you have got something that works.

    As for optimizations for the driver,
    I think the generous spread of:    DisplayEnable();   ... DisplayDisable()
    sequences is the most obvious candidate, and should be the easiest to tidy up.

    The DisplayEnable()   and  DisplayDisable()  macros are called repeatedly in multiple levels of macros inside  each other.
    Example, in the PutPixel(x, y)  function,
    there is DisplayEnable() before the SetAddress() call,
    and DisplayDisable  after WritePixel(...) function.
    These are sufficient and should be kept in place, I think, all occurrences inside the macros called should be removed. 

    Similarly for all the other functions in the driver.
    Note:
           In the Bar( ...  )   function, the DisplayEnable() call is missing in the  #else   block.
           This will be a pitfall when removing the calls from macros.

    The next optimization I would suggest is about the placement of calls to PMPWaitBusy() function.
    In the GFX pattern code, these synchronizasion calls are placed right after each write to the PMP.
    This is poor use of the hardware, to always wait.
    Instead, move the Wait to just before the next  operation writing to the PMP, that is before the DisplaySetData() and DisplaySetCommand()    
    In this way the CPU may proceed to determine the color or coordinates of the next pixel, while the PMP and display is working. 
    This has to be done consistently through all functions in the driver.
    A call to the PMPWaitBusy()  function  must be made before any call to DisplayDisable(),
    maybe a macro to do both together may be useful.

    In the ILI9341  Datasheet V1.02  2010/12/06 that I am looking at,
    there is no Command register 0xed   ,EDh   description that I am able to find.
    Also, commands:    0xCF,  0xE8,
    and    0xf2  // 3Gamma Function Disable,
    I cannot find in the datasheet, maybe it is a legacy from code for another controller.

    PowerControl command:  0xC1  with parameter (0x11)
    With power supply VCC = 3.3 Volt on mikromedia board to VCI = 3.3 V for display controller,
    I think the voltage  VGH - VGL may still exceed the specification.
    Maybe consider:
        SetIndex(0xc1);         // power control
        WriteParameter(0x13);

    Regardless of the number of comments I have made, I think the driver code seem tidy, and a good base for your further development.

    Regards,
       Mysil
    #7
    alex88
    New Member
    • Total Posts : 13
    • Reward points : 0
    • Joined: 2013/12/18 09:36:50
    • Location: 0
    • Status: offline
    Re:Display driver for mikromedia board for PIC32 with ILI9341 display controller. 2013/12/22 03:21:50 (permalink)
    0
    Mysil,
     
    Thanks for the great suggestions. In my code, the DisplayDisable() macro expands to an empty statement and I kept so that other configurations that share the PMP peripheral can still use the driver.
     
    I will find some time and do some profiling work and I'll post my findings pre/post optimizations.
     
    Alex
    #8
    wojtek
    New Member
    • Total Posts : 3
    • Reward points : 0
    • Joined: 2014/02/22 01:30:08
    • Location: 0
    • Status: offline
    Re:Display driver for mikromedia board for PIC32 with ILI9341 display controller. 2014/02/22 07:47:32 (permalink)
    0
    Hi!
     
    Mysil, I've built your test project with XC v.1.21 on MPLAB X v. 1.95 and flashed to new Micromedia board.
    I think it works as expected. It draws colourful rectangle and a white bar inside. After that paints all screen green.
     
    I can send you photo of rectangles if you want .
    Unfortunately I couldn't put it here - The Forum System doest't trust me enough as I'm new.
     
    There is only one thing I can't understand. Device works as I described only when runs as a release. When I run it in debug mode the screen turns white and stays such all the time. The control reaches while(1) loop in main without problems..
     
    #9
    Mysil
    Super Member
    • Total Posts : 3619
    • Reward points : 0
    • Joined: 2012/07/01 04:19:50
    • Location: Norway
    • Status: offline
    Re:Display driver for mikromedia board for PIC32 with ILI9341 display controller. 2014/02/22 11:21:20 (permalink)
    0
    Hi, Wojtek
    Thanks for trying the test program.
    The display you describe correspond with what I did hope it could do.
    Unfortunately, I do not have a mikromedia board with a ILI9341 display controller to test on.
    I did the test program to get communication going, and after that, alex88 was able to continue on his own.
     
    You could try to build the: ...\Microchip_Solutions_v2013-06-15\Graphics\Primitive layer\Primitives Layer Demo...
    with the driver routines contributed by alex88  on december 20., also in this thread.
    You may use the files: 
        Source\GraphicsConfig.h  
        Source\HardwareProfile.h  
        Configs\HWP_Mikro_PIC32_16PMP.h
    from the project you have already tried.
     
    Edit:
    With your information about the different behaviour between Debug and Release build,
    it has been possible to identify an error in the HWP_Mikro_PIC32_16PMP.h
    file, and hopefully correct that problem.
    An update of the testprogram zipfile is attached.
    The corrected HWP_...  file might be useful even if a different display driver be used.

    Regards,
       Mysil
    post edited by Mysil - 2014/02/23 21:21:15
    #10
    gocemk
    New Member
    • Total Posts : 1
    • Reward points : 0
    • Joined: 2014/11/12 14:20:26
    • Location: 0
    • Status: offline
    Re:Display driver for mikromedia board for PIC32 with ILI9341 display controller. 2014/11/12 14:38:49 (permalink)
    0
    Hi,
     
    I'm trying to get this driver to work with the EasyTFT board with the same controller(ILI9341) that comes with the EasyPIC Fusion7. I'm using PIC32MX795F512L and XC32 v1.21. The display data lines (D0-D7) are connected to PORTE (RE0-RE7). I'm using PMP in 8-bit mode. But it seems that in the ILI9341_driver.c file some header files are missing:
     
    #include "Compiler.h"
    #include "TimeDelay.h"
    #include "Graphics/DisplayDriver.h"
    #include "Graphics/ILI9341.h"
    #include "Graphics/Primitive.h"
     
    Where can i find these files, or am i missing something really obvious here? I am using Microchip MLA v2013-06-15.
     
    Thanks in advance.
    #11
    Mysil
    Super Member
    • Total Posts : 3619
    • Reward points : 0
    • Joined: 2012/07/01 04:19:50
    • Location: Norway
    • Status: offline
    Re:Display driver for mikromedia board for PIC32 with ILI9341 display controller. 2014/11/13 21:25:46 (permalink)
    0 (1)
    Hi, gocemk
     
    Most of those files missing from your build should be available in the MLA installation you have.
    You may try to look in:
        microchip_solutions_v2013-05-15/Microchip/Include/Compiler.h
        microchip_solutions_v2013-05-15/Microchip/Include/TimeDelay.h
        microchip_solutions_v2013-05-15/Microchip/Include/Graphics/DiaplayDriver.h
        microchip_solutions_v2013-05-15/Microchip/Include/Graphics/Primitive.h
     
    ILI9341.h  should be in the zipfile you downloaded from the previous message in this thread,
    look in:  ILI9341_Test/Graphics/ILI9341.h
    If you want to, you may copy it to:
            microchip_solutions_v2013-05-15/Microchip/Include/Graphics/
     
    Regards,
       Mysil
     
    #12
    Jump to:
    © 2020 APG vNext Commercial Version 4.5