Post Go back to editing

How can we Differentiate between Dout/RDY pin. ? (Part number : ad7124-4) How can we handle interrupt. on Dout/RDY pin?

Category: Hardware
Product Number: ad7124-4

Part number : AD7124-4

I'm testing a code using Nucleo-L476RG and an analog-to-digital converter. This ADC uses SPI communication and shares its RDY (end of conversion) and DOUT functions on the same pin, that is, after reading the converted data on the pin, it becomes an RDY pin and can drive an external interrupt on the microcontroller.

My question is: how can I enable the External Interrupt event on a pin already configurated as MISO of SPI 

Since both the functionality relays on 1 common pin,  

If you have an, example code on Interrupt it will be useful for us to move further 



moved,updated form and tagged
[edited by: GenevaCooper at 2:51 PM (GMT -4) on 28 Aug 2023]
  • ADI North America will be on summer shutdown starting August 24, 2023; perhaps another community member can assist you until our return on September 5th.
  • Hi ,

    Haven't used Nucleo boards, but would assume that you could monitor the MISO signal with a generic GPIO connected parallel to the MISO, that is capable to generate edge triggered interrupts

    Cheers, heke

  • Here is the code I use on nucleo-G474re to read AD7124-4 (arduino IDE):

    uint32_t get_data(void)
    {
      static  uint8_t   rx[8]   = { 0};
      static  uint8_t   tx[8]   = { 0};
              uint32_t  resultat  =  0;
    
              uint8_t   head = 0;
              uint8_t   size_reg;
          
        // head |= address_spi;    
        head |= 0x02;   // data reg. = 2
        head |= 0x40;   // read
    
        if(debug_osm == 2) {
          Serial.print(F("\n\thead: "));
          Serial.print(head, BIN);
          }
    
        tx[0] = head;
    
        detachInterrupt( 29);
        
          SPI.transfer(CS_PIN1, tx, rx, 5, SPI_LAST); 
     
        HAL_GPIO_WritePin(GPIOA, GPIO_PIN_15, GPIO_PIN_RESET);
        delayMicroseconds(10);
        attachInterrupt( 29, data_contread, FALLING); // PD2
    
          resultat  |= rx[4];
          resultat  <<= 8;
          resultat  |= rx[1];
          resultat  <<= 8;
          resultat  |= rx[2];
          resultat  <<= 8;
          resultat  |= rx[3];
        
      return resultat;
    }
    

    There is no issue to switch interrupt of before SPI transaction takes place, you can use HAL driver for this.

  • Hi  ,

    Apologies for missing the thread. In a case where the DOUT/RDY is shared with the MISO pin, you may connect the MISO pin to an Arduino pin via a jumper (say D8 for example) and make D8 as the source of interrupt. This was done with AD717x example code; it uses a different ADC but it can be used as a reference along with AD7124 example codes to generate their code specific for AD7124.

    You may refer to this link AD717x IIO Application [Analog Devices Wiki] or visit the AD7175-8 and AD7124-4 product page for your reference. 

      

    Thanks and regards,

    Rod