|
有哪位大侠在使用LPC11E13的内部EEROM的? 使用下面的代码?总是死在 while(1); 这里!
#define EE_SIZE 2048
#define IAP_LOCATION 0x1FFF1FF1
typedef void (*IAP) ( unsigned int command[], unsigned int result[] );
static const IAP iap_entry = (IAP) IAP_LOCATION;
//1) EEprom Write
//
//Command code: 61
//Param0: eeprom address (byte, half-word or word aligned)
//Param1: RAM address (byte, half-word or word aligned)
//Param2: Number of bytes to be written ( Byte, Half-words write are ok)
//Param3: System Clock Frequency (CCLK) in kHz
//
//Return Code CMD_SUCCESS | SRC_ADDR_NOT_MAPPED | DST_ADDR_NOT_MAPPED
void writeEEPROM( uint8_t* eeAddress, uint8_t* buffAddress, uint32_t byteCount )
{
unsigned int command[5], result[4];
command[0] = 61;
command[1] = (uint32_t) eeAddress;
command[2] = (uint32_t) buffAddress;
command[3] = byteCount;
command[4] = SystemCoreClock/1000;
/* Invoke IAP call...*/
#if (EEPROM_PROFILE!=0)
LPC_CT32B0->TCR = 1;
iap_entry(command, result);
LPC_CT32B0->TCR = 0;
#else
iap_entry(command, result);
#endif
if (0 != result[0])
{
//Trap error
while(1);
}
return;
}
//2) EEprom Read
//Command code: 62
//Param0: eeprom address (byte, half-word or word aligned)
//Param1: RAM address (byte, half-word or word aligned)
//Param2: Number of bytes to be read ( Byte, Half-words read are ok)
//Param3: System Clock Frequency (CCLK) in kHz
//
//Return Code CMD_SUCCESS | SRC_ADDR_NOT_MAPPED | DST_ADDR_NOT_MAPPED
void readEEPROM( uint8_t* eeAddress, uint8_t* buffAddress, uint32_t byteCount )
{
unsigned int command[5], result[4];
command[0] = 62;
command[1] = (uint32_t) eeAddress;
command[2] = (uint32_t) buffAddress;
command[3] = byteCount;
command[4] = SystemCoreClock/1000;
/* Invoke IAP call...*/
iap_entry( command, result);
if (0 != result[0])
{
//Trap error
while(1);
}
return;
} |
阿莫论坛20周年了!感谢大家的支持与爱护!!
知道什么是神吗?其实神本来也是人,只不过神做了人做不到的事情 所以才成了神。 (头文字D, 杜汶泽)
|