Skip to main content
KDwor.17
Visitor II
November 23, 2018
Question

Possible error in LCD configuration (wrong segment numbers)

Hello

In glass LCD display configuration (for STM32L152RB in my case), for static display, in Cube we can see segment numbers SEG[0-31]. Meanwhile, SEG[31:28] are double numbered, also to SEG[43:40]. To use [31:28] designators there must be MUX_SEG bit in LCD_CR set.

After code generation MUX_SEG is still disabled (0). I found the line in MX_LCD_Init function:

hlcd.Init.MuxSegment = LCD_MUXSEGMENT_DISABLE;

And i can't find proper setting in Cube to enable this MUX, i has to do it manually after code generation.

This problem is misleading, because segments 31-28 are located in ROM[0] register, 43-40 in ROM[1] register. Cube shows numbers 31-28, we try to write ROM[0] register, what is not working, because this segments has numbers 43-30 and we should write other register (ROM[1]). And this is because of wrong MUX_SEG bit settings.

Could you check this somehow?

This topic has been closed for replies.

2 replies

Khouloud ZEMMELI
ST Employee
November 26, 2020

Hello @KDwor.17​ 

You need to check the check-box "multiplex mode" to obtain : hlcd.Init.MuxSegment = LCD_MUXSEGMENT_ENABLE .

Please use the latest CubeMX version.

Thanks

Khouloud

Visitor II
September 24, 2023

Thx a lot, this saved me a lot of time! I'm using a 1/4 duty cycle glass with 32 segments and used this as workaround:

 
 for (int i = 0; i < 4; i++) {
 HAL_LCD_Write(&hlcd, i * 2, 0, lcdram[i]);
 HAL_LCD_Write(&hlcd, i * 2 + 1, 0, (lcdram[i] & 0xf0000000) >> 20);
 }
 HAL_LCD_UpdateDisplayRequest(&hlcd);

 I'm writing from my own shadow-registers the upper most 4 bits on the next register shifted by 20 bits, then it works with LCD_MUXSEGMENT_DISABLE.

But you are right, this is very confusing done.