Quantcast
Channel: EngineerZone : Discussion List - All Communities
Viewing all articles
Browse latest Browse all 51060

BF592 M25P16 Driver

$
0
0

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();




Viewing all articles
Browse latest Browse all 51060

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>