Library ILI9481 320*480 3.5

Working libraries, libraries being ported and related hardware
User avatar
efftek
Posts: 80
Joined: Tue Jan 10, 2017 9:42 pm
Location: Πάφος, Cyprus
Contact:

Re: Library ILI9481 320*480 3.5

Post by efftek » Tue Jan 02, 2018 2:48 pm

Hi guys, happy new year to you all.

I have a prototype/adapter board which I made which will work with this tft driver as it uses the same data and control lines. My problem is that I would dearly love access to more ADC pins but as PA0 to PA7 are ADC and are used for tft data, I’m hoping to design a new board which I can connect this module to https://www.aliexpress.com/item/Mini-ve ... 0.0.P05Hai

I’m not an expert low level programmer and changing the driver to use PC0 to PC7 for tft data is above my skill set. Can anyone please advise if it can be done and if so, how.

Regards, Steve.

User avatar
Pito
Posts: 1738
Joined: Sat Mar 26, 2016 3:26 pm
Location: Rapa Nui

Re: Library ILI9481 320*480 3.5

Post by Pito » Tue Jan 02, 2018 2:52 pm

If you plan a new adapter board consider the FSMC interface for the ILI..
FSMC works 8bit as well.
and changing the driver to use PC0 to PC7 for tft data
It seems you have to change (in Adafruit_ILI9481_8bit_STM.h) the

Code: Select all

#define TFT_DATA       GPIOA
to

Code: Select all

#define TFT_DATA       GPIOC
for the PortC data bus.
Last edited by Pito on Tue Jan 02, 2018 3:16 pm, edited 1 time in total.
Pukao Hats Cleaning Services Ltd.

stevestrong
Posts: 2061
Joined: Mon Oct 19, 2015 12:06 am
Location: Munich, Germany
Contact:

Re: Library ILI9481 320*480 3.5

Post by stevestrong » Tue Jan 02, 2018 3:10 pm

Steve, your board is the so called generic F407 mini. I could make my 3.5 inch LCD work with my lib and FSMC (16bit bus) (read the earlier posts of this thread).

User avatar
efftek
Posts: 80
Joined: Tue Jan 10, 2017 9:42 pm
Location: Πάφος, Cyprus
Contact:

Re: Library ILI9481 320*480 3.5

Post by efftek » Tue Jan 02, 2018 4:48 pm

Hi guys thanks for the replies.

I have a number of tft shields with standard uno connectors so I really want to make use of them rather than buying different ones.

If all I have to do is declare #define TFT_DATA GPIOC, then I’ll be happy but surely it’s not that easy is it?

Steve.

nopnop2002
Posts: 2
Joined: Thu Jan 04, 2018 7:28 am
Location: Japan

Re: Library ILI9481 320*480 3.5

Post by nopnop2002 » Mon Jan 08, 2018 8:17 am

@efftek

I may not understand your request right, but please try this.

https://github.com/nopnop2002/STM32_TFT_8bit

I tested my STM32F103 RBT6 & 3.5 inch 320*480 ILI9481 TFT.
It's work fine using GPIOC.

flodejr
Posts: 37
Joined: Sat Sep 16, 2017 2:46 pm

Re: Library ILI9481 320*480 3.5

Post by flodejr » Mon Jan 15, 2018 1:48 pm

@stevestrong,

Hi, I am trying to interface my generic F407 board to a TFT LCD utilizing nt35310. It seems to be compatible to the ili9481, however, my TFT LCD is using only 8Bit parallel. Using your library and FSMC, I am getting displays but the coordinates are wrong and colors are wrong obviously because of the loss in the 8 higher order bits. I am pretty happy because I am getting some displays from the LCD, I have previously tried using Stm32 HAL code but am not getting anything from the LCD at all, at least your library gave me some displays.

I have tried changing the FSMC to 8bits in the libmaple library, but then the LCD went dead right after the change. I am not sure what went wrong, hopefully you can provide some insights.

stevestrong
Posts: 2061
Joined: Mon Oct 19, 2015 12:06 am
Location: Munich, Germany
Contact:

Re: Library ILI9481 320*480 3.5

Post by stevestrong » Mon Jan 15, 2018 2:35 pm

flodejr wrote:
Mon Jan 15, 2018 1:48 pm
I have tried changing the FSMC to 8bits in the libmaple library, but then the LCD went dead right after the change. I am not sure what went wrong, hopefully you can provide some insights.
Please provide detailed information what and how exactly have you tried.

I am not sure if it is enough only to set MWID = 00 (8 bit) by using flag [FSMC_BCR_MWID_8BITS]. It also may be necessary to split the 16 bit access into two successive 8 bit accesses by software, if the hardware doesn't do that.
So basically do

Code: Select all

*fsmcData = <high_nibble>;
*fsmcData = <low_nibble>;
instead of currently implemented single data access.
Command access may be ok, but maybe is necessary to split it, too.

flodejr
Posts: 37
Joined: Sat Sep 16, 2017 2:46 pm

Re: Library ILI9481 320*480 3.5

Post by flodejr » Mon Jan 15, 2018 3:05 pm

stevestrong wrote:
Mon Jan 15, 2018 2:35 pm
Please provide detailed information what and how exactly have you tried.

