Page 1 of 1

Windows IOT and Display Backlight Brightness

Posted: Fri Jun 24, 2016 5:21 am
by bluecat
I am looking for a possibility to set the backlight-brightness (0-100%) of the original raspberry-display V1.1 under Windows 10 IOT.

Setting the backlight under raspbian works, so the Hardware seems to be ready for it.

I use Visual Studio 15 - C# for developement.

I couldn't find anything on this Topic on the web and now I am looking for the commands.

Please help

Re: Windows IOT and Display Backlight Brightness

Posted: Mon Jul 11, 2016 6:52 pm
by Monigass
I found you can modify the backlight with the I2C registers :

{DISPLAY_ADDR, BACKLIGHT_REG_ADDR, BRIGHTNESS}

DISPLAY_ADDR = 0x45;
BACKLIGHT_REG_ADDR = 0x86;
BRIGHTNESS = (0 - 255)

using the pins from de display board, but sometimes the touch stops working :( working

Re: Windows IOT and Display Backlight Brightness

Posted: Tue Oct 18, 2016 8:03 pm
by dan.inden
I can confirm that this works:

string i2cDeviceSelector = I2cDevice.GetDeviceSelector();
IReadOnlyList<DeviceInformation> devices = await DeviceInformation.FindAllAsync(i2cDeviceSelector);

var settings = new I2cConnectionSettings(0x45);

var screen = await I2cDevice.FromIdAsync(devices[0].Id, settings);

byte[] writeBuff = new byte[] { 0x86, 0x80 };
screen.Write(writeBuff);

Re: Windows IOT and Display Backlight Brightness

Posted: Wed Nov 23, 2016 7:09 pm
by mibue
dan.inden wrote:I can confirm that this works:

string i2cDeviceSelector = I2cDevice.GetDeviceSelector();
IReadOnlyList<DeviceInformation> devices = await DeviceInformation.FindAllAsync(i2cDeviceSelector);

var settings = new I2cConnectionSettings(0x45);

var screen = await I2cDevice.FromIdAsync(devices[0].Id, settings);

byte[] writeBuff = new byte[] { 0x86, 0x80 };
screen.Write(writeBuff);
Hi dan.inden

is there any Documentation to this "Feature" ? What bytes i have to write?
My Problem i want to use my pi for homeautomation and after a definied time i want to Switch the brightness to 0 or turn off the backlight. If i touch the Display i want to turn on the Backlight or Brightness to 100%.
Is there any Documented Solution or can you help me please?

Thanks by Michael

Re: Windows IOT and Display Backlight Brightness

Posted: Fri Dec 02, 2016 2:07 am
by PlayersZ28
I turn off the backlight with hardware as I couldn't find a workable s/w solution.

Re: Windows IOT and Display Backlight Brightness

Posted: Mon Dec 05, 2016 3:17 pm
by dan.inden
There is no documentation.
The code I provided changes the brightness to 0x80.
Writing 0x00 will turn the display off.

I also use this in my homeautomation solution, but it's not 100% stable and the touchscreen often doesn't respond anymore after changing brightness (mostly it starts responding again after some time).
I trigger turning on and off based on the input of a PIR sensor, and use the time of the day to determine the brightness. So I don't need the touchscreen support.
Still its not 100% stable.

Re: Windows IOT and Display Backlight Brightness

Posted: Wed Dec 14, 2016 12:50 am
by alexanderofyork
Besides that it seems every I2c answer presumes I am using the bus for only one item, I don't understand what I should be getting back from I2cDevice.GetDeviceSelector(). This is what I get...

"System.Devices.InterfaceClassGuid:=\"{A11EE3C6-8421-4202-A3E7-B91FF90188E4}\" AND System.Devices.InterfaceEnabled:=System.StructuredQueryType.Boolean#True"

Understandably when I use that string to await DeviceInformation.FindAllAsync(i2cDeviceSelector);
I "await" forever.

Re: Windows IOT and Display Backlight Brightness

Posted: Fri Dec 30, 2016 7:08 am
by wedge
dan.inden wrote:I can confirm that this works:

I've tried that code, and I get the error: "The system cannot find the file specified. Slave address was not acknowledged."

What am I missing here?

Re: Windows IOT and Display Backlight Brightness

Posted: Fri Dec 30, 2016 1:37 pm
by skipfire
I also get that the slave address was not acknowledged. I'm using a Raspberry Pi 3 with just the display ribbon connecting the display and USB power to both Pi & display. My guess is that solution requires that you connect to the SDA and clock pins as well.

I also would guess that the reason the touch screen stops responding is that you are interfering with the OS's communication by writing, but that it has a level of fault recovery and eventually resets it's I2C connection with the touchscreen.

Re: Windows IOT and Display Backlight Brightness

Posted: Fri Dec 30, 2016 4:04 pm
by wedge
Yup, I figured it out, that's the solution.
skipfire wrote: My guess is that solution requires that you connect to the SDA and clock pins as well.
I had previously assumed there was an I2C connection through the DSI port, but apparently not. At least not the same I2C port we can access through software.

Re: Windows IOT and Display Backlight Brightness

Posted: Fri Dec 30, 2016 5:25 pm
by skipfire
I believe there is one in the DSI port, it may simply be an addressing issue, or perhaps Windows IoT has it locked and is hiding it.

Re: Windows IOT and Display Backlight Brightness

Posted: Mon Jan 23, 2017 8:10 pm
by xbened02
I am using this solution and it is working great without any problem

private static I2cDevice I2CAccel;

public static void Initialize()
{
InitI2C();
}

public static async void InitI2C()
{
int i = int.Parse(value.ToString());
string i2cDeviceSelector = I2cDevice.GetDeviceSelector();
var settings = new I2cConnectionSettings(0x45);
IReadOnlyList<DeviceInformation> devices = await DeviceInformation.FindAllAsync(i2cDeviceSelector);
var screen = await I2cDevice.FromIdAsync(devices[0].Id, settings);
I2CAccel = screen;


byte[] writeBuff = new byte[] { 0x86, (byte)(55) }; //backlight address, brightness 0-255

/* Write the register settings */
try
{
I2CAccel.Write(writeBuff);
}
catch (Exception ex)
{
return;
}

}

then write function

byte[] writeBuff = new byte[] { 0x86, (byte)(80) }; //backlight address, brightness 0-255
I2CAccel.Write(writeBuff);

Re: Windows IOT and Display Backlight Brightness

Posted: Wed Jan 25, 2017 10:18 pm
by skipfire
That does not work for me. "Slave address was not acknowledged."

1) Are you on a Pi 2 or Pi 3?

