0
\$\begingroup\$

I've designed a custom PCB that I'm trying to program through ICSP using AVRISP mkII and I've run into some issues. I'm using Arduino IDE for programming, but I don't think this is relevant. The IDE says that the programming was successful, but the program does not run. I've tried with a few different programs using different pins, all with no luck. I had a different PCB before for the same application and it worked fine. In the second version of the PCB I used more pins on the CPU and thus needed to use the programming pins as GPIOs as well. I have some pull-down resistors on those lines, because they are driving MOSFETs. I suspect these resistors are the problem, but I haven't tried removing them since they are 0402 size and will be hard to solder back on in case I'm wrong. Am I right to think the pull-down resistors are the issue? Is there anything else I've missed?

Here are the schematics where you can see the exact connections. Processor side

MOSFET side

I'll be grateful for any help I receive.

\$\endgroup\$
3
  • \$\begingroup\$ You nerd a pullup at the reset pin, probably that's the issue. Using the SPI pins for different purposes always worked for me, I see no problem \$\endgroup\$
    – Sim Son
    Mar 26 at 17:56
  • \$\begingroup\$ In the previous PCB I also didn't have a pullup on the reset pin and it worked just fine, so I'm not sure that's the issue. \$\endgroup\$
    – Cezerb
    Mar 27 at 8:25
  • \$\begingroup\$ You may be lucky without a pullup, but you shouldn't rely on it, as the reset pin is pretty essential. IdK which package you use, but adding a 10k pullup may be easy to add to see if that brings any change. \$\endgroup\$
    – Sim Son
    Mar 28 at 12:33
0
\$\begingroup\$

Sorry to say that you are right the problem is with your pulled-down resistors on programming pins. As see in the picture there are mainly 6 pins required for programming Vcc, Gnd, RST, SCK, MISO, MOSI.

enter image description here

I have faced a similar kind of problem once I have designed a PCB based on ATmega328p and its job was to control few stepper motors and for homing the motor I have used limit switches and back then I have added one of the limits switches to PB4 (MISO) pin of MCU and was using internal pullup for the switch.

So all have tested my PCB all was working well and once while I was programming the limit switch on MISO pin was pressed hence connected to ground then no matter how hard I try to program It was not even detecting my MCU. was using a UABASP to program after 6 hr of debugging I accidentally noted that its due to a switch and after releasing switch to open state all worked well.

So you can try removing the resistor first from MISO and if it worked then great else get ready to remove 2 more resistors and your problem should be fixed after removing 3 resistors.

Also, it's good to have an onboard pull-up resistor on the reset pin.

Last I can see there is a difference in connection that you provided to your ICSP connector than the standards as in the image so hope you have done that intentionally.

\$\endgroup\$
5
  • \$\begingroup\$ You're describing a different thing: you shorted the SPI pins to ground which makes communication impossible, of course (and can harm your programmer if it isn't protected by some resistance). But using those pins, be it as output or input, should be no problem \$\endgroup\$
    – Sim Son
    Mar 26 at 18:01
  • \$\begingroup\$ it's the same pins that cezerb is using for programming see the schematic he had uploaded pin PB5-SCK, PB4-MISO, PB-3-MOSI. \$\endgroup\$
    – dharmik
    Mar 26 at 18:06
  • \$\begingroup\$ It's fine to use those pins like in the schematic. The only problem I see is the missing pullup on RESET. \$\endgroup\$
    – Sim Son
    Mar 26 at 18:09
  • \$\begingroup\$ are you not able to see that pins are going to the ICSP programming connector?. And the same way all pins are pulled down with a resistor in a red square box. \$\endgroup\$
    – dharmik
    Mar 26 at 18:13
  • \$\begingroup\$ And what I'm saying is that this is no problem. SPI is not affected by pullup/down resistors as it is a push-pull signal. \$\endgroup\$
    – Sim Son
    Mar 28 at 12:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.