Jump to content

Search the Community

Showing results for tags 'max30101'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • News
    • Announcements
    • Suggestions
    • New users say Hi!
  • Spotlight!
    • Sponsor Spotlight
    • Sponsor Giveaways
  • Energia
    • Energia - MSP
    • Energia - TivaC/CC3XXX
    • Energia - C2000
    • Energia Libraries
  • MSP Technical Forums
    • General
    • Compilers and IDEs
    • Development Kits
    • Programmers and Debuggers
    • Code vault
    • Projects
    • Booster Packs
    • Energia
  • Tiva-C, Hercules, CCXXXX ARM Technical Forums
    • General
    • SensorTag
    • Tiva-C, Hercules, CC3XXX Launchpad Booster Packs
    • Code Vault
    • Projects
    • Compilers and IDEs
    • Development Kits and Custom Boards
  • Beagle ARM Cortex A8 Technical Forums
    • General
    • Code Snippets and Scripts
    • Cases, Capes and Plugin Boards
    • Projects
  • General Electronics Forum
    • General Electronics
    • Other Microcontrollers
  • Connect
    • Embedded Systems/Test Equipment Deals
    • Buy, Trade and Sell
    • The 43oh Store
    • Community Projects
    • Fireside Chat
  • C2000 Technical Forums
    • General
    • Development Kits
    • Code Vault
    • Projects
    • BoosterPacks

Calendars

There are no results to display.


Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Website URL


Location


Interests


Sparkfun


Github

