cancel
Showing results for 
Search instead for 
Did you mean: 

Unique device ID

dschneeweis
Associate II
Posted on December 04, 2008 at 11:57

Unique device ID

6 REPLIES 6
dschneeweis
Associate II
Posted on May 17, 2011 at 12:54

Hi

I am trying to get information about the unique device ID of the STM32.

Is it possible to get the type of STM32 out of the ID? Actually I only need to know the SRAM-size while running.

Are there any other possibilities to get the SRAM-size in a running programm when the current target is unknown?

trevor1
Associate II
Posted on May 17, 2011 at 12:54

Hi,

I use this in my code:

----------

#define FLASH_SIZE_IN_K_ADDRESS 0x1FFFF7E0

#define RAM_SIZE_IN_K_ADDRESS 0x1FFFF7E2

printf( ''%uk Flash\r\n%uk RAM\r\n'', *(u16*)FLASH_SIZE_IN_K_ADDRESS, *(u16*)RAM_SIZE_IN_K_ADDRESS );

----------

ST have stated that the ram size location should not be used any more -- see this thread:

http://http://www.st.com/mcu/forums-cat-7623-23.html

Indeed some of the old development boards incorrectly report a size of 64k when they are actually 20k. Knowing the flash size is very useful for making code work on all devices e.g. allows you to know if flash pages are 1k or 2k.

Hope this helps

Trevor

[ This message was edited by: trevor on 03-12-2008 10:58 ]

dschneeweis
Associate II
Posted on May 17, 2011 at 12:54

Hi

Thanks for the answer. Meanwhile I found those registers by myself.

But the link you posted does not work. Is there an official statement that the RAM-SIZE-LOCATION should not be used?

sofiene
Associate III
Posted on May 17, 2011 at 12:54

Hi dschneeweis;

Try this link:

www.st.com/mcu/forums-cat-7623-23.html

B.R.

M3allem

dschneeweis
Associate II
Posted on May 17, 2011 at 12:54

@M3allem: Thanks for the link.

I can't understand why they removed the RAM-SIZE-Location.

How can I get the RAM-Size while running? I have to do an startup-test over the entire RAM. To keep this test compatible to all STM32 devices I n
trevor1
Associate II
Posted on May 17, 2011 at 12:54

Because you can find out the flash size you know the ram size (as long as you know whether you are on a ''performance line'' or ''access line'' device). e.g.

// performance line

int get_ram_size_in_k( int flash_size_in_k)

{

switch (flash_size_in_k)

{

case: 512:

case: 384:

return 64;

case: 256:

return 48;

case: 128:

case: 64:

return 20;

}

return -1; // error

}

[ This message was edited by: trevor on 04-12-2008 16:36 ]