cancel
Showing results for 
Search instead for 
Did you mean: 

How can I distinguish between STM32F1x medium density devices?

NCTUser
Associate III

We replaced in our product the STM32F102 MCU with STM32F103 without PCB modification. The 103 contains more RAM and can run at higher frequency and we would like to use the extra resources but there is a criteria. We should use one piece of software for both MCU. If the software can detect the MCU type, based on this information for example can set up higher CPU frequency, use extra timer etc.

According to the documentation the DBGMCU_IDCODE and DBGMCU_CR registers are not accessable (only in debug mode) for the user software. Is there a safe way for the software to detect which is the MCU where the software runs?

1 ACCEPTED SOLUTION

Accepted Solutions
Peter BENSCH
ST Employee

The Device Electronic Signature unfortunately only contains the flash size and the U_ID, there is no ID value for the RAM.

But you could check for non-existing peripherals, e.g. TIM1/TIM8 or CAN, all of which are only present in F103 and not in F102.

Regards

/Peter

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

View solution in original post

4 REPLIES 4

Should be a word in the system memory describing FLASH size, and probably another for RAM.

Check RM0008

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Peter BENSCH
ST Employee

The Device Electronic Signature unfortunately only contains the flash size and the U_ID, there is no ID value for the RAM.

But you could check for non-existing peripherals, e.g. TIM1/TIM8 or CAN, all of which are only present in F103 and not in F102.

Regards

/Peter

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
NCTUser
Associate III

I did not mention that the flash size is same on both devices (STM32F102C8T6 and STM32F103C8T6), my mistake, but anyway Tesla's suggestion about the flash size register seems a viable solution if the flash size of the MCUs would be different.

I will follow Peter's suggestion about check for non-existing peripherals.

Thanks to both of you.

NCTUser
Associate III

Hello,

I tried the proposed method but it did not work well. In spite of F102 does not contain CAN peripheral I can read the CAN registers (e.g. CAN_MCR 0x40006400 is read as 0x10002 on F102 which is the reset value of the register). Same result with TMR1 which exists in F103 and does not in F102, however I did not enable the clock of TMR1 on F102 because I did know what will happen.

Is any suggetsion?