This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Unable to flash the STM32L151CC

Hi,

We are trying to run application code on the STM32L151CC starting at 0x08008000. Part of the job of the code is to write to a flash area starting at 0x08024000, but the code freezes when we try this, and the debugger stops working.

The problem appears to be in HAL_FLASHEx_HalfPageProgram. If we comment out the line *(__IO uint32_t*) ((uint32_t)(Address + (4 * count))) = *(pBuffer++); the rest of the code will run fine (without actually flashing of course).

If our application code runs from 0x08000000 there is no problem.

Steve

  • I should add that the same code runs correctly on the STM32L151VE, except the flash area is moved to 0x08040000. HAL_FLASHEx_HalfPageProgram is in SRAM in both cases.

  • Try version 1.7.0.
    Correction is:

    
        /* Wait for last operation to be completed */
        status = FLASHRAM_WaitForLastOperation(FLASH_TIMEOUT_VALUE);
    
        /* Enable IRQs */
        __enable_irq();
    


    instead of:

        /* Enable IRQs */
        __enable_irq();
    
        /* Wait for last operation to be completed */
        status = FLASHRAM_WaitForLastOperation(FLASH_TIMEOUT_VALUE);