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.

I am able to code AFE4490 using MSP430 but not getting led or photo-diode output

Other Parts Discussed in Thread: AFE4490, ENERGIA

Dear TI,

I am working on AFE4490 using MSP430 as a Master device.

I am able to write into the AFE's registers and read them back. I am able to vary the transmitter reference voltage to 0.5, 0.75 and 1.0 Volts using Control Register 2.

I am not able to get any current in the LED pins. Nor am I amble to get any clocks on LED_ALM or PD_ALM even though I have enabled 'ALMPINCLKEN =1' in Alarm Register with CLKALMPIN[2:0] of Control Register1 as '000'

I have shorted all the VDDs as I intend to operates the system finally at 3.3V. The MSP430 Launchpad board is powering the AFE4490 Board.  

I am attaching the schematic and layout of the board along with the Energia code(copy pasted the code in a .txt file) I am using for MSP430 Launchpad board (25MHz).

Please help me solve the issue.

Regards,
Salil Kale
Research Assistant
Electrical Engineering
IIT-Bombay

/*
 F5529 LaunchPad pin mapping

                               +--\/--+                                 +--\/--+
                          3.3v |1   21| 5.0v               (TA2.2) P2.5 |40  20| GND
                  (TB0.0) P6.5 |2   22| GND                (TA2.1) P2.4 |39  19| P2.0 (TA1.1)
     (UCA0RXD -> Serial1) P3.4 |3   23| P6.0 (A0)          (TA0.4) P1.5 |38  18| P2.2
     (UCA0TXD -> Serial1) P3.3 |4   24| P6.1 (A1)          (TA0.3) P1.4 |37  17| P7.4 (TB0.2)
                          P1.6 |5   25| P6.2 (A2)          (TA0.2) P1.3 |36  16| RST
                     (A6) P6.6 |6   26| P6.3 (A3)          (TA0.1) P1.2 |35  15| P3.0 (UCB0SIMO) (UCB0SDA)
                          P3.2 |7   27| P6.4 (A4)                  P4.3 |34  14| P3.1 (UCB0SOMI) (UCB0SCL)
                          P2.7 |8   28| P7.0 (A12)                 P4.0 |33  13| P2.6
             (PM_UCB1SCL) P4.2 |9   29| P3.6 (TB0.6)               P3.7 |32  12| P2.3 (TA2.0)
             (PM_UCB1SDA) P4.1 |10  30| P3.5 (TB0.5)               P8.2 |31  11| P8.1
                               +------+                                 +------+

                                 ----+
                                   41| P2.1 (PUSH1)
                                   42| P1.1 (PUSH2)
                                   43| P1.0 (LED1 - RED)
                                   44| P4.7 (LED2 - GREEN)
                                   45| P4.5 (UCA1RXD -> ezFET -> Serial)
                                   46| P4.4 (UCA1TXD -> ezFET -> Serial)
                                 ----+
*/

#include<SPI.h>

unsigned long data;
byte address;
const int SPI_STE = 8;
const int SPI_CLK = 7;
const int SPI_SIMO = 15;
const int SPI_SOMI = 14;

const int AFE_RESET = 39;
const int ADC_RDY = 38;
const int AFE_PDNZ = 40;

// constant int SPI_SOMI = 14;
// constant int SPI_STE = 8;
// constant int SPI_CLK = 7;


void setup()
{
  // put your setup code here, to run once:
  Serial.begin(9600);
  SPI.begin();
  pinMode(AFE_RESET,OUTPUT);
  pinMode(ADC_RDY,INPUT);
  pinMode(AFE_PDNZ,OUTPUT); 
  
  pinMode(SPI_STE,OUTPUT);
  digitalWrite(AFE_RESET,HIGH);
  digitalWrite(AFE_PDNZ,HIGH);
  digitalWrite(SPI_STE, HIGH);
  
  delay(10);
  digitalWrite(AFE_RESET,LOW);
  
  delay(10);
  digitalWrite(AFE_RESET,HIGH);
  
  delay(20);
  
  write(0x01,0x0017C0);    ////  
  write(0x02,0x001f3E);    ////  
  write(0x03,0x001770);    ////  
  write(0x04,0x001F3F);    ////  
  write(0x05,0x000050);    ////  
  write(0x06,0x0007CE);    ////  
  write(0x07,0x000820);    ////  
  write(0x08,0x000F9E);    ////  
  write(0x09,0x0007D0);    ////  
  write(0x0A,0x000F9F);    ////  
  write(0x0B,0x000FF0);    ////  
  write(0x0C,0x00176E);    ////  
  write(0x0D,0x000006);    ////  
  write(0x0E,0x0007cf);    ////  
  write(0x0F,0x0007d6);    ////  
  write(0x10,0x000f9f);    ////  
  write(0x11,0x000fa6);    ////  
  write(0x12,0x00176f);    ////  
  write(0x13,0x001776);    ////  
  write(0x14,0x001f3f);    ////  
  write(0x15,0x000000);    ////  
  write(0x16,0x000005);    ////  
  write(0x17,0x0007d0);    ////  
  write(0x18,0x0007d5);    ////  
  write(0x19,0x000fa0);    ////  
  write(0x1A,0x000fa5);    ////  
  write(0x1B,0x001770);    ////  
  write(0x1C,0x001775);    ////  
  write(0x1D,0x001f3f);    ////  
  write(0x1E,0x000101);    ////  
  write(0x1F,0x000000);    ////  
  write(0x20,0x000000);
  write(0x21,0x000000);
  write(0x22,0x02ffff);
  write(0x23,0x020000);    ////  
  write(0x24,0x000000);
  write(0x25,0x000000);
  write(0x26,0x000000);
  write(0x27,0x000000);
  write(0x28,0x000000);
  write(0x29,0x000080);
  write(0x2A,0x000000);
  write(0x2B,0x000000);
  write(0x2C,0x000000);
  write(0x2D,0x000000);
  write(0x2E,0x000000);
  write(0x2F,0x000000);
  write(0x30,0x000000);
  
  unsigned long dataafe1, dataafe2, dataafe3, dataafe4, dataafe5, dataafe6, dataafe7;
  //  Serial.print(read(0x22));
  dataafe1 =  read(0x04);
  dataafe2 =  read(0x29);
  dataafe3 =  read(0x2C);
  dataafe4 =  read(0x2D);
  dataafe5 =  read(0x03);
  //  read(0x03);
  //  read(0x22);
  
  
  delay(1);
}
  
  
void loop()
{
  // put your main code here, to run repeatedly:
    delay(10);
}
  
  
  
