Problem communicating over SPI

Hi
I have a bunch of boards (own design) with which I’m not able to communicate using SPI at all. So unable to burn a bootloader. No comms using a mega as a programmer or using an AVR Dragon.

there is continuity (< 2Ohms) between the mega/dragon pins and the mosi/miso/sck of the target. Reset on the target connected to pin 10 on the mega and the reset pin on the ISP connectors on the avr dragon.

reset on the target pulled up to VCC via 10kOhm.

tried 8 boards … all the same.

I’m quite sure that I’m missing something terribly obvious though! Any pointers gratefully received.

some notes:
the schematic is below.
the intent is to run this board at about 2.6v using the internal oscillator only.
you’ll see that the thermistor signal is both seemingly pulled up and pulled down. this is to allow a digital sensor or a thermistor to be used. in practice I am using only a thermistor so just the pull down (R7) is installed. U1 is not present, the VCC and thermistor holes are used for the thermistor.
I have tried the boards with and without the radio module installed.

It would help everyone if you posted your full error message.
I get the following error when I try to burn a Bootloader to a chip that already has the fuses set for 16MHz external crystal and the crystal is removed.
Any chance your chips have already been bootlooded and set for an external crystal?

Arduino: 1.8.9 (Linux), Board: "ATmega328, Yes (UART0), 328P / 328PA, 2.7v, LTO disabled, 16 MHz external"

/home/kprims/ken/Downloads/arduino-1.8.9/hardware/tools/avr/bin/avrdude -C/home/kprims/.arduino15/packages/MiniCore/hardware/avr/2.0.2/avrdude.conf -v -patmega328p -carduino -P/dev/ttyUSB0 -b19200 -e -Ulock:w:0x3f:m -Uefuse:w:0b11111101:m -Uhfuse:w:0xd6:m -Ulfuse:w:0b11110111:m 

avrdude: Version 6.3-20171130
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "/home/kprims/.arduino15/packages/MiniCore/hardware/avr/2.0.2/avrdude.conf"
         User configuration file is "/home/kprims/.avrduderc"
         User configuration file does not exist or is not a regular file, skipping

         Using Port                    : /dev/ttyUSB0
         Using Programmer              : arduino
         Overriding Baud Rate          : 19200
         AVR Part                      : ATmega328P
         Chip Erase delay              : 9000 us
         PAGEL                         : PD7
         BS2                           : PC2
         RESET disposition             : dedicated
         RETRY pulse                   : SCK
         serial program mode           : yes
         parallel program mode         : yes
         Timeout                       : 200
         StabDelay                     : 100
         CmdexeDelay                   : 25
         SyncLoops                     : 32
         ByteDelay                     : 0
         PollIndex                     : 3
         PollValue                     : 0x53
         Memory Detail                 :

                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           eeprom        65    20     4    0 no       1024    4      0  3600  3600 0xff 0xff
           flash         65     6   128    0 yes     32768  128    256  4500  4500 0xff 0xff
           lfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           hfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           efuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           lock           0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00
           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00

         Programmer Type : Arduino
         Description     : Arduino
         Hardware Version: 2
         Firmware Version: 1.18
         Topcard         : Unknown
         Vtarget         : 0.0 V
         Varef           : 0.0 V
         Oscillator      : Off
         SCK period      : 0.1 us

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.01s

avrdude: Device signature = 0x000000 (retrying)

Reading | ################################################## | 100% 0.01s

avrdude: Device signature = 0x000000 (retrying)

Error while burning bootloader.
Reading | ################################################## | 100% 0.01s

avrdude: Device signature = 0x000000
avrdude: Yikes!  Invalid device signature.
         Double check connections and try again, or use -F to override
         this check.


avrdude done.  Thank you.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

in Atmel Studio I receive the “got 0xC0 expected 0xC0 message”. When using a mega as an ISP I use Nick Gammon’s firmware which just does not report having found a chip to programme.

I’ve now tried ten different 328ps including two on an entirely bare board that I had made just for the purposes of debugging SPI connection with the atmega328 and mega (just the tqfp pads, a SPI connector and the pullup plus facility for the crystal and loads). Even on those I get nothing.

I thought that there might be issues with the chips being bootloaded or lock-bit’ted but they are supposedly from the factory and i’m not getting anything back, whereas I’d expect at least something!

I’m very much hoping it’s not a batch of 40 dead avrs.

I believe your schematic is irregular. It is to me, anyway. It does not show clearly where each of the 32 pins is connected, since there are only 30 pins depicted, and some of the pins have weird labels. Perhaps you could upload a photo of the board, and show where you are connecting each of the programmer pins. Somebody here may be able to see something you don't see, it may be a matter of putting another set of eyes on it.

Thanks. I think this is the sparkfun library version of the 328p.

All pins are shown. You'll see that both gnd and vcc are *2.

I won't be back at my lab until Thursday so can't take a photo. I can post the board view though. In any event, as said, there is continuity end to end from each of the spi pins to the mega/dragon.

There are reports of atmel studio not behaving itself with versions after 5.x. So that may be a cause. But doesn't explain the problems using a mega as an ISP.

I suspect a dead batch of avrs. I will find an old nano and take the chip off that to test on Thursday.

OK. Sounds like a good plan, take a known good IC and try it in your circuit. The *2 means nothing to me, it is just 2 characters. It just as easily could be &^. If I don't see the actual pin numbers and a wire connecting the 2 of them, it is irregular. It is a bad library version of the part. Thanks to Sparkfun for that, I guess.

now attached are the board views of the two boards I have been using to test these 328p-au’s

the longer board has a ground plane on both faces which I am not showing in the photo to make it easier to see the traces. The routing on that board is, I know, amateur at best. But as I said, there is end-to-end connectivity on all SPI, power and reset pins.

on the bare programming board I have tried with and without a 16Mhz crystal (I didn’t have 22pF loads to hand so used 33pF. I do not think that would make a difference).

When you fix the initial problem, you will need a pull up resistor on the RF12B CS line, if you want to program with it in place.

@smet yes indeed! an omission but hopefully not fatal as I'd intend to install a bootloader onto the chip.

looking forward to debugging this further when I get back.