Hi,
I'm trying to get a 40X1 (not great condition, but I think the required pins are working) to communicate with this digital potentiometer (50K version) via spi.
I'm sure the digipot is powered up because I'm reading the expected 50K and 25K when so.
I'm not having any success communicating with it but I still have a lot of variables I'm unsure about. The current symptoms are that the chip just remains in the "midscale" position and I haven't been able to get it out of it.
Pages 5, 15 and 18 seem to have all the spi stuff. The digipot's spi interface involves:
Unfortunately, the datasheet seems to give no indication about how the "RES" pin is used (just try searching "res" or "reset"). This could be crucial because when it is "reset", the pot it put to midscale.
Also, I can't work out what the different spimodes are from the PICAXE manual 2. They come in two groups of four. Four with an "e" four without. I don't understand the difference between these two groups. The 4 modes in each group seem to be the permutations of whether the clock idles high or low, and whether the data is "clocked" on the rising or falling edge. Am I right in thinking this?
I'm sure the digipot wants rising edge clocking, but I don't know if it idles high or low. Seems to be low given the middle diagram on page 15. My current, very "exploritory" code is:
I've got my multimeter connected to the wiper and end terminal of RDAC 3 so A1=1 & A0=0 (page 18). I'm trying to send the data of zero so I think it should be %1000000000.
I also don't understand the 3rd diagram on page 15. I think I understand that the information it's trying to convey is that which I need, but I don't understand it.
Appologies if I've missed anything. Did some searching for spi stuff, but there's an aweful lot, and one thing I did pickup were some cases where the part to be interface with had picky requirements. I hope that isn't the case with this.
It would be great if a few of my unknowns could be confirmed one way or the other so that I can narrow down on specific problems. I could have made a mistake in my circuitry (breadboard) of course, but I've been at it for the day, checking and double checking and haven't had a single response. I'd really appriciate any advice.
Thanks in advance as always,
David.
I'm trying to get a 40X1 (not great condition, but I think the required pins are working) to communicate with this digital potentiometer (50K version) via spi.
I'm sure the digipot is powered up because I'm reading the expected 50K and 25K when so.
I'm not having any success communicating with it but I still have a lot of variables I'm unsure about. The current symptoms are that the chip just remains in the "midscale" position and I haven't been able to get it out of it.
Pages 5, 15 and 18 seem to have all the spi stuff. The digipot's spi interface involves:
Code:
DIS = digital inout select, tied low for spi mode
SDI = serial input, should this be tied to +/- with a resistor?
CLK = clock, same question, should this be tied?
CS = chip select, I've currently got tied high
RES = Reset, currently got tied low
SHDN = Shutdown, currently tied high as recommended
SDO = serial output, used to daisy-chain
Also, I can't work out what the different spimodes are from the PICAXE manual 2. They come in two groups of four. Four with an "e" four without. I don't understand the difference between these two groups. The 4 modes in each group seem to be the permutations of whether the clock idles high or low, and whether the data is "clocked" on the rising or falling edge. Am I right in thinking this?
I'm sure the digipot wants rising edge clocking, but I don't know if it idles high or low. Seems to be low given the middle diagram on page 15. My current, very "exploritory" code is:
Code:
setfreq k31 'helps see what's going on, but i've tried varying this
symbol cs = B.1 'chip select pin is tied high
high 0 ;experimenting with reset pin state (currently tied low)
'pause 1000
pulsout 2,200
pause 1 'got and LED on pin2 so I can see where I am in the program
pulsout 2,200
pause 10
hspisetup spimode00, spislow 'trying the different modes, only trying the 00 modes atm
gosub Send_data
'hspisetup spimode01, spifast
'gosub Send_data
'hspisetup spimode10, spifast
'gosub Send_data
'hspisetup spimode11, spifast
'gosub Send_data
hspisetup spimode00e, spislow
gosub Send_data
'hspisetup spimode01e, spifast
'gosub Send_data
'hspisetup spimode10e, spifast
'gosub Send_data
'hspisetup spimode11e, spifast
'gosub Send_data
end
Send_data:
low cs ; enable chip select
hspiout (%1000000000) ; data
'pause 100
high cs ; disable chip select
hspisetup OFF
pulsout 2,200
'pause 1000
return
I also don't understand the 3rd diagram on page 15. I think I understand that the information it's trying to convey is that which I need, but I don't understand it.
Appologies if I've missed anything. Did some searching for spi stuff, but there's an aweful lot, and one thing I did pickup were some cases where the part to be interface with had picky requirements. I hope that isn't the case with this.
It would be great if a few of my unknowns could be confirmed one way or the other so that I can narrow down on specific problems. I could have made a mistake in my circuitry (breadboard) of course, but I've been at it for the day, checking and double checking and haven't had a single response. I'd really appriciate any advice.
Thanks in advance as always,
David.