I am not sure if it is enough only to set MWID = 00 (8 bit) by using flag [FSMC_BCR_MWID_8BITS]. It also may be necessary to split the 16 bit access into two successive 8 bit accesses by software, if the hardware doesn't do that.
So basically do

Code: Select all

*fsmcData = <high_nibble>;
*fsmcData = <low_nibble>;
instead of currently implemented single data access.
Command access may be ok, but maybe is necessary to split it, too.
I have changed the fsmc code in libmaple to reflect the 8bit FSMC by using the FSMC_BCR_MWID_8BITS flag and also change the pin definitions for D0-D7 only, eliminating the pin definitions for D8-D15. Also change the fsmcData address to +1<<17 (from what I read, the data access addresss for 16 bit is +1<<18, but for 8bit it should be +1<<17, not sure if right). I have split the fsmcData access to send high and low bytes as you have mentioned, also tried splitting the fsmcCommand as well. All these have been done, but the LCD failed to respond after switching to 8bits fsmc. When I revert back the changes the LCD responded.

I also left the fsmc as 16 bits but split the data and command into 2 16 bit values containing the high and low order respectively since the LCD will never see the high order 8 bits as there are no connections but the LCD failed to respond after, so I am not sure if the fsmc does anything special between 16 bit and 8 bit access.

stevestrong
Posts: 2061
Joined: Mon Oct 19, 2015 12:06 am
Location: Munich, Germany
Contact:

Re: Library ILI9481 320*480 3.5

Post by stevestrong » Mon Jan 15, 2018 3:11 pm

i would go a bit more systematically in your place.
Only do one change at a time, and then check the effect.
I think you should not change the fsmcData address.

I haven't tried in 8 bit mode, but I could give it a try, just that time is missing...

flodejr
Posts: 37
Joined: Sat Sep 16, 2017 2:46 pm

Re: Library ILI9481 320*480 3.5

Post by flodejr » Tue Jan 16, 2018 4:54 am

@stevestrong,

I managed to get the code working in 8 bit FSMC mode, supporting 3.5inch TFT module with NT35310 chipset. Modifications done :
1) Changed libmaple/fsmc.h to include switch between FSMC16 bit mode and FSMC 8 bit mode

Code: Select all

#ifdef _FSMC16_
volatile uint16_t * fsmcCommand;
volatile uint16_t * fsmcData;
#endif

#ifdef _FSMC8_
volatile uint8_t * fsmcCommand;
volatile uint8_t * fsmcData;
#endif
2) Changed libmaple/fsmc.c to include switch between FSMC16 bit mode and FSMC 8 bit mode

Code: Select all

#ifdef _FSMC16_
// used control, address and data lines
// NOE -> RD, NWE -> WR, A18 -> RS, NE1 -> CS
const uint8_t fsmc_pins[]= {FSMC_NOE, FSMC_NWE, FSMC_NE1, FSMC_A18,
							FSMC_D0, FSMC_D1, FSMC_D2, FSMC_D3,
							FSMC_D4, FSMC_D5, FSMC_D6, FSMC_D7,
							FSMC_D8, FSMC_D9, FSMC_D10, FSMC_D11,
							FSMC_D12, FSMC_D13, FSMC_D14, FSMC_D15};

#endif
#ifdef _FSMC8_
const uint8_t fsmc_pins[]= {FSMC_NOE, FSMC_NWE, FSMC_NE1, FSMC_A18,
							FSMC_D0, FSMC_D1, FSMC_D2, FSMC_D3,
							FSMC_D4, FSMC_D5, FSMC_D6, FSMC_D7};

#endif


#ifdef _FSMC16_
volatile uint16_t * fsmcCommand;
volatile uint16_t * fsmcData;
#endif

#ifdef _FSMC8_
volatile uint8_t * fsmcCommand;
volatile uint8_t * fsmcData;
#endif

#ifdef _FSMC16_	
	uint32_t val = (FSMC_BCR_MTYP_SRAM | FSMC_BCR_MWID_16BITS | FSMC_BCR_WREN);
#endif
#ifdef _FSMC8_
	uint32_t val = (FSMC_BCR_MTYP_SRAM | FSMC_BCR_MWID_8BITS | FSMC_BCR_WREN);
#endif
3) All nt35310 commands and register values are 8 bits, so don't have to split the writeCmd and writeData into 2 separate 8 bit sends. However, for color data, have to split into 2 sends, high order followed by low order.

4) Have to init the LCD to receive 16 bit data as 2 sends, register 0x3A, value 0x05 (the default is 0x55 for single send 16 bit)

Code: Select all

rotation: 0, runtime: 5961
rotation: 1, runtime: 5960
rotation: 2, runtime: 5961
rotation: 3, runtime: 5961

Benchmark                Time (microseconds)
Screen fill              114867
Text                     5961
Lines                    86810
Horiz/Vert Lines         9532
Rectangles (outline)     5487
Rectangles (filled)      280992
Circles (filled)         48546
Circles (outline)        37019
Triangles (outline)      24053
Triangles (filled)       92655
Rounded rects (outline)  14342
Rounded rects (filled)   308842
Done!

Post Reply