2014-10-28 03:29 AM
hi. I'm Min-sung Jo.
My MCU is STM32L151RE. I used IAP example source code.Unfortunately,
it doesn't support STM32L151xE version. so I can't download program on it. first 128 byte succecful download, but anymore not work. I just modifiedFlash_If.c :
&sharpdefine
STM32L1XX_HD
->
STM32L1XX_XL
0x0802FF00
->0x0803FF00
0x08030000
->0x08040000
Flash_if.h
&sharpdefine
STM32L1XX_HD
->
STM32L1XX_XL
&sharpdefine APPLICATION_ADDRESS (uint32_t)
0x08003000
-> &sharpdefine APPLICATION_ADDRESS (uint32_t)
0x08004000
&sharpdefine USER_FLASH_LAST_PAGE_ADDRESS
0x0805FF00
-> &sharpdefine USER_FLASH_LAST_PAGE_ADDRESS
0x0807FF00
&sharpdefine USER_FLASH_END_ADDRESS
0x0805FFFF
-> &sharpdefine USER_FLASH_END_ADDRESS
0x0807FFFF
What should I do additionally ? #stm32l151xe #iap2014-10-28 06:19 AM
Probably need to fix FLASH_If_GetWriteProtectionStatus(void)
2014-10-28 06:29 PM
Thank you for reply.
I modified it..uint32_t FLASH_If_GetWriteProtectionStatus(void)
{ #ifdef STM32L1XX_MD return(FLASH_OB_GetWRP() & FLASH_PROTECTED_SECTORS); #elif defined STM32L1XX_XL uint32_t WRP_Status = 0, WRP1_Status = 0, WRP2_Status = 0,WRP3_Status = 0, sectornumber = 0;sectornumber=FLASH_SECTOR_NUMBER;
/* Test on the start address in Bank1 */ if (FLASH_START_ADDRESS <= 0x0803FF00) { /* Test on the user application to be programmed in Bank1 */ if (APPLICATION_ADDRESS <= 0x0803FF00) { WRP2_Status = FLASH_OB_GetWRP2(); WRP3_Status = FLASH_OB_GetWRP3();if(sectornumber < 32)
{ WRP_Status = FLASH_OB_GetWRP() & ((uint32_t)~((1<<sectornumber) - 1)); WRP1_Status = FLASH_OB_GetWRP1(); } else { WRP1_Status = (FLASH_OB_GetWRP1() & ((uint32_t)~((1<<(sectornumber-32)) - 1))); } } else if (APPLICATION_ADDRESS >= 0x08040000) /* Test on the user application to be programmed in Bank2 */ { sectornumber = (uint32_t)((APPLICATION_ADDRESS - 0x08040000)>>12); if (sectornumber < 32) { WRP2_Status = FLASH_OB_GetWRP2() & (uint32_t)~((1 << (sectornumber + 32) - 1)); WRP3_Status = FLASH_OB_GetWRP3(); } else { WRP3_Status = FLASH_OB_GetWRP3() & (uint32_t)~((1 << (sectornumber-32) - 1)); } } } /////////////////////////down.. never operate.. no think about... else if (FLASH_START_ADDRESS >= 0x08040000) /* Test on the start address in Bank2 */ { if (APPLICATION_ADDRESS <= 0x0803FF00) /* Test on the user application to be programmed in Bank1 */ { sectornumber = (uint32_t)(APPLICATION_ADDRESS - 0x08000000)>>12; if(sectornumber < 32) { WRP_Status = FLASH_OB_GetWRP() & (uint32_t)~((1<<sectornumber - 1)); WRP1_Status = FLASH_OB_GetWRP1()&0x0000FFFF; } else { WRP1_Status = (FLASH_OB_GetWRP1() & (uint32_t)~((1 << (sectornumber-32) - 1)))&0x0000FFFF; } } else /* Test on the user application to be programmed in Bank2 */ { if(sectornumber < 16) { WRP1_Status = FLASH_OB_GetWRP1() & ((uint32_t)~(1 << (sectornumber + 16) - 1)); WRP2_Status = FLASH_OB_GetWRP2(); } else { WRP2_Status = (FLASH_OB_GetWRP2() & (uint32_t)~(1 <<( sectornumber - 16) - 1)); } } } if ((WRP_Status!=0)||(WRP1_Status!=0)||(WRP2_Status!=0) || (WRP3_Status != 0)) return 1; else return 0;#endif
} is it right?2014-10-28 06:36 PM
I find strange thing. that is I add the register WRPR3.
WRPR, WRPR1 and WRPR2 immediatly are exist. 128k + 128k + 128k +128k(add) = 512k... register window of My compiler didn't display WRPR. I can see WRPR1, WRPR2 and WRPR3. I use IAR. what should I do?2014-10-29 08:13 AM
I'm not a user of the L151RE, or IAR, and haven't looked at the exact mapping of the flash protection registers.