Post Go back to editing

How to use AD7998 with BeagleBone

Hello,

I use the AD7998BRUZ-0 with a BeagleBone Black  via I2C and want to read a simple battery-value via V_in_1-Pin.

But I don't know how to configure the control register with shell-commando "i2cset". To get the digital value a have to configure the control register for the next conversion signal but I don't know how.

Thanks!

Parents
  • Hi Tigerclaw,

         First, where did the AS pin was connected? If it is AGND, then the I2C bus address is 010 0001 while if connected to VDD address will be 010 0010. Refer to table 6 of the datasheet.

         In the I2C interface it will start with a start command then followed by the bus address for the first 7 SCL clock cycles, the 8th cycle will tell if the next command is a write or read. I can see that you are writing 0x22. If this is the bus address with AS pin connected to VDD, then 0x44 should be the first which means AD7998-0 address at AS connected to VDD and the next command is a write command.

         In the second set after a write command was sent, it will be acknowledge on the 9th clock by the AD7998, on the next 8 clock cycles, need to write the address pointer. This time we need to configure first the ADC for the preference we want. We will write 0x02 to point to Config register.  The configure register is a 16 bit long. In writing we'll refer to figure 28 ( 2byte write sequence).  After the write it will be acknowledge again by the AD7998. This a 2 byte write, please refer to table 9 for function of each bit. If channel 1 is the only preferred channel  and alert are disable, so the next 8 clock cycles will be 0x00 ->acknowledge then another 8 clock cycles  write 0x18, ch1 enable and filter enable. Then a stop command will be initiated.

         The next will be reading ADC result (fig 26) . But first it needs to initiate conversion. So the /CS will go high during power up for at least 1us. A falling edge will initiate conversion. When the conversion is complete, approximately 2us, I2C interface can start again by writing the bus address and write command followed by address pointer conversion result, 0x44( address bus + write) acknowledge then write the address pointer for conversion result which 0x00 (Conversion result register) followed by stop command.

         The next will be reading result (fig. 30). a start command must be initiated, then address bus + read (0x45). An acknowledge from AD7998 then 2 byte read of the data result will follow. Table 13 details the 16 bit description of the conversion result register. Below is the summary.

    Write to config reg(ch1 en)  =>  Bus address + Write (0x44)--> Address pointer (Config reg 0x02)--> Config Reg(0x18) - fig 28

    Write to adrees pointer for read => Bus address + Write (0x44)--> Address pointer (conversion result 0x00) fig. 26

    Read Conversion =>   Bus address + read ( 0x45) --> 16 bit conversion result  fig. 30

    Regards,

    Jonathan

Reply
  • Hi Tigerclaw,

         First, where did the AS pin was connected? If it is AGND, then the I2C bus address is 010 0001 while if connected to VDD address will be 010 0010. Refer to table 6 of the datasheet.

         In the I2C interface it will start with a start command then followed by the bus address for the first 7 SCL clock cycles, the 8th cycle will tell if the next command is a write or read. I can see that you are writing 0x22. If this is the bus address with AS pin connected to VDD, then 0x44 should be the first which means AD7998-0 address at AS connected to VDD and the next command is a write command.

         In the second set after a write command was sent, it will be acknowledge on the 9th clock by the AD7998, on the next 8 clock cycles, need to write the address pointer. This time we need to configure first the ADC for the preference we want. We will write 0x02 to point to Config register.  The configure register is a 16 bit long. In writing we'll refer to figure 28 ( 2byte write sequence).  After the write it will be acknowledge again by the AD7998. This a 2 byte write, please refer to table 9 for function of each bit. If channel 1 is the only preferred channel  and alert are disable, so the next 8 clock cycles will be 0x00 ->acknowledge then another 8 clock cycles  write 0x18, ch1 enable and filter enable. Then a stop command will be initiated.

         The next will be reading ADC result (fig 26) . But first it needs to initiate conversion. So the /CS will go high during power up for at least 1us. A falling edge will initiate conversion. When the conversion is complete, approximately 2us, I2C interface can start again by writing the bus address and write command followed by address pointer conversion result, 0x44( address bus + write) acknowledge then write the address pointer for conversion result which 0x00 (Conversion result register) followed by stop command.

         The next will be reading result (fig. 30). a start command must be initiated, then address bus + read (0x45). An acknowledge from AD7998 then 2 byte read of the data result will follow. Table 13 details the 16 bit description of the conversion result register. Below is the summary.

    Write to config reg(ch1 en)  =>  Bus address + Write (0x44)--> Address pointer (Config reg 0x02)--> Config Reg(0x18) - fig 28

    Write to adrees pointer for read => Bus address + Write (0x44)--> Address pointer (conversion result 0x00) fig. 26

    Read Conversion =>   Bus address + read ( 0x45) --> 16 bit conversion result  fig. 30

    Regards,

    Jonathan

Children
No Data