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.

ADS7953: Unable to set & observe GPIO Alarm

Part Number: ADS7953

Hi,

Im using ADS7953 External ADC on my project. Im utilizing it in "Manual mode". After programming Alarm and GPIO registers I'm unable to capture any alarm. Im trying to observe GPIO0 High Alarm which has a treshold value set to "0". So that means I have to get an alarm after every conversion. Im adding my configuration below. After device powerup , my programming sequence is ALARM SETUP -> GPIO SETUP -> MANUAL MODE. Im able to read correct values on the spesific channel that I'm observing.  What am I missing on the configuration below ?

Thank you in advance,

Efe

ADS79xx_ConfigType* const ConfigPtr = &g_ADS79xxConfig[Inst];    //Manual mode
 ADS79xx_Alarm_ConfigType* const ConfigPtr2 = &a_ADS79xxConfig[Inst]; //Alarm Setup
 ADS79xx_GPIO_ConfigType* const ConfigPtr3 = &b_ADS79xxConfig[Inst]; //GPIO Setup

 uint8 i = 0 ;

 /*-------------ALARM SETUP---------*/
 ADS79xx_Obj[Inst].SpiSequence = ConfigPtr2->SpiSequence;

 //Frame1
 ADS79xx_Obj[Inst].ADS79xx_TransmitBuffer = 0x0000;
 ADS79xx_Obj[Inst].ADS79xx_TransmitBuffer |= ADS79xx_OPERATION_MODE(ConfigPtr2->OperationMode);

 retVal |= Spi_SetupEB(ConfigPtr2->SpiTxChannel, (Spi_DataBufferType*)&ADS79xx_Obj[Inst].ADS79xx_TransmitBuffer, (Spi_DataBufferType*)&ADS79xx_Obj[Inst].ADS79xx_ReceiveBuffer, 2u);
 if(retVal == E_OK) retVal |= Spi_SetupEB(ConfigPtr2->SpiRxChannel, (Spi_DataBufferType*)&ADS79xx_Obj[Inst].ADS79xx_TransmitBuffer, (Spi_DataBufferType*)&ADS79xx_Obj[Inst].ADS79xx_ReceiveBuffer, 2u);

 if(retVal == E_OK) retVal |= Spi_SyncTransmit((Spi_SequenceType) Inst);

 //Frame2
 ADS79xx_Obj[Inst].ADS79xx_TransmitBuffer = 0x0000;
 ADS79xx_Obj[Inst].ADS79xx_TransmitBuffer |= ADS79xx_GRP_CH(ConfigPtr2->Alarm_GRP_CH);
 ADS79xx_Obj[Inst].ADS79xx_TransmitBuffer |= ADS79xx_ALARM_TYPE(ConfigPtr2->AlarmType);
 ADS79xx_Obj[Inst].ADS79xx_TransmitBuffer |= ADS79xx_ALARM_STATUS(ConfigPtr2->AlarmStatus);
 ADS79xx_Obj[Inst].ADS79xx_TransmitBuffer |= ADS79xx_TRESHOLD(ConfigPtr2->AlarmTreshold);
 for(i=0 ; i<9 ; i++){  //Wait for treshold register to be programmed --> Device requires 9 CS signal for programming treshold.
   if(retVal == E_OK) retVal |= Spi_SyncTransmit((Spi_SequenceType) Inst);
 }

 ADS79xx_Obj[Inst].ADS79xx_TransmitBuffer |= ADS79xx_ALARM_STATUS(EXIT);
 if(retVal == E_OK) retVal |= Spi_SyncTransmit((Spi_SequenceType) Inst);
 /*---------------------------------*/
//char* input = (char*)(&retVal) /*== 0 ? "OK\n": "NOT OK\n"*/;
char* input = retVal == 0 ? "OK\n": "NOT OK\n";
log_txt((const uint8*)input);
 /*-----------GPIO SETUP------------*/
 ADS79xx_Obj[Inst].SpiSequence = ConfigPtr3->SpiSequence;

 ADS79xx_Obj[Inst].ADS79xx_TransmitBuffer = 0x0000;
 ADS79xx_Obj[Inst].ADS79xx_TransmitBuffer |= ADS79xx_OPERATION_MODE(ConfigPtr3->OperationMode);
 ADS79xx_Obj[Inst].ADS79xx_TransmitBuffer |= ADS79xx_GPIO_POWER(ConfigPtr3->PowerMode);
 ADS79xx_Obj[Inst].ADS79xx_TransmitBuffer |= ADS79xx_GPIO_OUT(ConfigPtr3->GPIO);
 ADS79xx_Obj[Inst].ADS79xx_TransmitBuffer |= ADS79xx_ALARM_GPIO(ConfigPtr3->AlarmGPIO);

 retVal |= Spi_SetupEB(ConfigPtr3->SpiTxChannel, (Spi_DataBufferType*)&ADS79xx_Obj[Inst].ADS79xx_TransmitBuffer, (Spi_DataBufferType*)&ADS79xx_Obj[Inst].ADS79xx_ReceiveBuffer, 2u);
 if(retVal == E_OK) retVal |= Spi_SetupEB(ConfigPtr3->SpiRxChannel, (Spi_DataBufferType*)&ADS79xx_Obj[Inst].ADS79xx_TransmitBuffer, (Spi_DataBufferType*)&ADS79xx_Obj[Inst].ADS79xx_ReceiveBuffer, 2u);

     //TODO: Send sth to verify SPI communication first
 if(retVal == E_OK) retVal |= Spi_SyncTransmit((Spi_SequenceType) Inst);
 /*---------------------------------*/

