Lib for ILI9486 - 3.5 inch 480x320 touch TFT for RPi

Working libraries, libraries being ported and related hardware
User avatar
Pito
Posts: 561
Joined: Sat Mar 26, 2016 3:26 pm
Location: Rapa Nui

Re: Lib for ILI9486 - 3.5 inch 480x320 touch TFT for RPi

Postby Pito » Sun Jan 08, 2017 10:19 am

I am going to overclock the ZET6 too, see above my post.
I did it 100x but in other environments. It is extremely easy with chibios or with original ST libs.
You just change the PLL multiplier from 9 to 12 in the setup in our case.

The sw setup is usually written such it adjusts all other settings. Not sure how it works here. Core guys must say.
I always let the flash settings (flash waitstates) as-is as the overclock to 96MHZ is small and the 103C will work with 96MHz fine.
Last edited by Pito on Sun Jan 08, 2017 10:32 am, edited 1 time in total.

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

Re: Lib for ILI9486 - 3.5 inch 480x320 touch TFT for RPi

Postby Pito » Sun Jan 08, 2017 10:27 am

@Pito, where can I find info how to overclock to 96MHz beside this?


As a dirty hack try in boards_setup.cpp for BP

Code: Select all

// Allow boards to provide a PLL multiplier. This is useful for
// e.g. STM32F100 value line MCUs, which use slower multipliers.
// (We're leaving the default to RCC_PLLMUL_9 for now, since that
// works for F103 performance line MCUs, which is all that LeafLabs
// currently officially supports).
#ifndef BOARD_RCC_PLLMUL
#define BOARD_RCC_PLLMUL RCC_PLLMUL_12
#endif

Hopefully the setup sw is using the BOARD_RCC_PLLMUL for all other timing settings too.. :)
USB - shall work fine in 103 with integer multiplies of 48MHz.

PS: I did with my board but USB stops working.
So there must be the USB divider set to 2 manually too..
PPS: now I see why, thanks Roger :)
Last edited by Pito on Sun Jan 08, 2017 10:45 am, edited 3 times in total.

User avatar
RogerClark
Posts: 5311
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: Lib for ILI9486 - 3.5 inch 480x320 touch TFT for RPi

Postby RogerClark » Sun Jan 08, 2017 10:38 am

Take a look at the GD32F103 board and variant.

I added CPU speed to that variant as it will operate on a wider range of frequencies while still maintaining USB.

Unfortunately, the STM32F103 will only run at 72Mhz or 48Mhz and still run USB, as USB clock is run from the main clock (after its been multiplied up), and there only two divider values (1.5 and 1.0)

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

Re: Lib for ILI9486 - 3.5 inch 480x320 touch TFT for RPi

Postby Pito » Sun Jan 08, 2017 10:55 am

With my above hack the usb stops working as Roger indicates, with Serial1 it does not set the correct uart baudrate, but the code works it seems..
When I add the cpu freq

Code: Select all

#ifndef BOARD_RCC_PLLMUL
#define BOARD_RCC_PLLMUL RCC_PLLMUL_12
#define F_CPU 96000000
#endif

it does not help with the uart baudrate either - so it seems the timing settings in this environment are set by if-endif rather than by actual calculation from F_CPU.

The other envirs I saw they set PLL_MUL and XTAL_FREQ and from that they got F_CPU and then all other settings (usb, uarts, timers, systick, adc_samprates, etc.) are calculated within the setup from this single value.

So I think the board's variants shall include only F_XTAL and PLLMUL as the only parameters..
Or, better, F_CPU and the F_XTAL as the only parameters.. We have got computers for everything else to be calculated/derived :P

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

Re: Lib for ILI9486 - 3.5 inch 480x320 touch TFT for RPi

Postby Pito » Sun Jan 08, 2017 11:37 am

Adding the CPU Frequency speed setting into the Tools-> menu:
==============================================================

Add in ..\Arduino_STM32\STM32F1\boards.txt into your BPill board (103C) variant in the:

Code: Select all

###################### Generic STM32F103C ########################################
..
#---------------------------- UPLOAD METHODS ---------------------------
..
<<<<<<<< HERE


this:

Code: Select all

genericSTM32F103C.menu.cpu_speed.speed_72mhz=72Mhz (standard)
genericSTM32F103C.menu.cpu_speed.speed_72mhz.build.f_cpu=72000000L
genericSTM32F103C.menu.cpu_speed.speed_48mhz=48Mhz (underclk)
genericSTM32F103C.menu.cpu_speed.speed_48mhz.build.f_cpu=48000000L
genericSTM32F103C.menu.cpu_speed.speed_96mhz=96Mhz (overclk)
genericSTM32F103C.menu.cpu_speed.speed_96mhz.build.f_cpu=96000000L
genericSTM32F103C.menu.cpu_speed.speed_120mhz=120Mhz (superoverclk)
genericSTM32F103C.menu.cpu_speed.speed_120mhz.build.f_cpu=120000000L
genericSTM32F103C.menu.cpu_speed.speed_128mhz=128Mhz (ultraoverclk)
genericSTM32F103C.menu.cpu_speed.speed_128mhz.build.f_cpu=128000000L


