Andy's Workshop Forums

General Category => stm32plus C++ library => Topic started by: kyildirim on October 04, 2014, 02:15:10 pm

Title: mapping Custom LCD pinouts
Post by: kyildirim on October 04, 2014, 02:15:10 pm
Hello,
After accustomed to the library, I have decided to work with ili9325 example.
Again, I have a diffrent LCD pinout, so need to map my LCD's pins rregarding to library.

I have found that most of the LCD pin mapping done in FSMC (if I am wrong please correct me).
Where I have to play to change the mapping of ports such as this LCD. I found /include/fsmc/FsmcNand.h contain the required values.
But like in ping example, I don't want to touch the library itself, instead I like to find a way in my code.

My LCD port mapping as per attachment;
regards,
Kemal
Title: Re: mapping Custom LCD pinouts
Post by: Andy Brown on October 05, 2014, 06:28:14 am
Hi,

You mentioned in your other thread that you are using the STM32F103RB device. This device does not have the FSMC peripheral so you cannot use the ili9325 example 'out of the box'. All is not lost though because you can drive it using plain GPIO.

There is an example: hx8352a_gpio (https://github.com/andysworkshop/stm32plus/tree/master/examples/hx8352a_gpio) that shows how to use the GPIO driver. You will need to modify the ILI9325 example accordingly.

Copy the following enumeration to a public section of the ILI9325Test class. Change the port/pin mappings if your board does not expose the pins I've used:


    /**
     * Gpio16AccessMode is templated with the HX8352ATest class. Therefore it will expect to
     * find the following constants available for static access
     */

    enum {
      Port_CONTROL = GPIOE_BASE,        // will use [0..2]
      Port_DATA    = GPIOD_BASE,        // will use whole port as data bus D0..15

      Pin_RESET    = GPIO_Pin_0,
      Pin_WR       = GPIO_Pin_1,
      Pin_RS       = GPIO_Pin_2
    };


Change the LcdAccessMode typedef to look like this:


    typedef Gpio16BitAccessMode<ILI9325Test,COLOURS_16BIT,72,50,50> LcdAccessMode


Change the _accessMode declaration:


      _accessMode=new LcdAccessMode;


That's the most important stuff. You will also have to delete the parts of the demo that use DMA to transfer graphics to the LCD because DMA to the GPIO pins isn't supported.

The lzg graphics demo will not work without modification because the graphics are saved for a 262K colour depth and the GPIO driver is set to 64K depth.
Title: Re: mapping Custom LCD pinouts
Post by: kyildirim on October 06, 2014, 12:01:54 am
Hi there Andy,
Actually this is more than I've expected. You've nearly wrote the code. :-)
thannks again, I will share the result, if I succeed.

regards,