This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

How to read the msp430 registers?

I have writen some test code to write and read the msp430 registers,the wirte function can work correct,but read doesn't.

Here is the code,is there anyting wrong?

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <getopt.h>
#include <errno.h>
#include <sys/mman.h>
#include <sys/ioctl.h>
#include <linux/i2c.h>
#include <linux/i2c-dev.h>
int  main()
{
int file;
int i;
int adapter_nr=0;
char filename[20];
sprintf(filename,"/dev/i2c/%d",adapter_nr);
if((file=open(filename,O_RDWR))<0){
  printf("open failed\n");
  exit(1);
  }
  printf("open success\n");
int addr=0x25;
if (ioctl(file,I2C_SLAVE,addr)<0){
   printf("address occpied\n");
   exit(1);
   }
char buf[3];
buf[0]=0x03;
buf[1]=0x46;
write(file,buf,2);

usleep(1000)
buf[0]=0x03;//I have also tried other regitsters ,still wrong
read(file,buf,2);
return 0;
}

Whichever register of Msp430 I read ,the buf[0] buf[1] buf[3] are all zeros.

Can anybody help me ?