2) Are you using just the ribbon to connect, or are you using the pins as well?

I'm hoping we might be able to pick out why it works for some people and not others. I am on a Pi 3 using just the ribbon cable. I have tried this on a couple of Pi's so it is not a problem with just one Pi.

Re: Windows IOT and Display Backlight Brightness

Posted: Thu Mar 16, 2017 8:40 pm
by cyberh0me
All display rendering is done by VC4 firmware (GPU microcode managed by Pi Foundation).
The I2c channel between LCD panel and VC4 is not exposed to Windows, because VC4 takes full ownership of that I2c channel. The I2c pins are internally connected to VC4 and touch controller - that’s how touch controller works and it uses those heavily. So you could be introducing issues with touch!

Re: Windows IOT and Display Backlight Brightness

Posted: Fri Apr 14, 2017 8:23 am
by brianbaero
The code posted worked for me. Using Pi 3 B v1.2, Win10 IoT build 15063. Connected I2C pins from the display board to the Pi.

Re: Windows IOT and Display Backlight Brightness

Posted: Sat Jan 06, 2018 7:57 pm
by Aberlon
xbened02 wrote: I am using this solution and it is working great without any problem

private static I2cDevice I2CAccel;

public static void Initialize()
{
InitI2C();
}

public static async void InitI2C()
{
int i = int.Parse(value.ToString());
string i2cDeviceSelector = I2cDevice.GetDeviceSelector();
var settings = new I2cConnectionSettings(0x45);
IReadOnlyList<DeviceInformation> devices = await DeviceInformation.FindAllAsync(i2cDeviceSelector);
var screen = await I2cDevice.FromIdAsync(devices[0].Id, settings);
I2CAccel = screen;


byte[] writeBuff = new byte[] { 0x86, (byte)(55) }; //backlight address, brightness 0-255

/* Write the register settings */
try
{
I2CAccel.Write(writeBuff);
}
catch (Exception ex)
{
return;
}

}

