Looks like flash programmer works when I use the GUI but when I attempt to run it in my code I cannot get it to write and verify correctly any idea what is wrong?
SECTORLOCATION *pSectorInfo; ERROR_CODE Result; // result /* open flash driver */ AFP_Error = m25p16_Open(); if (AFP_Error != NO_ERR) return FALSE; // get flash manufacturer & device codes, title & desc if( AFP_Error == NO_ERR ) { AFP_Error = GetFlashInfo(); } // get the number of sectors for this device if( AFP_Error == NO_ERR ) { AFP_Error = GetNumSectors(); } if( AFP_Error == NO_ERR ) { // malloc enough space to hold our start and end offsets pSectorInfo = (SECTORLOCATION *)malloc(AFP_NumSectors * sizeof(SECTORLOCATION)); } // allocate AFP_Buffer if( AFP_Error == NO_ERR ) { AFP_Error = AllocateAFPBuffer(); } // get sector map if( AFP_Error == NO_ERR ) { AFP_Error = GetSectorMap(pSectorInfo); } // point AFP_SectorInfo to our sector info structure if( AFP_Error == NO_ERR ) { AFP_SectorInfo = (int*)pSectorInfo; } AFP_Command = FLASH_FILL; AFP_StartOff = 0x0000000; AFP_Count = 0x2; AFP_Stride = 1; // AllocateAFPBuffer(); x = 0xaa; AFP_Buffer = &x; AFP_Error= ProcessCommand(); AFP_Command = FLASH_READ; AFP_StartOff = 0x00000000; AFP_Count = 0x2; AFP_Stride = 1; AFP_Error = ProcessCommand();