Skip to main content
Associate II
July 22, 2024
Solved

using LCD-TFT controller without HAL

  • July 22, 2024
  • 3 replies
  • 4312 views

Hello, i am trying to configure the on-board TFT-LCD on STM32F429-Disc0 board and i want to do it without using HAL drivers, every tutorial on youtube or other platforms i see, are using CubeMX or HAL or both. I understand we need SPI5 to configure the ILI9341 peripheral (unlike the STM32F7 where only LTDC config is required), i feel there are less resources to - 
1) understand the data sheet of the LCD peripheral, its way complicated for a beginner  
2) understand the LTDC registers in the reference manual, and what default values should be put into them
3) creating functions to write something on the LCD screen, to draw and more, very complex and no one has explained them properly on youtube. 

I know there is a CubeMX example available which shows stm logo on screen but it also uses HAL and is complicated to understand a proper code structure and the flow of the code and what to do and when. 

Any suggestions/guidance?

Best answer by Andrew Neil

@sk12 wrote:

 understand the data sheet of the LCD peripheral, its way complicated for a beginner  


you can't have it both ways!

The whole point of a HAL is to save you having to delve deeply into the arcane inner workings of the hardware details - especially complicated ones like LCD controllers.

If you don't want to use the HAL, then you must be prepared to put in the time & effort to understand the hardware details.

 


@sk12 wrote:

in real-life industries, they refrain from using HAL because of memory constraints and cost issues


That's not (necessarily) true. Many will use the HAL to save the effort (ie, cost) of reinventing this wheel.

3 replies

AScha.3
Super User
July 22, 2024

Hi,

>i want to do it without using HAL drivers,

Why ? Want more difficult challenge ?

 

1. Use Cube+HAL to get it working .

2. IF working, as you want, then replace the  HAL_SPI_Transmit(&ILI9341_SPI_PORT...) with whatever you can do better or faster .

 

 understand the data sheet of the LCD

Right, you have to read and understand.

>creating functions to write something on the LCD screen

If want to see, how its done (by others ), look on git :

https://github.com/search?q=ili9341%20stm32&type=repositories

Look, how they do - or copy a lib, that seems fine for you, and try to adapt/ get it running.

 

Then it might look like my ILI9341 TFT + F303 here:

AScha3_0-1721628713315.png

:)

"If you feel a post has answered your question, please click ""Accept as Solution""."
sk12Author
Associate II
July 22, 2024

Hi, thanks for responding,
Till now i have done all the peripherals ADC,UART,SPI, DMA etc without any drivers on ARM-keil only.

>i want to do it without using HAL drivers,

Why ? Want more difficult challenge ?

where i am learning ATM, they dont use any HAL or any other drivers at all, they have built their own bare-metal library and keep using the functions, but i want to learn it from scratch and in-depth.
As you know in real-life industries, they refrain from using HAL because of memory constraints and cost issues so its better not to learn the controller using HAL is what i feel. 

AScha.3
Super User
July 22, 2024

Ok, so try and learn, how to do it bare-metal . :)

maybe look here, to see, how its done:

https://github.com/***ci/stm-ILI9341-spi

 

"If you feel a post has answered your question, please click ""Accept as Solution""."
Andrew Neil
Andrew NeilBest answer
Super User
July 22, 2024

@sk12 wrote:

 understand the data sheet of the LCD peripheral, its way complicated for a beginner  


you can't have it both ways!

The whole point of a HAL is to save you having to delve deeply into the arcane inner workings of the hardware details - especially complicated ones like LCD controllers.

If you don't want to use the HAL, then you must be prepared to put in the time & effort to understand the hardware details.

 


@sk12 wrote:

in real-life industries, they refrain from using HAL because of memory constraints and cost issues


That's not (necessarily) true. Many will use the HAL to save the effort (ie, cost) of reinventing this wheel.

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
sk12Author
Associate II
July 22, 2024

Hello, thanks for replying.

Where i am training ATM, they build embedded solutions for medical industry, so, the senior devs here told me not to use HAL to learn the controller as they feel a beginner needs to "delve deeply" as you said. they also said that HAL uses up a lot of memory which is another reason why they dont use it. i already have worked on assembly a bit in college(8085,8051) and theoretically for pic16f. so features the controller offers isnt entirely new for me and i did have an advantage here. once i learn the basics i feel i can then use HAL and all other libraries which would make the work easier, i dont really know how it works in other industries. but yes i have been putting efforts and time to understand the internal working of the discovery board. the point i am trying to make is there is very few info available on the forums as well as youtube etc. on the "bare-metal" way i guess everyone uses CubeMX and HAL..
if you know how development happens in any industry please, i'm all ears. 
Thanks 

Tesla DeLorean
Guru
July 22, 2024

So "delve deeply" and don't expect everyone to explain the details in a form suitable for someone who knows nothing. You don't learn to swim in the middle of the ocean.

Medical and Aerospace tend not to use external libraries as there's no way to be sure what's in there or how robust it is, and how well it is maintained. They build from the bottom up with code they own and can validate, as they can't offload the liability of it being wrong by pointing at someone else.

The Reference Manuals have historically been the source of authoritative detail. Yes, you'll need a foundation of knowledge. How would you get that? Perhaps by reading books on the topics. There's plenty of material out there, just don't expect others to read it to you, or present it in video form.

Coding for 8-bit micro's was out-dated 30 years ago, sort of things kids did in secondary school 40+ years ago without YouTube/internet to explain everything.

Pivoting into 16 and 32-bit MCU shouldn't be that hard, the ARM MCU are very orthogonal in their design.

Unwind the HAL/SPL implementations, counterpoint those with the internal details expressed in the reference manual. Focus on the area's that are important to you first. It's easier to understand and unpick something that is working than to figure out why something with thousands of critical moving parts isn't working properly.

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
Andrew Neil
Super User
July 22, 2024

The ILI9341 is a well-known and widely used chip; you should be able to find plenty of examples, etc - even for your PIC16F

It's not an ST Product, so this really isn't the place to get support on it!

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.