cancel
Showing results for 
Search instead for 
Did you mean: 

STM32 USART IAP

colmolungma
Associate II
Posted on April 19, 2015 at 06:59

Hi,

I'm trying AN2557 FW3.30 from ST's website. i run it and I fill it succesfully when download first application at 0x8003000-0x8004209. but for second time, the downloading is failed.

then i go to check flash contain, and i saw

the address 0x8003000-0x80037FF = still fill with data (i'm not sure is this from last application or new)

0x8003800-0x8003BFF = Blank (0xFF)

0x8003C00-0x8003FFF = Data Contained

0x804000 - .... = Blank (0xFF)

what is the mistake?

Thanks in advance.

8 REPLIES 8
colmolungma
Associate II
Posted on April 19, 2015 at 09:41

I've re-tested and found, i checked and found,

0x8003000-0x80033FF = is filled successfully with new applicattion code

0x8003400-0x80037FF = still contain old application code.

0x8003800-0x8003BFF = blank

0x8003C00-0x800420B = still contain old application code

I think erasing process is success at first and third 1KB of application

but failed at second and fourth.
Posted on April 19, 2015 at 16:47

Who knows what part, specifically, you're using?

If I had to guess I'd say you have the erase block (sector) size wrong for the part you're using, say 0x400 vs 0x800

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
colmolungma
Associate II
Posted on April 20, 2015 at 14:51

sorry, i forgot to explain. i'm using STM32F100C8 and KEIL. at the app note, i read, we should uncomment corresponding line in stm32_eval.h. then i do uncomment #define USE_STM32100B_EVAL but it doesn't work. and although i have tried recomment and uncomment another possible line.

Posted on April 20, 2015 at 18:25

Sorry, limited internet access here.

You need to focus on the chip the toolset is configured to use, and which it's passing in via any defines. This sounds very much like the code thinks the flash block size is bigger than it is, and isn't erasing with a tight enough step.

Review the code with that mindset.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
colmolungma
Associate II
Posted on April 21, 2015 at 09:51

yes, after i try add more delay at erasing timeout but still doesn't work, i think the board has not been configured correctly since people do it successfully with this code. as your suggestion, i think there are still wrong page size or i do wrong with my compiler. i will check and trace deeper especially at line of page size calculation.

thank you, clive1.
Posted on April 21, 2015 at 15:09

But it's not about timing, it's about physical size, and a coherency between what the hardware actually is, and what the software thinks it is.

STM32F10x_AN2557_FW_V3.3.0\Project\IAP\inc\common.h

#if defined (STM32F10X_MD) || defined (STM32F10X_MD_VL)
#define PAGE_SIZE (0x400) /* 1 Kbyte */
#define FLASH_SIZE (0x20000) /* 128 KBytes */
#elif defined STM32F10X_CL
#define PAGE_SIZE (0x800) /* 2 Kbytes */
#define FLASH_SIZE (0x40000) /* 256 KBytes */
#elif defined STM32F10X_HD || defined (STM32F10X_HD_VL)
#define PAGE_SIZE (0x800) /* 2 Kbytes */
#define FLASH_SIZE (0x80000) /* 512 KBytes */
#elif defined STM32F10X_XL
#define PAGE_SIZE (0x800) /* 2 Kbytes */
#define FLASH_SIZE (0x100000) /* 1 MByte */
#else
#error ''Please select first the STM32 device to be used (in stm32f10x.h)''
#endif

Select the correct target, and insure the defines passed to the compiler are USE_STM32100B_EVAL, STM32F10X_MD_VL, USE_STDPERIPH_DRIVER
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on April 21, 2015 at 15:13

There should be a Keil Project with a ''STM32100B-EVAL'' specifically called out as a Target. Make sure to select that build selection, and you won't have to edit any files.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
colmolungma
Associate II
Posted on April 26, 2015 at 08:31

Sorry, late reply. just have to finish another project.

yes clive1, after i change the option for target, also at C/C++ tab wtih USE_STM32100B_EVAL, STM32F10X_MD_VL, USE_STDPERIPH_DRIVER it works perfectly. working with almost 100% makes me forget to configure keil itself.

thank you very much, clive1.