0
\$\begingroup\$

I'm using Arduino to control a digital potentiometer via SPI. I can set the resistor values, but I wonder,
1- Can I read the resistor value also via the same SPI interface?
Here is the data sheet of AD8403. I've looked over it but couldn't find related information. There is also a SDO pin on AD8403 which I think is for daisy-chaining.

2- I'm actually using a Java app to send the resistor values to arduino and then to AD8403. I want to know if the values are set. Therefore, I can either reply to Java that Arduino sent the command to digital pot OR I can fetch the values of digital pot directly and have the arduino reply to java that " Yeah, I've asked AD8403 and it's set to your desired values". Isn't this second approach more robust? What is the standard in industry here?

\$\endgroup\$
1
\$\begingroup\$

The SDO pin on these devices is only for daisy-chaining, they are write-only.

Reading back the SDO pin concurrently via SPI is the best you can do with this IC, and it will tell you that at least the data input part is working. But you can't read back what is actually in the individual registers. Knowing that the data gets shifted through gives you a lot of confidence that the IC is working, just not 100%.

There may be other types of digi-pot that can read back the resistor registers over SPI. However, reading back the pot registers still won't give you 100% confidence that the IC is presenting the right resistance at its terminals.

Bear in mind what sort of failures tend to happen to ICs, it's very unusual for an internal fault to develop, it's much more likely to be voltage stress on the pins killing the I/O. If your digi-pot IC had passed its functional test (and even reading back the resistor data registers themselves is inadequate for this, the functional test would have to make sure the resistors were working), then reading the pass-through data from the input logic verifies that the chip has power, its input register is behaving, and therefore that it's overwhelmingly likely that the rest of it is working.

Reading individual registers is important for debugging the controller software, and checking the synchronisation of data between the controller and its peripherals. One might argue that once the software is working, this test becomes less relevant. However, it makes possible automatic regression testing of the software, which is more or less important depending on your industry, aerospace or media players respectively.

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ So in non-critical applications, it is not necessary for the master to assure itself that slave is updated, right? \$\endgroup\$ – Zeta.Investigator Jan 29 '17 at 8:19
  • 1
    \$\begingroup\$ You decide what's critical, and how much reassurance you need that the IC is doing what you ask. There is no way to be 100% sure without disconnecting the load and measuring the resistance. Generally a chip will work totally, or be dead, so knowing the the input register is shifting data through is a very good sign indeed. \$\endgroup\$ – Neil_UK Jan 29 '17 at 9:06
1
\$\begingroup\$

I have used quite a few of these, and if you look on page 3, you will find this statement:

The reset (RS) pin forces the wiper to midscale by loading 80H into the VR latch.

So provided you are generating a reset pulse at startup, the initial condition is always known.

For critical applications, I usually buffer the voltage from a divider (of which this digipot would form a part in the majority of applications) and run it to an ADC where I can read the resultant voltage; that lets me know that the wiper has indeed achieved the requested position.

Note that the first thing I usually do in these applications is read the reset voltage (which gives me some confidence that the pot and other circuitry is properly functional).

Sometimes I do need to scale the voltage to meet the ADC input requirements.

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ Clever solution.Thank you. I always find myself searching the net over these issues, since I fear if I come up with a creative solution like yours, it would not be the "standard approach" or "the-way-it-is-done-in-industry". Am I on the right track or not? \$\endgroup\$ – Zeta.Investigator Jan 29 '17 at 12:48
  • \$\begingroup\$ Every situation has its own pros and cons to the various approaches; I have used this technique numerous times and it works in most situations (where it is not appropriate there are other methods) \$\endgroup\$ – Peter Smith Jan 29 '17 at 13:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.