iicEEPROM read and write confusion

Thread Starter

Jswale

Joined Jun 30, 2015
121
Hi All,

I am working on an EVM430-F6779 using the MSP430...

I am trying to write and read back from the EEPROM using I2C.

The functions are pre-written, so I know are correct but I am unsure of how to use them/ what to look for.

C:
int iicEEPROM_write(uint16_t addr, void *dat, int len)

int iicEEPROM_read(uint16_t addr, void *dat, int len)



//my attempts
uint16_t dat = 0xFF;
        
         iicEEPROM_write(0xA0, &dat, sizeof(dat)); 

         iicEEPROM_read(0xA0, &dat, sizeof(dat));
Anyone with any advice on to why this isn't working?

Cheers
JSwale
 

nerdegutta

Joined Dec 15, 2009
2,676
OK, I thought it would be easier to work with the Energia IDE.
I've never used it but I think it is similar to the Arduino IDE. With lots of libraries. I'm on thin ice here, so I might be wrong.
 

Thread Starter

Jswale

Joined Jun 30, 2015
121
Yeah, I need to use the IAR workbench because of the supplied code for my development box. I am more interested in the syntax that I am having a problem with.
 

Thread Starter

Jswale

Joined Jun 30, 2015
121
C:
                    {
                      int *write_dat;
                      int data = 5;
                      write_dat = &data;
                      iicEEPROM_write(0x20, write_dat, 1);
                                     
                      uint8_t value;
                      iicEEPROM_read(0x20, &value, 1);
                    }
This is what I am working with. From what I can tell it should work... write '5' into address 0x20 with length 1 (byte??). Then the read from address 0x20 and store it at the address of 'value'.

Can anyone spot an error?
 
Top