Author Topic: Interfacing the STM32f4 with the HX8352a  (Read 11052 times)

Kyle D. Williams

  • Jr. Member
  • **
  • Posts: 8
    • View Profile
Interfacing the STM32f4 with the HX8352a
« on: April 15, 2015, 07:36:23 pm »
I have started a hardware project in which I am attempting to connect an LCD to the STM32F407 board. The display controller is an HX8352a.I've been having difficulty producing anything worthwhile on the screen however. I've tried converting a handful of arduino code to the board but it seems the lcd screen responds to nothing besides switching the backlight on or off, does anyone have any suggestions on anything i can do to get some event from the screen?
« Last Edit: April 19, 2015, 04:25:23 pm by Kyle D. Williams »

Andy Brown

  • Administrator
  • Hero Member
  • *****
  • Posts: 283
    • View Profile
    • Andy's Workshop
Re: Interfacing the STM32f4 with the HX8352a
« Reply #1 on: April 16, 2015, 01:25:28 pm »
I've started a hardware project in which I'm attempting to connect an LCD to the STM32F407 board. The display controller is an HX8352a.I've had been having difficulty producing anything worthwhile on the screen however. I have also seen on a lot of sites that the ports being used on the discovery board seem to vary. Can I ask if their is any reasoning to not simply have all of the data pins on the same port? Also I've tried converting a handful of arduino code to the board but it seems the lcd screen responds to nothing besides switching the backlight on or off, does anyone have any suggestions on anything i can do to get some event from the screen?

Hi Kyle, The HX8352A is a controller that I have used in the past and I know that it can be driven by the F4 Discovery board. If you've read my article on the LG KF700 then you will have seen the video of it running on the F4 Discovery.

Are you using my stm32plus driver (see example)? If so then what are you seeing? How are you powering the board? The discovery has a maximum current limit of 100mA (see section 4.3 of UM1472). If your particular board is powering the backlight as well as the logic then you may be close to that limit.
It's worse than that, it's physics Jim!

Kyle D. Williams

  • Jr. Member
  • **
  • Posts: 8
    • View Profile
Re: Interfacing the STM32f4 with the HX8352a
« Reply #2 on: April 19, 2015, 04:32:30 pm »
Thank you Andy for the direction, I was originally attempting to use GPIO; however after finding your examples I have found FSMC to work well with my project. I've been able to get up and running using your well documented code. Everything seems to work okay; however, it seems when I run the original test code it halts somewhere inside of the textTest code. Also the screen's quality seems to be of poor quality compared to the ones in the example; I originally thought it to be an issue of the screen; however, on the arduino the screen looks a lot better. Are their any possible suggestions regarding quality?

Andy Brown

  • Administrator
  • Hero Member
  • *****
  • Posts: 283
    • View Profile
    • Andy's Workshop
Re: Interfacing the STM32f4 with the HX8352a
« Reply #3 on: April 20, 2015, 02:03:52 pm »
Are their any possible suggestions regarding quality?

This could be the gamma or it could be one of the register settings that control the panel power and driving levels. It's easiest to try the gamma first. If your ST code has these two lines then simply delete them. Gamma settings are unique to the panel and it may be that yours has perfectly good default settings.

If that doesn't work we need to look at the driving settings. The settings I used were designed to be correct for the LG-KF700 phone and are in the initialise() method starting here. If you review the register values being set and compare them to those set by the Arduino initialiser then you should be able to spot where your panel is different.

As you can see from the interface definitions it is easy to create your own panel traits class with an initialise() method and declare a type to use it.
It's worse than that, it's physics Jim!

Kyle D. Williams

  • Jr. Member
  • **
  • Posts: 8
    • View Profile
Re: Interfacing the STM32f4 with the HX8352a
« Reply #4 on: April 22, 2015, 03:47:12 pm »
Thank you for creating such a detailed explanation of the problem and a great library. After going through the startup code that I had working on the arduino and testing it with the code for the LG_KF700 i have come to find that it is completely different.  I made a few changes and it worked immediately, including all of the tests (except for sleep which for some reason seems to permanently vertically flip the lzg tests and breaks the other ones, but not really an issue). Thank you for the help 

I have realised their was very little on the
tm032ldh05 using the HX8352 in either of the manuals about these values and even less about the steps required. Can I ask where does one normally find such information?

« Last Edit: April 22, 2015, 04:05:18 pm by Devon Guyden »

Andy Brown

  • Administrator
  • Hero Member
  • *****
  • Posts: 283
    • View Profile
    • Andy's Workshop
Re: Interfacing the STM32f4 with the HX8352a
« Reply #5 on: April 25, 2015, 03:16:01 am »
Thank you for creating such a detailed explanation of the problem and a great library. After going through the startup code that I had working on the arduino and testing it with the code for the LG_KF700 i have come to find that it is completely different.  I made a few changes and it worked immediately, including all of the tests (except for sleep which for some reason seems to permanently vertically flip the lzg tests and breaks the other ones, but not really an issue). Thank you for the help 

The sleep/wake issue is likely to be because some of the register contents are lost during the low power mode. It should be a simple enough job to reset them to their correct settings.

If you have a working initialise() method for your panel then I'd be happy to integrate into the library - feel free to post the modified code here and I'll work on the integration steps.

Quote
I have realised their was very little on the
tm032ldh05 using the HX8352 in either of the manuals about these values and even less about the steps required. Can I ask where does one normally find such information?

Finding complete panel information is much harder than finding the controller datasheet, as you've discovered. And often when you do find something it will be a badly photocopied paper sheet only partially translated from Chinese to English. I normally look for working sample code that shows the reset-initialise sequence. If you've got that then the rest usually falls into place.
It's worse than that, it's physics Jim!

Kyle D. Williams

  • Jr. Member
  • **
  • Posts: 8
    • View Profile
Re: Interfacing the STM32f4 with the HX8352a
« Reply #6 on: May 02, 2015, 05:39:35 pm »
Attached is the working initialise() method for the tm032ldh05 panel. I hope it's useful and I set it up in a way that should be easy to integrate into the stm32plus feel free to use it however you see fit. One note is that i included the gamma code into the initialise method, I did this only because the initial issue I had was with gamma. 

Andy Brown

  • Administrator
  • Hero Member
  • *****
  • Posts: 283
    • View Profile
    • Andy's Workshop
Re: Interfacing the STM32f4 with the HX8352a
« Reply #7 on: May 03, 2015, 09:45:33 am »
Thanks very much Kyle, I appreciate that. It's now been integrated into the library and released in version 4.0.2.
It's worse than that, it's physics Jim!

Kyle D. Williams

  • Jr. Member
  • **
  • Posts: 8
    • View Profile
Re: Interfacing the STM32f4 with the HX8352a
« Reply #8 on: May 03, 2015, 12:25:37 pm »
It works great, I may have more to contribute, if acceptable, but at a later time.