Hi,
I need some help with HalFlashRead / Write / Erase functions.
I'm trying to write and readback some small amount of data.
After read I get only 0xFF, I suppose, I'm reading from wrong address.
Here is part of code:
uint8 send_buf[10] = {0x01, 0x02, 0x03, 0x04, 0x05,0x06, 0x07, 0x08, 0x09, 0x10};
uint8 get_buf[10] = {0}; // inits as zeros
void main(void)
{
//------------------- HAL PROTOTYPES
//void HalFlashErase(uint8 pg);
//HalFlashWrite(uint16 addr, uint8 *buf, uint16 cnt);
//HalFlashRead(uint8 pg, uint16 offset, uint8 *buf, uint16 cnt);
//lets say I need to write to page #4 (which is located at address 0x2000)
uint8 pageNum = 4;
uint16 pageAddr = 0x2000;
HalFlashErase(pageNum);
HalFlashWrite(pageAddr, send_buf, 10);
//readback
uint16 offset = 0; // as I understand, this should be non-zero when I'm trying read something at middle of page
HalFlashRead(pageNum, offset, get_buf, 10);
// and get_buf is filled with 0xFF
}
Please advice about what am I missing.


