/var/www/restricted/ssh/stm32/www/stm32circle/ STM CircleOS forum / 'error' with OS in menu SD card-PC

Username:     
Password:     
             

Forum

# 1   2010-12-29 13:22:08 'error' with OS in menu SD card-PC

xuwa0800
Member
From: Sweden
Registered: 2010-05-20
Posts: 27

'error' with OS in menu SD card-PC

when we connect SD card to PC, the PLLCLK will be set to 72MHZ

Code:

UTIL_SetPll(SPEED_VERY_HIGH);

but when we quit this, OS has not change clock to the default value


so, the PCLK1 will be 36MHZ, reaching the maximum. peripherals that use PCLK1 as clock input should work, but maybe because of the crystal is not so accurate, or some other reasons, exceed the max clock range, peripherals fail.

well, maybe it is not a error, but anyway, it would be nice when you quit apps, all the sources go back to the default settings, so i suggest add the following code to the function

enum MENU_code Fct_Download_Handler( void )

Code:

UTIL_SetPll(SPEED_MEDIUM );

Last edited by xuwa0800 (2010-12-29 13:25:18)


/Wang

Offline

 

# 2   2010-12-29 14:37:35 'error' with OS in menu SD card-PC

mikepo
Member
From: USA
Registered: 2010-12-03
Posts: 36

Re: 'error' with OS in menu SD card-PC

You are right, each app managed by CircleOS should properly "clean up" after itself, which means setting back the CPU clock to the value it was before.
I usually put this in the "Application_Ini"

Code:

   // get the current CPU speed
    OldPLLFrequency = UTIL_GetPll();

and then when the app exits, set it back (I usually make an "AppCleanup" routine that does all the cleanup):

Code:

    // set the old PLL frequency back
    UTIL_SetPll(OldPLLFrequency);

the variable is declared at the top as follows:

Code:

uint8_t OldPLLFrequency;

Offline

 

# 3   2010-12-29 15:12:47 'error' with OS in menu SD card-PC

xuwa0800
Member
From: Sweden
Registered: 2010-05-20
Posts: 27

Re: 'error' with OS in menu SD card-PC

very nice!


/Wang

Offline

 

# 4   2011-01-03 10:07:58 'error' with OS in menu SD card-PC

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

Re: 'error' with OS in menu SD card-PC

I agree with mikepo : it is the responsability to applications to "clean up" after itself, in order to setting back all modified parameters (CPU clock, screen parameters, IT...).

Offline

 

Board footer