So I am trying to use a AD5293 digipot but what ever I do I cant get the wiper to update, and i think I have looked at every post I can find online about it but still cant fix my issue, I am using the Pi Pico microcontroller.
I have a couple of questions, in the datasheet it says it needs a 1uF capacitor on exit_cap pin to ground. I made a mistake in my design and have the other end of this cap connected to 15V as shown in schematic below. Would this kill the digipot or would it still be fine, I have now bodged this so that it is wired correctly.
Also when I am sending my SPI data I am using SPI Mode 1 and I first send hex value 0x1802 to enable control through digital interface, and then I send 0x500 in a while 1 loop, as the data sheet says this should move wiper to 1/4 full scale. (I also toggle the CS pins when needed and have a small delay between transfers)
Here is my measured waveform for 0x500
Any help would be greatly appreciate.
Thanks,
Dean
Edit: forgot to add that Yellow is TX Data, Blue is Clock and Purple is CS
Sorry I literally just figured out the problem, which was the exit cap pin I had 15V connected to one end of the capacitor instead of ground which killed the chip as I replaced it and now seems to be working. Thanks for the reply though
I looked at the datasheet but couldn't see for sure that doing what you did would be a Very Bad Idea, so consider that you have provided a service by performing the experiment.
@alto777 After doing a bit more testing I found that my output from the digipot is only about 3V when it should be 3.6 do you have any idea why this might be. The value I am sending over SPI is 00 0001 1111111111. As first 2 bits are always 0 then the next for is C3-C0 which I have as 0001 to write to the RDAC register, then all ones for max output value. Am i doing something wrong here?
sure but it is using the Pi Pico c++ sdk, so not sure if thats allowed here. I mainly asked here for the hardware issue.
#include <iostream>
#include <stdio.h>
#include <string.h>
#include "pico/stdlib.h"
#include "hardware/spi.h"
//----------SPI Init----------
#define SPI_Port_Dig_Pot spi0
#define CS_HV 5
#define MOSI_HV 3
#define SCK 2
//----------------------------
void SPI_Setup(){
spi_init(SPI_Port_Dig_Pot, 5000000); //init spi port to run at 5MHz, chosen as doesnt need to run any faster
//and is 10x lower than the max the dig pot can support
//-------CS for all setup-------
gpio_init(CS_HV);
gpio_set_dir(CS_HV, GPIO_OUT);
gpio_put(CS_HV, 1);
//------------------------------
gpio_set_function(SCK, GPIO_FUNC_SPI);
gpio_set_function(MOSI_HV, GPIO_FUNC_SPI);
spi_set_format(SPI_Port_Dig_Pot, 16, SPI_CPOL_0, SPI_CPHA_1, SPI_MSB_FIRST); //sets 16 bit length, SPI Mode 1, MSB First and which SPI Instance
}
int main(){
stdio_init_all();
SPI_Setup();
uint16_t spi_buffer[1];
uint16_t spi_buffer1[1];
uint16_t spi_buffer2[1];
spi_buffer[0] = 6146; //0x1802 to enable digital interface
spi_buffer2[0] = 2047; //0x7FF value I want to send with C0 set to 1 for RDAC write
gpio_put(CS_HV, false);
spi_write16_blocking(SPI_Port_Dig_Pot, spi_buffer, 1);
gpio_put(CS_HV, true);
busy_wait_us(0.1);
while(1){
gpio_put(CS_HV, false);
spi_write16_blocking(SPI_Port_Dig_Pot, spi_buffer2, 1); //0X7FF should be full scale (all data bits are 1 and C0 = 1)
gpio_put(CS_HV, true);
busy_wait_us(0.1);
}
}
I dont think the lower output voltage would be to do with the code but is shown above. I did read online somewhere that sometimes if the analogue supply isnt a high enough voltage this can decrease range so maybe this is an issue but unsure.
Vdd = +15V is plenty for 3.6V.
Is 0.1us valid for busy_wait_us?
Just for debug I would set the clock to 1MHz, put a busy_wait_us(10) after the gpio_put(CS_HV, false) and after the CS_HC, true.