Home > other >  MSP430F5529 development version and MAX30102 chips I2C communication problems
MSP430F5529 development version and MAX30102 chips I2C communication problems

Time:11-01

Recently in with MSP430F5529 development board and MAX30102 pulse blood oxygen chip connection, to MAX30102 chip when writing content, no problem, but debugging found running to read
When, after reading two bytes in FIFO, chip did not work, also have no a red light, I didn't use MSP430F5529 hardware IIC, but with the simulating IIC,

Run over here was lit when the lights went out, and found to be read out after two bytes,
Attach a part of the code:
Bool maxim_max30102_read_fifo (uint32_t * pun_red_led, uint32_t * pun_ir_led)
{
Uint32_t un_temp;
Uint8_t uch_temp;
* pun_ir_led=0;
* pun_red_led=0;
Char ach_i2c_data [6].
Maxim_max30102_read_reg (REG_INTR_STATUS_1, & amp; Uch_temp);
Maxim_max30102_read_reg (REG_INTR_STATUS_2, & amp; Uch_temp);
start();
Sendbyte (I2C_WRITE_ADDR);
If (check ())
{
Sendbyte (REG_FIFO_DATA);
}
Stop ();
The init ();
start();
Sendbyte (I2C_READ_ADDR);
If (check ())
{
Readnbytes ach_i2c_data, (6);
}
Un_temp=ach_i2c_data [0];
Un_temp & lt; <=16;
* pun_red_led +=un_temp;
Un_temp=(unsigned char) ach_i2c_data [1].
Un_temp & lt; <=8;
* pun_red_led +=un_temp;
Un_temp=(unsigned char) ach_i2c_data [2].
* pun_red_led +=un_temp;

Un_temp=(unsigned char) ach_i2c_data [3].
Un_temp & lt; <=16;
* pun_ir_led +=un_temp;
Un_temp=(unsigned char) ach_i2c_data [4].
Un_temp & lt; <=8;
* pun_ir_led +=un_temp;
Un_temp=(unsigned char) ach_i2c_data [5].
* pun_ir_led +=un_temp;
Stop ();
* pun_red_led & amp;=0 x03ffff;
* pun_ir_led & amp;=0 x03ffff;
return true;
}
Char readbyte ()
{
Char rdata=https://bbs.csdn.net/topics/0x00, I;
Uchar flag;
for(i=0; i<8; I++)
{
SDA_H;
Delayus (2);
SCL_H;
SDA_IN;
Delayus (2);
Flag=SDA_VAL;
Rdata<=1;
If (flag)
Rdata |=0 x01;
SDA_OUT;
SCL_L;
Delayus (2);
}
Return rdata;
}
Void readnbytes (char * buf, uchar n)
{
Uchar I;
for(i=0; i{
Buf [I]=readbyte ();
Delayus (1);
If (i<(n - 1))
The response ();
The else
Nresponse ();
}
Stop ();
}

CodePudding user response:

The original poster about msp430f5529 and max30102 communications and data reading display engineering can share you
  • Related