SPI trouble on scratch-built "arduino"

Hi everyone,

So, Ive built a "final" version of a midi to CV circuit on proto breadboard and I am having trouble with the SPI communication between the Atmega and the DAC. Individually, the arduino part of the circuit appears to work perfectly: it is receiving Midi messages, flashing the appropriate led, etc and Ive successfully ran a few other test sketches like "blink." i did some basic testing with a multimeter, all the connections are good and wired correctly. The Dac seem to be getting something (voltage flickers with startup routine and midi keypress) but I assume it is garbled- the Dac doesnt respond.

To test the DAC and my layout, I removed the atmega chip , put it in a "real" arduino board, and then patched the arduino pin-outs back to the appropriate pin of the protoboard socket: arduino RX to socket pin 2; arduino pin3 to socket pin 5; 5v(from the protoboard power supply) to arduino 5v; etc. When running through an arduino and patched to the protboard, it works everytime. All connections are going through the same points on the protoboard, just with a mess of jumper wires added. I would assume that this would only add "noise" to the circuit, not reduce it... so I think that it is safe to assume that the arduino board is doing somthing that the scrath built versions lack.

Power filtration? Ive doubled up on the powersupply filter caps, have 100n across the rails of both the dac and the atmega. Could power supply noise still be a problem?

Furthermore I rebuilt a new "arduino" on a solderless board, and again while it run sketches, I cannot get the SPI to work. Only when connected to an uno or duemilanove does it run properly.

the only other difference( I can think of) between my circuit and the arduino board is when in the arduino, the atmega is using the on board crystal /cap resonator circuit, while I have single resonator components. I would think this would make not a difference, especially since the atmega appears to work.

Please, I am totally out of ideas and have gone through all the "SPI noise" or troubleshooting threads i could find. I havent tried pull-up resistors yet, but have never need them with this circuit before.

Any ideas or thoughts are greatly appreciated. thanks in advance.

Since your clone doesn't work, we have to assume that you don't have it wired properly. We really need to see schematics of the scratch-built clone to see what might be a problem. I would be looking at AREF and AGND.

To double check the ATMEGA and its program, have you swapped the IC from the working Arduino to the clone. I doubt it help, but it is a quick and easy test.

Yeah, I have tried different atmega chips with the same results. The arduino clone does work, just not SPI.

Here are the "arduino" circuit schematics Ive been using: http://tinkerlog.com/2008/01/07/arduino-on-a-prototype-board/ and http://www.ladyada.net/images/boarduino/boarduinosch.png I didnt include the serial connections- just the power supply, atmega, reset, and the resonator. Ive built a few of these for other arduino based circuits. All have worked well, though they didnt use SPI.

AGND is connected to gnd AREF? I am curious what to do with this. The first schematic has it connected to 5v, though the second has it connected to nothing. I've tried both ways, even trying an external 5v ref (i read to try it somewhere), -none of it made a difference. Ive never need to connect it before. Any ideas?


AREF can be connected to a voltage reference or not, if not then the internal ref will be used and in this case it's common to decouple the AREF pin becuase it is connected directly to the internal reference.

Still I can't see how that would have any bearing on an SPI problem.

You haven't posted the SPI circuit you're using, the DAC type or the source code.


Sorry, Here is a link to the whole project:http://registeringdomainnamesismorefunthandoingrealwork.com/blogs/?p=51

and the sketch is kinda long so Ill just post a link: http://registeringdomainnamesismorefunthandoingrealwork.com/blogs/wp-content/uploads/2009/01/midi_dac_v11.pde

The DAC is an AD5668 - 16 bit with 8 outputs. Heres the datasheet: http://www.analog.com/static/imported-files/data_sheets/AD5628_5648_5668.pdf

I have the bypass caps that the DAC datasheet recommends as well as 100n across the VCC and GND for the atmega. Even added it to the AGND and AVCC. Doubled the filter caps on the power supply. Anthing else I can do to reduce noise?

Ill post some images of my layout soon.

Since you've tested the same ATmega on an Arduino board and the prototype board I would suspect you have a short on the prototype board, or some problem with the IC socket - double check the continuity from IC legs to the SPI header and check for shorts everywhere. Look for dry solder joints too. Check each chip is getting power!

If you can hook up a 'scope onto the SPI pins do it...