and use this hack in ..\Arduino_STM32\STM32F1\variants\generic_stm32f103c\wirish\boards_setup.cpp:

Code: Select all

// Allow boards to provide a PLL multiplier. This is useful for
// e.g. STM32F100 value line MCUs, which use slower multipliers.
// (We're leaving the default to RCC_PLLMUL_9 for now, since that
// works for F103 performance line MCUs, which is all that LeafLabs currently officially supports).
#ifndef BOARD_RCC_PLLMUL
#if F_CPU==96000000
   #define BOARD_RCC_PLLMUL RCC_PLLMUL_12
#elif F_CPU==72000000
   #define BOARD_RCC_PLLMUL RCC_PLLMUL_9   
#elif F_CPU==48000000
   #define BOARD_RCC_PLLMUL RCC_PLLMUL_6
#elif F_CPU==120000000
   #define BOARD_RCC_PLLMUL RCC_PLLMUL_15
#elif F_CPU==128000000
   #define BOARD_RCC_PLLMUL RCC_PLLMUL_16
#endif
#endif
Here the serial1 starts working properly. It compiles with 96MHz. Double checked with Whetstone.
You must restart ide and you will see in the Tools->CPU Speed(MHz) the above speed settings selections with your board.
PS: the USB may not work with some speeds settings..
PPS: my 103ZET6 board:

Code: Select all

Starting Whetstone benchmark...
Loops: 1000Iterations: 1Duration: 20366 millisec.
C Converted Double Precision Whetstones: 4.91 MIPS   <<< 72MHz

Loops: 1000Iterations: 1Duration: 15250 millisec.
C Converted Double Precision Whetstones: 6.56 MIPS   <<< 96MHz

Loops: 1000Iterations: 1Duration: 12201 millisec.
C Converted Double Precision Whetstones: 8.20 MIPS   <<< 120MHz

Loops: 1000Iterations: 1Duration: 11438 millisec.
C Converted Double Precision Whetstones: 8.74 MIPS  <<< 128MHz
Last edited by Pito on Sun Jan 08, 2017 12:50 pm, edited 4 times in total.

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

Re: Lib for ILI9486 - 3.5 inch 480x320 touch TFT for RPi

Postby stevestrong » Sun Jan 08, 2017 12:27 pm

Thanks Pito, I managed to change the SPI clock to 24MHz (see my post here for how to).

And the display works fine at 24MHz !

And USB is working, too. CPU runs with 48MHz, but is as fast as with 72Mhz because I set FLASH wait state down to 1.

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

Re: Lib for ILI9486 - 3.5 inch 480x320 touch TFT for RPi

Postby Pito » Sun Jan 08, 2017 12:34 pm

Great Steve, you doublechecked my guide too :) :)
I run my 103ZET6 at 128Mhz :)
In past I ran F100 (DiscoveryVL) at 56MHz with 0ws. Standard is 24MHz.. Some benchmarks did show 56 is faster than the F103 at 72.

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

Re: Lib for ILI9486 - 3.5 inch 480x320 touch TFT for RPi

Postby stevestrong » Sun Jan 08, 2017 1:05 pm

Here the benchmark with SPI = 24MHz, CPU at 48MHz, flash wait states = 0 (!!) ;) ,
with DMA:

Code: Select all

Benchmark                Time (microseconds)
Screen fill              497067
Text                     66080
Lines                    563363
Horiz/Vert Lines         58813
Rectangles (outline)     41143
Rectangles (filled)      502296
Circles (filled)         332981
Circles (outline)        441015
Triangles (outline)      129064
Triangles (filled)       490033
Rounded rects (outline)  154242
Rounded rects (filled)   1415779

and without DMA:

Code: Select all

Benchmark                Time (microseconds)
Screen fill              513134
Text                     46200
Lines                    479177
Horiz/Vert Lines         43779
Rectangles (outline)     25931
Rectangles (filled)      1252740
Circles (filled)         291770
Circles (outline)        389888
Triangles (outline)      96710
Triangles (filled)       467875
Rounded rects (outline)  125560
Rounded rects (filled)   1396953
Last edited by stevestrong on Sun Jan 08, 2017 2:15 pm, edited 3 times in total.

User avatar
Squonk42
Posts: 40
Joined: Thu Dec 29, 2016 9:25 am
Location: Bordeaux, France

Re: Lib for ILI9486 - 3.5 inch 480x320 touch TFT for RPi

Postby Squonk42 » Sun Jan 08, 2017 1:59 pm

stevestrong wrote:Here the benchmark with SPI = 24kHz, CPU at 48MHz, flash wait states = 0 (!!) ;)

Isn't it 24 MHz instead of 24 kHz?

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

Re: Lib for ILI9486 - 3.5 inch 480x320 touch TFT for RPi

Postby stevestrong » Sun Jan 08, 2017 2:05 pm

But of course, thank you, I have corrected.


Return to “Libraries & Hardware”

Who is online

Users browsing this forum: No registered users and 2 guests