Hi,
I am facing Issue of EEPROM Read. On TI Forum I found similar Thread with same issue.
i referred to the solution for Reading data into EEPROM. Link is here.
In this thread problem is solved After changing Address to 32 bit. But he and I as well are already using 32 bit address "0xF0200002" For write as well as Read.
So, please confirm is this address location I used for read and write is correct or not?
Here I also attach my code for eeprom For debug purpose.
/** @file sys_main.c
* @brief Application main file
* @date 05-Oct-2016
* @version 04.06.00
*
* This file contains an empty main function,
* which can be used for the application.
*/
/*
* Copyright (C) 2009-2016 Texas Instruments Incorporated - www.ti.com
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the
* distribution.
*
* Neither the name of Texas Instruments Incorporated nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
/* USER CODE BEGIN (0) */
/* USER CODE END */
/* Include Files */
#include "sys_common.h"
/* USER CODE BEGIN (1) */
/* USER CODE END */
/** @fn void main(void)
* @brief Application main function
* @note This function is empty by default.
*
* This function is called after startup.
* The user can use this function to implement the application.
*/
/* USER CODE BEGIN (2) */
#include "F021.h"
#include "gio.h"
#include "het.h"
#include "sci.h"
#include "cpy_tbl.h"
#include "ti_fee.h"
#include "ti_fee_Types.h"
extern COPY_TABLE _flash_ctbl;
#define WRITE 1
void delay(void)
{
unsigned int dummycnt=0x0000FFU;
do
{
dummycnt--;
}while(dummycnt>0);
}
uint16 u16JobResult,Status;
Std_ReturnType oResult=E_OK;
unsigned char read_data[100]={0};
uint8 SpecialRamBlock[100];
unsigned char pattern;
uint16 u16writecounter;
unsigned int FeeVirtualSectorNumber;
unsigned char VsState, u8EEPIndex;
unsigned char u8VirtualSector;
uint8 Test_Recovery;
uint8 Test_Cancel;
/* USER CODE END */
int main(void)
{
/* USER CODE BEGIN (3) */
Fapi_StatusType f021_Res;
Fapi_FlashStatusWordType f021_State;
uint32_t *f021_Address;
uint8 *ReadAdd , ReadData;
uint32_t ReadBuff[8] = { 0 } ;
Std_ReturnType StatusReturn ;
uint16 flag = 0 ;
uint8_t Data[]= { };
unsigned int BlockNumber;
unsigned int BlockOffset, Length;
unsigned char *Read_Ptr=read_data;
unsigned int loop; /* Initialize RAM array.*/
for(loop=0;loop<10;loop++)SpecialRamBlock[loop] = loop;
sciInit();
gioSetDirection( hetPORT1 , 0xffffffff );
copy_in(&_flash_ctbl);
f021_Res = Fapi_initializeFlashBanks(160);
if (f021_Res != Fapi_Status_Success) {
sciSend(scilinREG , 38 ,(uint8 *)"Unable to initialize EEPROM support!");
return;
} else {
sciSend(scilinREG , 29,(uint8 *) "EEPROM support initialized...");
}
sciSend(scilinREG , 2,"\r\n");
//
f021_Res = Fapi_setActiveFlashBank(Fapi_FlashBank7);
//f021_Res = Fapi_enableEepromBankSectors( 0x0000000f , 0x00000000);
if (f021_Res != Fapi_Status_Success) {
sciSend(scilinREG , 28,(uint8 *)"Unable to activate flash bank!");
return;
}
sciSend(scilinREG , 2,"\r\n");
while ( FAPI_CHECK_FSM_READY_BUSY != Fapi_Status_FsmReady)
;
//f021_Res = Fapi_enableMainBankSectors(0xFFFF);
f021_Res = Fapi_enableEepromBankSectors( 0x0000000f , 0x00000000);
if (f021_Res != Fapi_Status_Success) {
sciSend(scilinREG , 26,(uint8 *)"Unable to enable sectors!");
return;
}
sciSend(scilinREG , 2,"\r\n");
while(1)
{
while ( FAPI_CHECK_FSM_READY_BUSY != Fapi_Status_FsmReady);
Fapi_issueAsyncCommandWithAddress(Fapi_EraseSector, (uint32 *) 0xf0200002);
f021_Address = (uint32 *) 0xf0200002;
f021_State.au32StatusWord[3] = 0; // prepare function answer
// Fapi_disableAutoEccCalculation();
//Fapi_disableAutoEccCalculation();
f021_Res = Fapi_doBlankCheck(f021_Address, 2, &f021_State);
if (f021_Res == Fapi_Status_Success)
sciSend(scilinREG , 8,(uint8 *)"sucess\r\n");
else
sciSend(scilinREG , 9,(uint8 *)"unsucess\r\n");
while ( FAPI_CHECK_FSM_READY_BUSY != Fapi_Status_FsmReady);
f021_Address = (uint32 *) 0xf0200002;
if(WRITE)
{
if( flag == 0 )
{
Data[0] = 0x11;//,0x56,0x57,0x08,0x09,0x10,0x11,0x12,0x13,0x14};
Data[1] = 0x22;
Data[2] = 0x33;
Data[3] = 0x44;
Data[4] = 0x55;
flag = 1 ;
}
else
{
Data[0] = 0x66;//,0x56,0x57,0x08,0x09,0x10,0x11,0x12,0x13,0x14};
Data[1] = 0x77;
Data[2] = 0x88;
Data[3] = 0x99;
Data[4] = 0x00;
flag = 0 ;
}
f021_Res = Fapi_issueProgrammingCommand(f021_Address,Data,5,0,0,Fapi_DataOnly);
}
else
{
uint8_t Data[]={0x00};//,0x56,0x57,0x08,0x09,0x10,0x11,0x12,0x13,0x14};
f021_Res = Fapi_issueProgrammingCommand(f021_Address,Data,5,0,0,Fapi_DataOnly);
}
if ( f021_Res != Fapi_Status_Success ){
sciSend(scilinREG , 26,(uint8 *)"Unable to write!");
return;
}
while ( FAPI_CHECK_FSM_READY_BUSY != Fapi_Status_FsmReady);
// Fapi_doMarginRead( f021_Address , ReadBuff , 1 , Fapi_NormalRead );
ReadAdd = (uint8 *) 0xf0200002;
Fapi_doMarginReadByByte( ReadAdd , &ReadData , 1 , Fapi_NormalRead );
gioSetBit( hetPORT1 , 0 , 1);
gioSetBit( hetPORT1 , 5 , 1);
gioSetBit( hetPORT1 , 25 , 1);
// }
/* USER CODE END */
return 0;
}
/* USER CODE BEGIN (4) */
/* USER CODE END */
Thanks & Regards,
Krunal