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\$
4
  • 2
    \$\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, 2021 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, 2021 at 8:25
  • 2
    \$\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, 2021 at 12:33
  • \$\begingroup\$ Did this go anywhere? Did you discover that a combination of adding a *RESET pullup resistor (and a matching filter capacitor) and fixing your firmware fixed the problem? I trust you have a filter capacitor for VCC, right next to the microcontroller, too... \$\endgroup\$ Aug 26, 2022 at 17:51

2 Answers 2

-1
\$\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
  • 1
    \$\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, 2021 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, 2021 at 18:06
  • 1
    \$\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, 2021 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, 2021 at 18:13
  • 1
    \$\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, 2021 at 12:30
-1
\$\begingroup\$

The P-MOSFETs (Q1, Q5, Q8) are connected wrong (Drain at +12V instead of Source).

Their internal diode (which is not shown in the P-MOSFET symbols you are using) is forward biased, i.e. always on:

enter image description here

Note: Source and Drain are NOT interchangeable. Source is the terminal shown closer to the Gate. To avoid this mistake I recommend using a MOSFET symbol that shows the internal diodes.

\$\endgroup\$
2
  • \$\begingroup\$ While this is true, it does not address the question at all. \$\endgroup\$
    – brhans
    Jun 23, 2023 at 11:40
  • \$\begingroup\$ How do you know? It addresses the question very well! Since OP's description of the problem is so unspecific and OP even suspects that pull-down resistors R5, R15, R25 may have something to do with the problem, it can be assumed that the problem is that outputs are always on (+12V); in any case it is an issue that needs to be fixed; if the outputs are always on it doesn't make sense to spend a second looking at the rest of the circuit. \$\endgroup\$
    – Curd
    Jun 23, 2023 at 18:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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