/var/www/restricted/ssh/stm32/www/stm32circle/ STM CircleOS forum / Bug in CircleOS - set LCD backlight

Username:     
Password:     
             

Forum

# 1   2011-05-04 13:54:19 Bug in CircleOS - set LCD backlight

forrest79
New member
Registered: 2011-04-07
Posts: 3

Bug in CircleOS - set LCD backlight

In my school project I wanted to implement a power saving feature, power off the LCD display. I found a function LCD_SetBackLightOff (). After loading the program into the module Primer2 did not power LCD off. Finally, I came up with colleagues on how to get this feature work. Recorded CircleOS applications can be run with two possibilities. Either open the menu and selecting the application, or just click the first icon in the toolbar on the main screen CircleOS. If you run the program via the icon in the toolbar, everything works as it should. However, if you run the application through the menu function LCD_SetBackLightOff () does nothing.
My school instructor figured out that if the application runs through the menu, set the pin PB8, which controls the backlight misinterpreted as input and hence it is not possible to control the backlight. If you manually in debug mode set it as output pin, it works in spite of running applications through a menu CircleOS.

Offline

 

# 2   2011-05-09 10:19:14 Bug in CircleOS - set LCD backlight

yrt
Administrator
From: Grenoble-France
Registered: 2008-06-11
Posts: 520
Website

Re: Bug in CircleOS - set LCD backlight

Thanks for the report.
Which platform do you use ? (Primer1, Primer2, EvoPrimer...)

Offline

 

# 3   2011-05-09 10:25:07 Bug in CircleOS - set LCD backlight

forrest79
New member
Registered: 2011-04-07
Posts: 3

Re: Bug in CircleOS - set LCD backlight

I'm using Primer2.

Offline

 

# 4   2011-05-09 13:00:13 Bug in CircleOS - set LCD backlight

yrt
Administrator
From: Grenoble-France
Registered: 2008-06-11
Posts: 520
Website

Re: Bug in CircleOS - set LCD backlight

Your diagnostic was correct : the menu handler calls the UTIL_GetPrimerType function, which puts the BL command in input mode, for platform detection, and do not reconfigure it.

Hereafter is the correction, in the util_spe.c file :

Code:

u16 UTIL_GetPrimerType( void )
{
    u16 type = 2;

    /* GPIO Configuration: backlight control in input */
    GPIO_InitTypeDef GPIO_InitStructure;
    RCC_APB2PeriphClockCmd( RCC_APB2Periph_GPIOB, ENABLE );
    GPIO_InitStructure.GPIO_Pin   = GPIO_Pin_8;
    GPIO_InitStructure.GPIO_Mode  = GPIO_Mode_IN_FLOATING;
    GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
    GPIO_Init( GPIOB, &GPIO_InitStructure );

    // Check if pull-up (Primer2), or pull_down LED0 (Primer 1)
    if ( GPIO_ReadInputDataBit( GPIOB, GPIO_Pin_8 ) == 1 )
        {
        type = 2;
        /* GPIO reconfiguration : BL TIM in Output */
        GPIO_InitStructure.GPIO_Mode  = GPIO_Mode_AF_PP;
        GPIO_Init( GPIOB, &GPIO_InitStructure );
        }
    else
        {
        type = 1;
        /* GPIO reconfiguration : LED0 in Output */
        GPIO_InitStructure.GPIO_Mode  = GPIO_Mode_Out_PP;
        GPIO_Init( GPIOB, &GPIO_InitStructure );
        }  
    
    return type;

}

Thanks again.

Offline

 

# 5   2011-05-12 11:01:27 Bug in CircleOS - set LCD backlight

forrest79
New member
Registered: 2011-04-07
Posts: 3

Re: Bug in CircleOS - set LCD backlight

Thans very much, this works.

Offline

 

Board footer