RudolphRiedel / FT800-FT813

Multi-Platform C code Library for EVE graphics controllers from FTDI / Bridgetek (FT810, FT811, FT812, FT813, BT815, BT816, BT817, BT818)
MIT License
128 stars 57 forks source link

Set Frequency for NHD display #107

Closed hezy0426 closed 8 months ago

hezy0426 commented 8 months ago

Backlight is controlled by two registers, REG_PWM_HZ and REG_PWM_DUTY. REG_PWM_HZ is default to 250 after reset. The range is between 250 and 10kHz.(See FT81x data sheet) The required frequency for NHD 4.3 FT812 display is between 800 and 10Khz. (Please see the NHD 4.3 display data sheet from my previous PR).

RudolphRiedel commented 8 months ago

Oh, I was not aware that this does apply to other Newhaven modules as well. The whole issue is that they changed the modules, the original ones had a backlight frequency of up to 1kHz, the newer ones use 800Hz...10kHz.

But there already is a fix for this in place, check EVE_config.h / EVE_NHD_43_800480:

if !defined (EVE_BACKLIGHT_FREQ)

define EVE_BACKLIGHT_FREQ (800U) / if not overwritten in the project options, set 800Hz as a compromise /

endif

So, if you like to, please adjust your pull-request accordingly.

hezy0426 commented 8 months ago

I have adjusted the PR based on your comment and answer from NHD engineer ("All of our FT81x displays require the PWM register to be between 800Hz and 10kHz.")

RudolphRiedel commented 8 months ago

Well. thank you! :-)

dstulken commented 8 months ago

I have adjusted the PR based on your comment and answer from NHD engineer ("All of our FT81x displays require the PWM register to be between 800Hz and 10kHz.")

That statement from Newhaven is only accurate for current production, and using the upper part of that range would be out-of-spec for the countless 4.3" displays produced prior to the no-notice change-over. It's unfortunate that this far along, Newhaven still hasn't as a company caught up with their change process to get their support team onto the same page.

@RudolphRiedel, I think the code comments shouldn't recommend the 800Hz-10kHz range, as that would be misleading and perhaps incompatible with the hardware users may have in-hand. With no revision indication in the display part numbers or PCB markings, there is really no way to know, on a display-by-display basis, which one you have, without carefully examining small chip markings. And given that the change was only due to supply chain limitations, the "old" version could be re-introduced at any time.

I would instead say that the backlight frequency for these should be 800Hz singular (not a range) as the NHD-instructed compromise for the mixed pool of FAN5333BSX and SGM3766YTN5G backlight drivers used in production displays. Frequencies above or below 800Hz could be used on a special-case basis if required (why?), but the user really does have to know which unmarked version they have in-hand to make that determination before proceeding.

(@hezy0426, if it helps, this comment has the history on this issue: https://github.com/RudolphRiedel/FT800-FT813/discussions/90#discussioncomment-6201237)

RudolphRiedel commented 8 months ago

While the comment may be off a little now, at least all Newhaven modules are set to 800Hz now and this can be adjusted from the outside. Adjusting might be desireable with a new module to for example move the frequency out of the audible range.

dstulken commented 8 months ago

That makes sense. What about adding a link to this discussion in the code comment?

RudolphRiedel commented 8 months ago

Ok. done, I improved the comments for all entries and added the link.