Post Go back to editing

AD5940 Temperature Example

Category: Software
Product Number: AD5940

I'm having trouble with the AD5940 temperature example. No results were printed until I powered the SINC2NOTCH block by modifying this line

AD5940_AFECtrlS(AFECTRL_TEMPCNV|AFECTRL_ADCCNV|AFECTRL_SINC2NOTCH, bTRUE); /* Start ADC convert */

The code now prints four nonsensical results and stops:

Hello AD5940-Build Time:13:08:26
Internal calibration register value:
Gain: 0x00004000
Offset: 0x00000000
Result[0] = -14, -274.30(C)
Result[1] = 10178, 561.45(C)
Result[2] = 11926, 704.79(C)
Result[3] = 12369, 741.12(C)

How do I resolve this? 

Parents
  • After looking at page 399 of the ADuCM350 hardware reference manual 

    https://www.analog.com/media/en/technical-documentation/user-guides/aducm350_ug-587.pdf

    I modified the sequence so that the temperature sensor was powered on and off along with the ADC. 

      //generate sequence to measure temperature sensor output
      AD5940_SEQGenInit(buff, BUFF_SIZE); //init sequence generator
      AD5940_SEQGenCtrl(bTRUE); //from now on, record all register operations rather than write them to AD5940 through SPI.
      AD5940_SEQGpioCtrlS(AGPIO_Pin1);  //pull high AGPIO1 so we know the sequencer is running by observing pin status with oscilloscope etc.
      AD5940_SEQGenInsert(SEQ_WAIT(16*200));  /* Time for reference settling(if ad5940 is just wake up from hibernate mode) */
      AD5940_AFECtrlS(AFECTRL_ADCPWR|AFECTRL_TEMPSPWR, bTRUE); /* Turn ON ADC and temperature sensor power */
      AD5940_SEQGenInsert(SEQ_WAIT(16*50));   /* wait another 50us for ADC to settle. */
      AD5940_AFECtrlS(AFECTRL_TEMPCNV|AFECTRL_ADCCNV|AFECTRL_SINC2NOTCH, bTRUE);  /* Start temperature and ADC convert */
      AD5940_SEQGenInsert(SEQ_WAIT(WaitClks));
      AD5940_AFECtrlS(AFECTRL_TEMPCNV|AFECTRL_ADCCNV|AFECTRL_SINC2NOTCH, bFALSE);    /* Stop ADC convert, hw ref manual p. 53 says TEMOCNV resets to 0 after conversion */
      AD5940_AFECtrlS(AFECTRL_ADCPWR|AFECTRL_TEMPSPWR, bFALSE); /* Turn off ADC and temperature sensor power */
      AD5940_SEQGenInsert(SEQ_WAIT(20));			/* Add some delay before put AD5940 to hibernate, needs some clock to move data to FIFO. */
      AD5940_SEQGpioCtrlS(0);     /* pull low AGPIO so we know end of sequence.*/
      AD5940_EnterSleepS();/* Goto hibernate */
      AD5940_SEQGenCtrl(bFALSE);  /* stop sequence generator */
      if(AD5940_SEQGenFetchSeq(&pSeqCmd, &seq_len) != AD5940ERR_OK){
    

    I'm now getting reasonable values 

    Gain: 0x00004000
    Offset: 0x00000000
    Result[0] = 3622, 23.86(C)
    Result[1] = 3622, 23.86(C)
    Result[2] = 3623, 23.94(C)
    Result[3] = 3622, 23.86(C)

    These increase and decrease as I warm and cool the IC

Reply
  • After looking at page 399 of the ADuCM350 hardware reference manual 

    https://www.analog.com/media/en/technical-documentation/user-guides/aducm350_ug-587.pdf

    I modified the sequence so that the temperature sensor was powered on and off along with the ADC. 

      //generate sequence to measure temperature sensor output
      AD5940_SEQGenInit(buff, BUFF_SIZE); //init sequence generator
      AD5940_SEQGenCtrl(bTRUE); //from now on, record all register operations rather than write them to AD5940 through SPI.
      AD5940_SEQGpioCtrlS(AGPIO_Pin1);  //pull high AGPIO1 so we know the sequencer is running by observing pin status with oscilloscope etc.
      AD5940_SEQGenInsert(SEQ_WAIT(16*200));  /* Time for reference settling(if ad5940 is just wake up from hibernate mode) */
      AD5940_AFECtrlS(AFECTRL_ADCPWR|AFECTRL_TEMPSPWR, bTRUE); /* Turn ON ADC and temperature sensor power */
      AD5940_SEQGenInsert(SEQ_WAIT(16*50));   /* wait another 50us for ADC to settle. */
      AD5940_AFECtrlS(AFECTRL_TEMPCNV|AFECTRL_ADCCNV|AFECTRL_SINC2NOTCH, bTRUE);  /* Start temperature and ADC convert */
      AD5940_SEQGenInsert(SEQ_WAIT(WaitClks));
      AD5940_AFECtrlS(AFECTRL_TEMPCNV|AFECTRL_ADCCNV|AFECTRL_SINC2NOTCH, bFALSE);    /* Stop ADC convert, hw ref manual p. 53 says TEMOCNV resets to 0 after conversion */
      AD5940_AFECtrlS(AFECTRL_ADCPWR|AFECTRL_TEMPSPWR, bFALSE); /* Turn off ADC and temperature sensor power */
      AD5940_SEQGenInsert(SEQ_WAIT(20));			/* Add some delay before put AD5940 to hibernate, needs some clock to move data to FIFO. */
      AD5940_SEQGpioCtrlS(0);     /* pull low AGPIO so we know end of sequence.*/
      AD5940_EnterSleepS();/* Goto hibernate */
      AD5940_SEQGenCtrl(bFALSE);  /* stop sequence generator */
      if(AD5940_SEQGenFetchSeq(&pSeqCmd, &seq_len) != AD5940ERR_OK){
    

    I'm now getting reasonable values 

    Gain: 0x00004000
    Offset: 0x00000000
    Result[0] = 3622, 23.86(C)
    Result[1] = 3622, 23.86(C)
    Result[2] = 3623, 23.94(C)
    Result[3] = 3622, 23.86(C)

    These increase and decrease as I warm and cool the IC

Children
No Data