STM32L412CB Flash Write/Erase fails first time only, then works OK.
uint32_t write_to_flash(uint8_t * buf, uint16_t length){ if((length)>2047) return 0xFFFFFFFF; uint32_t base_addr=0; base_addr=getHexAddressPage(DATA_PAGE); uint32_t PAGEError; /* Unlock the Flash to enable the flash control register access ...