2020-07-17 02:29 AM
The following test code, when writing pTemp[3] to EEPROM, that is, when writing 0x00 to internal EEPROM(FLASH 0x08080000), an error will occur. Calling library function DATA_EEPROM_ProgramByte will have the same error. What causes it? Will it be due to insufficient voltage or grounding?
void EEPROM_WriteBytes(uint32_t Address, uint8_t *Buffer, uint16_t Length)
{
uint32_t i = 0;
//uint8_t *pTemp = (uint8_t *)Buffer;
uint8_t pTemp[5] = {0x01, 0x02, 0x00, 0x04, 0x00};
uint8_t *wAddr = (uint8_t *)(Address + EEPROM_BASE_ADDR);
uint8_t value = 0;
if(Length >= EEPROM_BYTE_SIZE)
{
Length = EEPROM_BYTE_SIZE;
}
__disable_irq();
DATA_EEPROM_Unlock();
for(i = 0; i < 5; i++)
{
value = *(pTemp + i);
*(__IO uint8_t *)(wAddr + i) = value;
//DATA_EEPROM_ProgramByte(wAddr + i, value);
}
DATA_EEPROM_Lock();
__enable_irq();
}
2020-07-17 05:53 AM
Always include your chip part number in your post.
> an error will occur
What error?
2020-07-21 10:06 PM
The device is STM32L151CB.
An error will writing 0x00 to the internal EEPROM (0x08080000).
There is no error prompt, MCU stops working.
What causes it? Thank you!
2020-07-22 05:54 AM
That's not a valid memory address. The chip has 128kB of flash. You're writing well past the end of it.
Not sure.
2020-07-22 01:13 PM
> MCU stops working
Debug as usually. Instrument your programming code, as well as hardfault handler, and observe.
JW
2020-07-22 01:36 PM
It's L1, not L5 series...