then write function

byte[] writeBuff = new byte[] { 0x86, (byte)(80) }; //backlight address, brightness 0-255
I2CAccel.Write(writeBuff);
Sadly I think this solution will only work if you use the I2C only for adjusting the brightness. As i'm using the i2c for some sensors an amplifier and a TEA5767 it generates a lot of exeptions and ends up with a non working touch.

I also failed to find a solution with using the BrightnessOverride Class... (It's not supported).
So i think cyberh0me is right and there is no (good) way to adjust the brightness with the IoT Core and UWP Apps.

Re: Windows IOT and Display Backlight Brightness

Posted: Mon Feb 19, 2018 3:52 pm
by ianst
Any update?
This one is critical for my project, but using i2c is too unstable. Trying to fade in/out and there tons of artifacts appears. :cry:

Re: Windows IOT and Display Backlight Brightness

Posted: Sat Feb 24, 2018 6:07 am
by mrsteveman1
ianst wrote:
Mon Feb 19, 2018 3:52 pm
Any update?
This one is critical for my project, but using i2c is too unstable. Trying to fade in/out and there tons of artifacts appears. :cry:
I've been working on this a bit tonight, the real solution is to do what the Linux kernel does: ask the GPU (AKA the "real" CPU :lol:) to adjust the brightness, rather than trying to do it directly as that is always going to cause problems.

As I recall, the GPU has a "mailbox" interface for this that shouldn't be too complicated to use, and it looks like Microsoft has already added support for the VC4 mailbox to the BSP, however they haven't added the back light related properties yet.

Doesn't look too complicated, so if nobody else has done it already and stuffed the changes in a branch or PR somewhere on Github, I'll take a look soon.

Re: Windows IOT and Display Backlight Brightness

Posted: Tue Mar 27, 2018 6:34 am
by ianst
mrsteveman1 wrote:
Sat Feb 24, 2018 6:07 am
Doesn't look too complicated, so if nobody else has done it already and stuffed the changes in a branch or PR somewhere on Github, I'll take a look soon.
Oh please make it))
The only reason am making project on linux is screen brightness, but i hate linux :)

Re: Windows IOT and Display Backlight Brightness

Posted: Tue Jul 17, 2018 11:08 pm
by Aberlon
mrsteveman1 wrote: As I recall, the GPU has a "mailbox" interface for this that shouldn't be too complicated to use, and it looks like Microsoft has already added support for the VC4 mailbox to the BSP, however they haven't added the back light related properties yet.

Sadly we can`t access a driver from a UWP app so using the rpiq mailbox driver doesn`t work.

With my little hobbyists knowledge i tried to write my own mailbox interface and failed again. ;)

<sarcasm>
It seems that we can`t allocate contiguous memory for the message structure and write it's pointer to a protected memory address :)
</sarcasm>

well i give up now with controlling the display backlight and get me some glass of b**r - cheers :)

Re: Windows IOT and Display Backlight Brightness

Posted: Fri Dec 07, 2018 11:09 am
by ababuy
Hello all,

Any news regarding this feature?

I have tried the I2C write method and even though it works for a while, I am getting two errors form time to time:
Error 1: The request could not be performed because of an I/O device error. Unexpected number of bytes was transferred. Expected: '. Actual: '.
and after a while,
Error 2: The system cannot find the file specified. Slave address was not acknowledged.

Does anyone knows what these means?