going crazy, again... ;-)

Every have one of those weeks...

I am working on the next model for the color reader. This time, I decided to have someone else build and assemble the boards, added a few parts (to do optical feedback...) and sent off the files, and got boards back. So far have 'only' found about five show stopper bugs on that board... :-(

Each error has required a blue wire fix, but now I have run into something that is driving me crazy! I have two digital pots on the board, sharing an SPI bus. One of the pots, just a volume control for the voice, is working. The other dual digpot, for adjusting the gain on the photosensors are not. I have verified the commands going in using the oscope, verified all the setups, tried different combination of commands on the pins, and they STILL won't respond. Same commands work just fine on the other pot. Boy, my forehead is getting sore from that brick wall.

Charlie

Reply to
Charlie E.
Loading thread data ...

What does "won't respond" mean? Have you really verified the hook-up (AND your concept of controlling the photosensor gain)? ...Jim Thompson

--
| James E.Thompson, CTO                            |    mens     |
| Analog Innovations, Inc.                         |     et      |
| Analog/Mixed-Signal ASIC's and Discrete Systems  |    manus    |
| Phoenix, Arizona  85048    Skype: Contacts Only  |             |
| Voice:(480)460-2350  Fax: Available upon request |  Brass Rat  |
| E-mail Icon at http://www.analog-innovations.com |    1962     |
             
I love to cook with wine.     Sometimes I even put it in the food.
Reply to
Jim Thompson

"Jim Thompson" wrote in message news: snipped-for-privacy@4ax.com...

Maybe it's just the port state that the SPI routines leave the port in. (If its bit-banged) Does the Pot work if you swap which pot is read/written to first?

Cheers

Reply to
Martin Riddle

Oh, I wish...

Basically, photosensor (ambient light sensor phototransistor) dumps into 1K resistor to convert photocurrent to voltage. Non-inverting opamp stage uses digpot to set gain, output goes to ADC through a lowpass filter. Basically, the same as on the original color reader. Basic difference - added a second PS in the direct light path to measure LED output, so I used a dual opamp and dual pot to provide a direct calibration channel and a reflected signal channel. Using the hardware SPI port on the PIC24FJ256 to communicate with it.

Problem - send command to set a value, say 64, and the output resistances never change. Basically, the pot stays in the mid-point default position no matter what commands I send to it. I also can't seem to be able to get a read out of it, either!

Very frustrating!

Charlie

Reply to
Charlie E.

Do both pots have the same timing and SPI clock setup? Double check the data sheets against each other.

--
Chisolm
Republic of Texas
Reply to
Joe Chisolm

They should, they both are of the same family of Microchip parts, the

4251 (dual) and 4161 (single).

Charlie

Reply to
Charlie E.

Well, looking at your code you posted on Microchip the Set1_PGA wont work. You are sending 0x01 as the address which decodes to: wiper 0, write, D9=0, D8=1 I think you need 0x10

--
Chisolm
Republic of Texas
Reply to
Joe Chisolm

From the data sheet it sound like the one pot is in shutdown. Is the shutdown pin grounded? Check your TCON reg and make sure the pot is not tied to the shutdown pin.

Cheers

Reply to
Martin Riddle

Ok, a little follow up. I got one of the pots to work! YAAAAHHHH!!!

How? Not really sure. Apparently, my code that worked just fine with one pot was somehow not working properly on the other. The CS line was going back high too early, so I needed to add a wait in my code to hold it low a little longer to allow the data to all get written. The other channel is still not responding, but in a different way. I suspect the ADC channel is not set up correctly, so will look into that as soon as I can get back to it. Designed a small audio system for the local water district, and drawing up all the contract documents right now...

Charlie

Reply to
Charlie E.

Thanks! Already found that one, though...

Reply to
Charlie E.

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.