Cannot change value of LCD_CR register

91 views Asked by At

I am currently playing with L152C Discovery board and trying to make simple clock that would use the RTC build into the STM32 and onboard Glass LCD with LCD HAL library configured via CubeMX. But I am currently facing a problem I can't get my head around: CubeMX does not have an option to enable segment mux in the LCD_CR register. I would like to enable it, because it would make the segment mapping easier.

So I thought, fine, I will make an direct register manipulation, enabling the mux (bit 7 in the LCD_CR). I used the command LCD->CR |= LCD_CR_MUX_SEG; But even after executing the command, the MUX_SEG bit is still zero. (I checked in the debug session with command stepping and SFRs memory map) Is there something that I am doing wrong? Or is there another way to change init parameters that CubeMX configured but does not have graphical implementation of this settings option?

The application is using FreeRTOS and I executed LCD->CR |= LCD_CR_MUX_SEG; after HAL_LCD_Init(&hlcd); so I sappose that the LCD peripheral clock is running (and segments are updating).

I recorded a short video showing this problem: https://youtu.be/0X6Zu5EPudU To be honest, I am not skilled at direct register manipulation, so I am probably doing something wrong.

Any help would be appreciated!

1

There are 1 answers

0
Marek Coufal On BEST ANSWER

As @KIIV said:

RM0038 Liquid crystal display controller (LCD) Note: The VSEL, MUX_SEG, BIAS and DUTY bits are write protected when the LCD is enabled (ENS bit in LCD_SR to 1).

The LCD must be disabled when making changes to the above registers.