Found 1 result

  1. Hello, I am trying to get RED, IR and GREEN led value in real time from MAX30101 sensor. I am using MSP430F5438A as my MCU. My IDE is CCS. The protocol required to communicate with the sensor is I2C. Now my problem is I am not any value except 0 in my read and write pointer (Indicated in the comment in my code). I am supposed to get some value in between 0 to 32. I'm attaching the link for the datasheet for the sensor: https://datasheets.maximintegrated.com/en/ds/MAX30101.pdf I know the datasheet is a whole lot. But I am referring page 17 which they have a pseudo code how to burst read the FIFO. If anyone already worked with the sensor or anyone know please have a look at it. #include <msp430.h> #include <msp430f5438a.h> #include <string.h> #define MAX30101_I2C_ADDRESS 0x57 #define MAX30101_REG_INT_STS1 0x00 #define MAX30101_REG_INT_STS2 0x01 #define MAX30101_REG_INT_EN1 0x02 #define MAX30101_REG_INT_EN2 0x03 #define MAX30101_REG_FIFO_WR 0x04 #define MAX30101_REG_FIFO_OVF 0x05 #define MAX30101_REG_FIFO_RD 0x06 #define MAX30101_REG_FIFO_DATA 0x07 #define MAX30101_REG_FIFO_CFG 0x08 #define MAX30101_REG_MODE_CFG 0x09 #define MAX30101_REG_SPO2_CFG 0x0a #define MAX30101_REG_LED1_PA 0x0c #define MAX30101_REG_LED2_PA 0x0d #define MAX30101_REG_LED3_PA 0x0e #define MAX30101_REG_PILOT_PA 0x10 #define MAX30101_REG_MULTI_LED 0x11 #define MAX30101_REG_TINT 0x1f #define MAX30101_REG_TFRAC 0x20 #define MAX30101_REG_TEMP_CFG 0x21 #define MAX30101_REG_PROX_INT 0x30 void Clock_setup(); // default void MAX30101_setup(); // Sensor config setup void I2C_setup(); void sendByte(char register_add, char data); int readByte(char wr_add, char rd_add, char register_add); void burstRead(char wr_add, char rd_add, char register_add, int no_ofsample); void FIFO_Clear(); char LED1 [96]; char LED2 [96]; char LED3 [96]; long L1[32]; long L2[32]; long L3[32]; int wr; int rd; int Ns; // number of available sample void main() { WDTCTL = WDTPW + WDTHOLD; Clock_setup(); I2C_setup(); _EINT(); MAX30101_setup(); while(1){ //FIFO_Clear(); wr= readByte(0xAE, 0xAF, 0x04); // reading WR_PTR---> I don't know why getting zero rd= readByte(0xAE, 0xAF, 0x06); // reading RD_PTR---> I don't know why getting zero Ns = wr-rd; if(Ns<0){ Ns+=32; } if(wr != rd){ burstRead(0xAE, 0xAF, 0x07, Ns); } } } void Clock_setup(){ P11DIR |= BIT2; // check smclk, 1MHz default P11SEL |= BIT2; // check smclk, 1MHz default P11DIR |= BIT0; // check aclk, 32.8KHz default P11SEL |= BIT0; // check aclk, 32.8KHz default } void I2C_setup() { P3SEL |= BIT7; // P3.1(UCB0_SDA), P3.2(UCB0_SCL) P5SEL |= BIT4; UCB1CTL1 |= UCSWRST; // reset enable UCB1CTL0 = UCMST + UCMODE_3 + UCSYNC; // master + I2C mode + Sync UCB1CTL1 = UCSSEL_2 + UCSWRST; //use SMCLK + still reset UCB1BR0 = 10; // default SMCLK 1M/10 = 100KHz.........? UCB1BR1 = 0; // UCB1I2CSA = MAX30101_I2C_ADDRESS; // MAX30101 7 bit address 0x57 UCB1CTL1 &= ~UCSWRST; // reset clear // UCB1IE |= UCTXIE + UCRXIE; //TX and RX interrupt enabled } //Single Byte Transmit (TX) void sendByte(char register_add, char data){ // UCB0I2CSA = slave_add; //slave address for transmit mode UCB1CTL1 |= UCTR + UCTXSTT; // I2C transmit (write) mode + generating START condition UCB1TXBUF = register_add; //register address to measure temperature/pressure while(!(UCB1IFG & UCTXIFG)); //wait until reg address got sent while(UCB1CTL1 & UCTXSTT); //wait till START condition is cleared UCB1TXBUF = data; //send data to register while(!(UCB1IFG & UCTXIFG)); //wait until data got sent UCB1CTL1 |= UCTXSTP; //generate a STOP condition while(UCB1CTL1 & UCTXSTP); //wait until stop condition got sent } //Single Byte Receive (RX) int readByte(char wr_add, char rd_add, char register_add){ int rx_byte; //UCB0I2CSA = slave_add; //slave address UCB1CTL1 |= UCTXSTT + UCTR; // Generating START + I2C transmit (write) UCB1TXBUF = wr_add; //write register address while(!(UCB1IFG & UCTXIFG)); //wait until reg address got sent UCB1TXBUF = register_add; //write register address while(!(UCB1IFG & UCTXIFG)); //wait until reg address got sent while( UCB1CTL1 & UCTXSTT); //wait till START condition is cleared UCB1CTL1 |= UCTXSTT; //generate RE-START //UCB1I2CSA = slave_add; //slave address UCB1TXBUF = rd_add; //write register address while(!(UCB1IFG & UCTXIFG)); //wait until reg address got sent UCB1CTL1 &=~ UCTR; //receive mode while( UCB1CTL1 & UCTXSTT); //wait till START condition is cleared rx_byte = UCB1RXBUF; //read byte UCB1CTL1 |= UCTXSTP; //generate stop condition while(UCB1CTL1 & UCTXSTP); //wait till stop condition got sent return rx_byte; } //Multiple Byte Receive (RX) void burstRead(char wr_add, char rd_add, char register_add, int no_ofsample){ unsigned int i; //UCB1I2CSA = slave_add; //slave address //while(!(UCB1IFG & UCTXIFG)); //wait until slave address got sent UCB1CTL1 |= UCTXSTT + UCTR; // Generating START condition + I2C transmit (write) UCB1TXBUF = wr_add; //write register address while(!(UCB1IFG & UCTXIFG)); //wait until reg address got sent UCB1TXBUF = register_add; //write register address while(!(UCB1IFG & UCTXIFG)); //wait until reg address got sent while( UCB1CTL1 & UCTXSTT); //wait till START condition is cleared UCB1CTL1 |= UCTXSTT; //generate RE-START condition //UCB1I2CSA = slave_add; //slave address UCB1TXBUF = rd_add; //write register address while(!(UCB1IFG & UCTXIFG)); //wait until reg address got sent UCB1CTL1 &=~ UCTR; //receive mode while( UCB1CTL1 & UCTXSTT); //wait till START condition is cleared //buffer[0] = UCB1RXBUF; //dummy read //while(!(UCB1IFG & UCRXIFG)); //wait till byte is completely read for(i=0;i<no_ofsample;++i){ LED1 = UCB1RXBUF; //burst read while(!(UCB1IFG & UCRXIFG)); //wait while the Byte has being read LED1[i+1] = UCB1RXBUF; //burst read while(!(UCB1IFG & UCRXIFG)); //wait while the Byte has being read LED1[i+2] = UCB1RXBUF; //burst read while(!(UCB1IFG & UCRXIFG)); //wait while the Byte has being read L1= ((LED1 << 16) | (LED1[i+1] << 08 | LED1[i+2]) & 0x03FFFF; LED2 = UCB1RXBUF; //burst read while(!(UCB1IFG & UCRXIFG)); //wait while the Byte has being read LED2[i+1] = UCB1RXBUF; //burst read while(!(UCB1IFG & UCRXIFG)); //wait while the Byte has being read LED2[i+2] = UCB1RXBUF; //burst read L2= ((LED2 << 16) | (LED2[i+1] << 08 | LED2[i+2]) & 0x03FFFF; while(!(UCB1IFG & UCRXIFG)); //wait while the Byte has being read LED3 = UCB1RXBUF; //burst read while(!(UCB1IFG & UCRXIFG)); //wait while the Byte has being read LED3[i+1] = UCB1RXBUF; //burst read while(!(UCB1IFG & UCRXIFG)); //wait while the Byte has being read LED3[i+2] = UCB1RXBUF; //burst read while(!(UCB1IFG & UCRXIFG)); //wait while the Byte has being read L3= ((LED3 << 16) | (LED3[i+1] << 08 | LED3[i+2]) & 0x03FFFF; } //buffer[no_ofBytes-1] = UCB1RXBUF; //last Byte read //while(!(UCB1IFG & UCRXIFG)); //wait UCB1CTL1 |= UCTXSTP; //generate stop condition //while(UCB1CTL1 & UCTXSTP); //wait till stop condition got sent } // Sample Average = 4 // Mode = MultiLED // ADC Range = 2048 // Sample rate = 400 //pulse width = 411 // active slot 01, 02 and 03 void MAX30101_setup(){ sendByte(0x08, 0x40); sendByte(0x09, 0x07); sendByte(0x0A, 0x0F); sendByte(0x11, 0x77); sendByte(0x12, 0x07); } void FIFO_Clear(){ sendByte(0x04, 0x00); sendByte(0x05, 0x00); sendByte(0x06, 0x00); } Thanks, Rowshon.
×
×
  • Create New...