0
\$\begingroup\$

I am completely out of my depth, and working on a gift for a friend. My assumption is that because I have literally no idea what I am doing, I missed a crucial step or connection.

I ordered chips with the attached wiring diagram. Following everything I can find online, I have been unable to use Arduino IDE to burn a bootloader to the chip.

This is the error I get in the IDE

         Using Port                    : usb
         Using Programmer              : usbasp
         AVR Part                      : ATmega328P
         Chip Erase delay              : 9000 us
         PAGEL                         : PD7
         BS2                           : PC2
         RESET disposition             : possible i/o
         RETRY pulse                   : SCK
         Serial program mode           : yes
         Parallel program mode         : yes
         Timeout                       : 200
         StabDelay                     : 100
         CmdexeDelay                   : 25
         SyncLoops                     : 32
         PollIndex                     : 3
         PollValue                     : 0x53
         Memory Detail                 :

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

         Programmer Type : usbasp
         Description     : USBasp ISP and TPI programmer
avrdude: auto set sck period (because given equals null)
avrdude usbasp_spi_set_sck_period() error: cannot set sck period; please check for usbasp firmware update
avrdude usbasp_spi_program_enable() error: program enable: target does not answer (0x01)
avrdude main() error: initialization failed, rc=-1
        - double check the connections and try again
        - use -B to set lower the bit clock frequency, e.g. -B 125kHz
        - use -F to override this check

avrdude done.  Thank you.

Again, my assumption is that because I have literally no idea what I am doing, I missed a crucial step or connection. My question is simply are these boards at all salvageable? Or am I SOL and -$50 Likely The worst schematic you have ever seen

I am using a USBASP v3.1 as the programmer, which is connected via pins on the board. I had all the pins originally directly connected to the corresponding pin on the programmer, but now I have the RST and VCC pins routed to a breadboard where I tried to pull the reset pin high by connecting it to VCC with a 10k resistor. (see second & third image)

enter image description here enter image description here

The intent was to turn the led's onboard on dependent on a comparison of 2 analog inputs. (ie turn the left one on if x > 0 & y <0.2 etc.)

I was originally trying to use the arduino ide to upload the sketch, not only because that is where I did my testing originally (on an arduino uno) but also because that was the only video I found on programming this chip.

\$\endgroup\$
4
  • 1
    \$\begingroup\$ There are no bypass caps on VCC. How is it connected, how long to the power supply (wire length), what kind of source? Pullup resistor on RST? How is the programmer connected to the board? \$\endgroup\$ Commented Oct 29, 2023 at 7:45
  • \$\begingroup\$ What programmer you have between PC and this board, how they are connected, how this board is connected? Also since you have the ISP connector to program anything, you don't need to program a bootloader. In fact, aren't you missing the UART pins on a connector so you could utilize the bootloader? Also the bootloader is likely to require a crystal and you don't have one, so burning the fuse bits after the bootloader means the chip expects a crystal so it will not communicate anything unless given a proper clock. So yes salvageable, but you need to tell what do you intend to do and how. \$\endgroup\$
    – Justme
    Commented Oct 29, 2023 at 8:37
  • \$\begingroup\$ @Justme Details added, see above \$\endgroup\$ Commented Oct 29, 2023 at 16:48
  • \$\begingroup\$ In order to use USBasp for a brand new MCU, you may need to put the USBasp in slow clock mode. usually a jumper is placed on the programmer board for this purpose. \$\endgroup\$ Commented Oct 29, 2023 at 16:53

1 Answer 1

0
\$\begingroup\$

At first glance it appears you are missing a pull-up on the reset signal. This may prevent operation and programming depending on how the programmer is designed. Though adding this on a breadboard should suffice for programming.

If you used the Arduino IDE to program the bootloader (Burn Bootloader option), then unless you selected a configuration that uses the internal RC oscillator, the burning process will have overridden the fuse settings to use an external crystal. If this has happened, you will not be able to program the board because there is no external crystal. The ISP interface requires a clock to work.

If the fuses are programmed for external crystal, you can usually recover from this by feeding in a 1-8MHz clock signal to the XTAL1 (PB6) pin, but as you haven't broken that pin out, soldering on a wire to it would be very tricky (it's the one next to the VCC pin). If you can't manage feed in an external clock, then there is no way to recover the chip without removing it from the board (there is HV programming, but on ATMega328 that is a parallel interface so would be more tricky than feeding in the clock).


You also need to modify the design anyway, you have not put any current limiting resistors in series with the LEDs. This will likely result in burned out LEDs or overloading of the ATMega IO pins depending on the VCC level. You could cut the existing traces and solder on SMD resistors over the cuts.

\$\endgroup\$
1
  • \$\begingroup\$ So in other words im SOL. I guess thats a $50 lesson.. how do I need to modify the schematic to allow for programming and get new boards ordered asap.. \$\endgroup\$ Commented Oct 29, 2023 at 17:55

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.