void write(byte address,unsigned long data)
{
  digitalWrite(SPI_STE, LOW);
  delay(1);
  SPI.transfer(0x00); 
  SPI.transfer(0x00);
  SPI.transfer(0x00);
  SPI.transfer(0x00);
  delay(1);
  digitalWrite(SPI_STE, HIGH);
  delay(1);
   
  digitalWrite(SPI_STE, LOW);
  delay(1);
  SPI.transfer(address);
  SPI.transfer(data>>16);
  SPI.transfer(data>>8);
  SPI.transfer(data);
  digitalWrite(SPI_STE, HIGH);
  delay(1);
}
  
  
  
unsigned long read(byte address)
{
  unsigned long Result; 
  
  digitalWrite(SPI_STE, LOW);
  delay(1);
  SPI.transfer(0x00); 
  SPI.transfer(0x00);
  SPI.transfer(0x00);
  SPI.transfer(0x01);
  delay(1);
  digitalWrite(SPI_STE, HIGH);
  delay(1);

  unsigned long RX[3];
  

  digitalWrite(SPI_STE, LOW);
  delay(1);
  RX[0] = SPI.transfer(address);///////////////
  RX[1] = SPI.transfer(0x00);
  RX[2] = SPI.transfer(0x00);
  RX[3] = SPI.transfer(0x00);
  digitalWrite(SPI_STE, HIGH);
  delay(1);

  Result = (RX[1] << 16)|(RX[2] << 8)|(RX[3]);

  Serial.print(RX[1]);
  Serial.print("\n");

  Serial.print(RX[2]);
  Serial.print("\n");

  Serial.print(RX[3]);
  Serial.print("\n");
  Serial.print("\n");
  

  return Result;

}
 

 
 
 
 
 
/*
  write(0x23,0x001f3f);
  write(0x23,0x001f3f);
  write(0x23,0x001f3f);
  write(0x23,0x001f3f);
  write(0x23,0x001f3f);
  write(0x23,0x001f3f);
*/

/*
  address1 = 0x23;
  data1= 0x020000;   ////// Data to LED control register Address: 22h
  address1 = 0x22;
  data1= 0x020f0f;   ////// Data to LED control register Address: 22h
  address1 = 0x1D;
  data1= 0x001f3f;   ////// Data to LED control register Address: 22h
  address1 = 0x23;
  data1= 0x020000;   ////// Data to LED control register Address: 22h
  address1 = 0x22;
  data1= 0x01ffff;   ////// Data to LED control register Address: 22h
  

address = 1;
data=0;

*/
Pulse_oximetry_AFE4.brdPulse_oximetry_AFE4.sch

  • Hello Salil,

    After configuring the AFE registers, are you able to view the 4MHz clock on CLKOUT pin or the 250ns active high pulse signal at 500Hz on the ADC_RDY pin?
  • Praveen,

    One update: I have solved the single Vdd problem. Now AFE has the required 3.3 and 5 volt supplies on the receiver and the transmitter supply pins respectively as suggested in the datasheet of AFE4490.

    Just after the programming I don't get a 4MHz clock on the Clk-Out pin.

    But when I probe the XOUT pin of the crystal for a sec then I start geting a 4MHz clk on the Clk_Out pin of the AFE4490.

    Also the ADC_RDY signal is a constant High(3.2V).

    Additional question:


    Is proper grounding of the AFE's bottom Ground pad very essential for proper working of the AFE or its just for Noise reduction purposes?
    I asking this as I might not have been able to ground the ground pad properly.

    Regards,

    Salil

  • Praveen,

    I noticed one more thing when I am powering the AFE breakout board with a source meter,  of the 2 possible following sequences:

    1) The AFE_PDNZ pin is shorted to the VDD pin of the board 1st followed by powering up the board.

    And

    2) Powering up the board 1st followed by, the AFE_PDNZ pin is shorted to the VDD pin of the board.

    I get a 4MHz clock on the Clock_out pin in the 1st case directly after powering up the board. But I dont get a 4MHz clock on the Clk_out pin in the 2nd case until I dont load the Xout pin of the crystal as mentioned by me in the previous post.

    Regards,
    Salil

  • Dear Praveen Aroul,

    Could you please give any suggestions to remove this problem.

    -Salil