2022-11-03 06:11 AM
Debuging the function when try this
HAL_FLASH_Program(FLASH_TYPEPROGRAM_DOUBLEWORD, (uint32_t) 0x08001000, DATA_64)
get in FLAH->SR = 8, its the PROGERR bit, i unlock the flash before, below part of code
HAL_FLASH_Unlock();
if (HAL_FLASH_Program(FLASH_TYPEPROGRAM_DOUBLEWORD, (uint32_t) 0x08001000, DATA_64) == HAL_OK)
{
HAL_GPIO_WritePin(Y0_GPIO_Port, Y0_Pin, GPIO_PIN_SET);
}else{
HAL_GPIO_WritePin(Y2_GPIO_Port, Y2_Pin, GPIO_PIN_SET);
}
HAL_FLASH_Lock();
Debuging it can see the PROGERR sets after 2nd word write...
static void FLASH_Program_DoubleWord(uint32_t Address, uint64_t Data)
{
/* Set PG bit */
SET_BIT(FLASH->CR, FLASH_CR_PG);
/* Program first word */
*(uint32_t *)Address = (uint32_t)Data;
/* Barrier to ensure programming is performed in 2 steps, in right order
(independently of compiler optimization behavior) */
__ISB();
/* Program second word */
*(uint32_t *)(Address + 4U) = (uint32_t)(Data >> 32U);
}// AFTER THIS THE PROGERR IS SET
Add, i try configure the LATENCY to 2 but no effects.... same error
Bit 3 PROGERR: Programming error Set by hardware when a double-word address to be programmed contains a value different from '0xFFFF FFFF' before programming, except if the data to write is '0x0000 0000'. Cleared by writing 1.
The address pass the assert_param(IS_FLASH_PROGRAM_ADDRESS(Address)); correctly
and use the 0x08001000 its 2nd page of memory. I dont find the problem anywere....
Thanks for hepl in advance
2022-11-03 08:54 AM
Im checking the code the data memory and is right cant write because not have FFFFFFFF in the memory before, but if i want change only one value of 64bit in the page i will need read all page to rewrite with the same data only the data changed modified??? that its the correct way? i will store holding registers from MODBUS.....