Looking for example code for using IntEEPROM

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Looking for example code for using IntEEPROM

1,309 Views
Blackdragon
Contributor I

I am looking for example code for using the IntEEPROM. I realize it is processor dependent but it looked straight forward in use. Using an S08PA16, figured we would keep one MCU vendor in house instead of 3.

Looking for setup/use for GetWord and SetWord. We generate nothing but errors in our short experiment.

Bill

0 Kudos
6 Replies

687 Views
edsonabreu
Contributor I

Hi William,

     Did you got success in your application using EEPROM of S08PA16?

     I'm trying to solve the same problem.

     If it's possible, could you send me the example you did?

Thanks a lot.

Edson

0 Kudos

687 Views
vfilip
NXP Employee
NXP Employee

Hello,

you can find some code snipset in "Typical usage" page in the help of the component, the help is available via "Help" comnand when you right click ont he component.

Also attaching the file.

Best regards

Vojtech Filip

Processor Expert Support Team

0 Kudos

687 Views
Blackdragon
Contributor I

Thanks Vojtech. I have become so used to ferreting information I forgot the obvious place.

Did notice all the examples are in byte format, Just adjusted it for word and got error that it was looking for a byte, odd.

Thanks again.

0 Kudos

687 Views
vfilip
NXP Employee
NXP Employee

Hello,

in case the problem persist, could you please post here some project demonstarting the behaviour?

Best regards

Vojtech Filip

Processor Expert Support Team

0 Kudos

687 Views
fredrikb
Contributor I

I'm also having problems using the IntEEPROM functions with my MC9S08PT60 MPU.

I've tried contacting Freescale support a week ago regarding it(Service Request "SR 1-2057880684"), but I havent got any response yet...

First I think I've found two errors in the PE generated code:

1. "typedef byte * IEE1_TAddress; /* Type of address to the EEPROM */ "

in the file IEE1.h needs to be a pointer to a word not a byte (since the eeprom address starts at 0x3100)

2. This row in both the functions IEE1_GetByte and IEE1_SetByte seams to be wrong

" if(((word)Addr <...." It should start with "if(((word)*Addr <..... " otherwise it compares the adress of the pointer and not the adress itself.

(It's a little annoying to change this back every time I've regenerated the PE-code, any ideas on how to avoid that?)

But even after fixing these, I still can't write to the eeprom area.

I get the error code "9" (ERR_NOTAVAIL), and when I debug it I can see that it is the function EraseSectorInternal() that is called from the IEE1_SetByte()-function that generates the error code.

I then started to look at the registers, and it gives the errorcode because the bit ACCERR in the status register NVM_FSTAT is set.

I've made a test project to debug it and to highlight the problem:

https://www.dropbox.com/s/0h2tks5ybo2mtpu/eeprom_test.zip

It's written for a TWR-SO8PT60 kit, and requires a serial cable to the computer.

It reads a character that you send from a hyperterminal window (9600,8,N,1,N)

Then the program tries to store it to the eeprom-area

and then retreive it and echo it back to the terminal window together with some debug info.

It also displays the error codes and the status of the NVM_FSTAT register.

The read functions seems to work (it returns "1" all the time, but no error codes)

I get this result in the terminalwindow:

Error code(after eeprom write):09

NVM_FSTAT(after eeprom write): 10100000

Error code(after eeprom read): 00

stored character echoed back: 1

I'm using codewarrior 10.6

I've tried to both enable and disable Memory area 5 in build options for the cpu.

And both exclusive eeprom usage and not for the intEEPROM-component

And both safe and destructive writes.

The MCU:s both in my tower-kit and in the actual prototype I'm working on are of the 4N40C batch btw.

In case this is another bug in the hardware...

Can anyone please help me out?

0 Kudos

687 Views
edsonabreu
Contributor I

Hi,

      With the help of Willian and people from our representative and distribuitor for Freescale, ITECH, I got success using INTEEPROM.

      See below my code:

 

#include "IEE1.h"  // this must be in the beginning of the program

   

Main()

  {

 

Sinal = 10;                                   

  Vmin1Sinal = 11;

  Vmax1Sinal = 12;

       

        IEE1_SetWord(IEE1_AREA_START, Sinal);  //save first 16 bits variable

         IEE1_SetWord(IEE1_AREA_START+2,Vmin1Sinal);  //save second 16 bits variable

         IEE1_SetWord(IEE1_AREA_START+4, Vmax1Sinal);  //save third bit variable

        IEE1_GetWord(IEE1_AREA_START, &POT1min);  //read first position and save in variable POT1min

       IEE1_GetWord(IEE1_AREA_START+2,&POT1max);  // read second position and save in variable POT2max

       IEE1_GetWord(IEE1_AREA_START+4,&POT2min);  // read third position and save in variable POT2min

}

0 Kudos