/*--------------MANUAL MODE---------*/

ADS79xx_Obj[Inst].SpiSequence = ConfigPtr->SpiSequence;
   
ADS79xx_Obj[Inst].ADS79xx_TransmitBuffer = 0x0000;
ADS79xx_Obj[Inst].ADS79xx_TransmitBuffer |= ADS79xx_OPERATION_MODE(ConfigPtr->OperationMode);
ADS79xx_Obj[Inst].ADS79xx_TransmitBuffer |= ADS79xx_ENABLE_PROGRAM_BITS(ENABLE);
ADS79xx_Obj[Inst].ADS79xx_TransmitBuffer |= ADS79xx_INPUT_RANGE(ConfigPtr->InputRange);
ADS79xx_Obj[Inst].ADS79xx_TransmitBuffer |= ADS79xx_POWER_MODE(ConfigPtr->PowerMode);
ADS79xx_Obj[Inst].ADS79xx_TransmitBuffer |= ADS79xx_CH_OR_GPIO(ConfigPtr->SendChNoOrGPIO);
ADS79xx_Obj[Inst].ADS79xx_TransmitBuffer |= ADS79xx_GPIO_OUT(ConfigPtr->GPIO);

  switch(ConfigPtr->OperationMode)
    {
         case MANUAL:
             ADS79xx_Obj[Inst].ADS79xx_TransmitBuffer |= ADS79xx_CHANNEL(CH0);
             break;
         case AUTO1:
         case AUTO2:
             ADS79xx_Obj[Inst].ADS79xx_TransmitBuffer |= ADS79xx_RESET_CTR(RESET);
             break;
         default:
             ADS79xx_Obj[Inst].ADS79xx_TransmitBuffer = 0x0000;
             retVal = E_NOT_OK;
             break;
     }
   
  retVal |= Spi_SetupEB(ConfigPtr->SpiTxChannel, (Spi_DataBufferType*)&ADS79xx_Obj[Inst].ADS79xx_TransmitBuffer, (Spi_DataBufferType*)&ADS79xx_Obj[Inst].ADS79xx_ReceiveBuffer, 2u);
  if(retVal == E_OK) retVal |= Spi_SetupEB(ConfigPtr->SpiRxChannel, (Spi_DataBufferType*)&ADS79xx_Obj[Inst].ADS79xx_TransmitBuffer, (Spi_DataBufferType*)&ADS79xx_Obj[Inst].ADS79xx_ReceiveBuffer, 2u);

  //TODO: Send sth to verify SPI communication first
  if(retVal == E_OK) retVal |= Spi_SyncTransmit((Spi_SequenceType) Inst);
   
     
/*--------------------------------------------*/
  • Hi efe,

    Welcome to our e2e forum!  Can you please supplement the code above with screen shots (logic analyzer or o'scope) showing what you are transmitting in each frame?

  • Hi ,

    Thank you for your response. It may take some time for me to capture transmitted frames so in the meanwhile you can see my transmitted frames below.

    /*ALARM SETUP */

    //Frame 1 

    Transmit_Buffer = 0xD000 ;  // (1101 000 000 000 -> GROUP1,) 

         //sync_send(Transmit_Buffer);

    //Frame 2

    Transmit_Buffer = 0x7000;   // (0111 xx00 0000 0000 ->  CH5, High Alarm, Exit, (Treshold = 0) ) // Just programming high alarm for group1 , ch5  for observing alarm.

         //sync_send(Transmit_Buffer);

    /* GPIO SETUP */

    Transmit_Buffer = 0x402F ; // ( 0100 0000 0010 1111 -> GPIO programming, normal operation, GPIO0 as high alarm , all gpıo as output )

        //sync_send(Transmit_Buffer);

    /* MANUAL MODE */

    Transmit_Buffer = 0x1840 ; // ( 0001 1000 0100 0000 -> Manual mode , enable programing bits, default ch 0 in next frame , 2xVref range , normal op. , output current channel )

    //end of initialization.

    After initiliazing device with configuration above I call my "get_value" routine periodically. I have "2" consecutive "sync_send" in my "get_value" routine because of the nature of "manual mode".

    With this configuration I am able to get correct readings for desired channels but cannot assert any alarm even the high alarm treshold is set to 0.

  • Thank you for the added detail, looking forward to your scope shots.

  • Hi, 

    You can find the scope shots below this message.

    SCOPE --->  Green : SCLK , Blue : MOSI , Red : MISO 

    This picture above is the "Init Stage" for the ADS7953 , as I explanied on my previous message , Im transmitting frames for  ALARM Setup -> GPIO Setup -> Manual Mode Setup.

    /* ALARM SETUP */

    /*FRAME 1 */

      

    /*FRAME 2*/

    /*GPIO SETUP*/

    /*MANUAL MODE */

    For periodic operation, I can get correct readings for a spesific channel as I mentioned before. Finally Im adding a scope shot from periodic operation.

    CH5 sampled in manual mode  -> Correct MISO data

  • What sort of filtering do you have on SDO?  Are these screen shots from the MCU end or the ADC end of the line?

  • I do not have any filter for SDO so the output screenshots are same on both sides.

  • OK, I was curious about the slower rise time of SDO, it seems like you have some sort of RC time constant there.  Have you simply tried sending 0xD000, 0x7000, 0x402E, 0x1840 (each transaction 1x, with /CS toggle in between) rather than sending each command 2X?