ATMEGA328P Programming

Go To Last Post
45 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello people, 

A week ago I soldered my first smd atmel project. It is an open source, music related device. 

I tried to program it using an arduino uno, but I didn't managed to make it work. 

I tried avrdudess and again it wasn't possible. 

I bought a USBtiny board and again I tried to program it, alas, unsuccessfully. 

I get initialization failed, rc=-1

I'm not sure if I burned the atmega, the whole board, or if I just set something wrong and now I cannot do anything to make the thing come to life.

 

With the USBtiny if I run 
avrdude -c usbtiny -p m328p -B 250 -v

 

I get

 

 Using Port                    : usb
         Using Programmer              : usbtiny
         Setting bit clk period        : 500.0
avrdude: usbdev_open(): Found USBtinyISP, bus:device: 006:005
         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 : USBtiny
         Description     : USBtiny simple USB programmer, http://www.ladyada.net/make/usbtinyisp/
avrdude: programmer operation not supported

avrdude: Setting SCK period to 250 usec
avrdude: initialization failed, rc=-1
         Double check connections and try again, or use -F to override
         this check.

I already checked the connections and nothing is bridged and I cannot spot any peculiar voltages across the avr pins.

The avr/isp board looks like this:

grids

 

and the schematic is here.

 

Can someone guide me to figuring out if the mcu is dead and needs desoldering and replacement?
Thank you

 

:) 

 

This topic has a solution.
Last Edited: Fri. Jul 12, 2019 - 07:42 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Get an ohmmeter and check continuity from the avr ISP pins and your ISP port. Also check to see if they are reversed.

Jim

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I already did that, everything is as it is supposed to be. Checked continuity from the avr pins to the programming headers as well.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I doubt you destroyed the AVR.  Not impossible, but doubtful.  You might have bad solder joints or shorts between pins, you'll just have to inspect and ohm out the lines.  If you misprogrammed the clock fuses the device can seem to be dead.  Sometimes you will need to feed an external clock into a "dead" chip to be able to revive it.  It can also be helpful to get your hands on a known working AVR board and confirm that you can program that board.

 

EDIT: double check that you located pin 1 of the AVR in the corner where it's supposed to be

Last Edited: Wed. Jul 10, 2019 - 11:21 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

schematic seems correct, but on PCB it seems there is no track to GND of ISP socket (PIN6)

Majid

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Using the same programmer, I managed to program a though hole atmega328 on a breadboard. The programmer is working correctly.
I've done continuity checks between all the feet and everything looks alright, and yes the notch at the chip.is located in the same place as it is presented in the board image I attached.

So it possible to clock the chip in my current setup?
I already have a soldered crystal in the board.

Last Edited: Thu. Jul 11, 2019 - 07:08 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

At some point, when I was trying to program the mcu, I applied power through the normal power headers. The person that sold me the board told me that this could brick the mcu. What do you think?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

How else would you power the board? Certainly not through the ISP interface.

If it's a slow rising, or dirty power source you could have an issue. Also if the power source cannot supply enough current that could cause an issue as well.

What is the rating of your power supply and how much current does your board require?

Jim

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The module is being powered a through +/-12V connector. The power source is a tested power source, not dirty (if with dirty you mean fluctuating).

My power source is providing +/-12V indeed :)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

12 v at what current(amps/milliamps)?

What are you using to knock that 12v down to 5v or 3.3v?

If you want to.clock the AVR externally then remove the crystal and apply a 1Mhz square wave to the X1 pin. Lower your ISP clock to 125Khz or lower.

Jim

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'm using an lm1117 to reduce it to 5V.

It isn't possible to clock the chip without removing anything?

And, because the mcu is smd, how do you propose I connect a lead that provides clock to XTAL pin?

 

Last Edited: Thu. Jul 11, 2019 - 12:20 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Remove the crystal and solder the lead to the pad on the pcb. Solder the end to the board ground. You can also solder direct to the X1 pin as the part is tqfp... i do it all the time.

Jim

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Will removing the crystal damage it?

I don't have a replacement and the shipping costs for one are huge.

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

That all depends on your soldering abilities.

Do you have other boards that you have not touched yet? Try programming them and see if they work first.

Ji.

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB user

This reply has been marked as the solution. 
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You don't have to remove the xtal, just use your arduino to generate your 1 MHz clock and feed it to pin 7 of your new M328, just tack a small wire to pin 7, make sure your board is powered up and then see if you can read the signature of the chip with your programmer.  Once you can read the signature, then erase your chip and set the fuses to default values. 

Now you should be good to go and can remove your temporary clock. 

good luck and have fun.

 

Jim

 

Click Link: Get Free Stock: Retire early! PM for strategy

share.robinhood.com/jamesc3274

 

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Jim
The reason I recommend pulling the crystal is I have has two defective ones in the past that when I injected the clock they led me to think the avr was defective.

In both cases the crystal was shorted. Once it was a dead shirt. The other it was a several hundred ohms resistor.

To each his own
Other Jim

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ki0bk wrote:

You don't have to remove the xtal, just use your arduino to generate your 1 MHz clock and feed it to pin 7 of your new M328, just tack a small wire to pin 7, make sure your board is powered up and then see if you can read the signature of the chip with your programmer.  Once you can read the signature, then erase your chip and set the fuses to default values

Now you should be good to go and can remove your temporary clock. 

good luck and have fun.

 

  1. xtal = the quartz?
  2. new m328 = the one that is soldered on or do you mean that I should solder on a new mcu?
  3. signature, using which command?
  4. fuses to default values: which are the default values for the atmega 328p-au, or where I can find them.

 

Thank you people for the help so far :)

 

Last Edited: Thu. Jul 11, 2019 - 01:35 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

jgmdesign wrote:
That all depends on your soldering abilities. Do you have other boards that you have not touched yet? Try programming them and see if they work first. Ji.

 

No, unfortunately I don't have a second board for this module. I have a board for another module that uses an avr, not the same, which I thought I could solder to see if I can program something.

As I mentioned above, I was able to program a barebones though hole atmega328p with this programmer.

 

 

Last Edited: Thu. Jul 11, 2019 - 01:27 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

terumi wrote:
I was able to program a barebones though hole atmega328p with this programmer.

All that proves is that your programmer worked...once wink

 

terumi wrote:

  1. xtal = the quartz? YES
  2. new m328 = the one that is soldered on or do you mean that I should solder on a new mcu?  Leave the one you have on the board
  3. signature, using which command? Thats based on the way you set up the programmer which I do not know
  4. fuses to default values: which are the default values for the atmega 328p-au, or where I can find them.  Look in the datasheet, unless your programmer can do it automatically

 

Other Jim

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

terumi wrote:

 

  1. xtal = the quartz?
  2. new m328 = the one that is soldered on or do you mean that I should solder on a new mcu?
  3. signature, using which command?
  4. fuses to default values: which are the default values for the atmega 328p-au, or where I can find them.

 

1) yes

2) new is the existing one on your new board

3) an avrdude user will have to answer this one, but I believe the one in your first post is correct (although I'm not sure about the -B value)

4) as listed in the Datasheet, freaks like this web site for fuse settings: http://www.engbedded.com/fusecalc/

      which shows H:0xD9, L:0x62, E:0xFF

 

Hope that helps. 

Jim

 

Click Link: Get Free Stock: Retire early! PM for strategy

share.robinhood.com/jamesc3274

 

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thank you Jim and Other Jim!

I will return with today's findings after work.

:)

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0


As pointed out, make sure isp pin6 PCB is connected to gnd on your board...also why is nothing else showing connected to gnd?

 

  where is a connection?

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

This is not my design, it is a commercial product, open-sourced which I'm trying to build from scratch.

I've included the schematic for reference and the image in order to show which connection pins are available to me (and the crystal as well).

 

As for pin6 I will!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0



I've included the schematic for reference and the image

You didn't answer the question...are these parts connected to gnd or not?  your picture shows they are not. is there a via or gnd pour not shown?

 

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I think that the pcb features a ground plane, and thus we don't see all the ground connections.

Also 

avrcandies wrote:

make sure isp pin6 PCB is connected to gnd on your board

 

Do you mean the pin 6 of my ISP (USBtiny) or the Pin 6 of the Atmega (which is connected to +5V)?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Did you actually take a look?  Is your ISP 6 pin connector connected to gnd?   If this is a purchased board, it is probably fine, but do look.

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The isp is a purchased one. I already programmed something with that, so I assume it is ok.

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

 

ki0bk wrote:

You don't have to remove the xtal, just use your arduino to generate your 1 MHz clock and feed it to pin 7 of your new M328, just tack a small wire to pin 7, make sure your board is powered up and then see if you can read the signature of the chip with your programmer.  Once you can read the signature, then erase your chip and set the fuses to default values. 

Now you should be good to go and can remove your temporary clock. 

good luck and have fun.

 

  1. 1 MHz clock: I will program my arduino to set a pin to high/low (5V/0V) right? / will something like this do?
    #include <avr/io.h>
    
    int main(void) {
        DDRB = 0xFF;
        while(1) {
            PORTB ^= 0xFF;
        }
    }

    or is speed critical here?

  2. your board is powered up: using my ISP (which provides 5V/GND) or using my power supply of +-12V (and ommiting the 5V/GND connection of my ISP)?

 

Sorry for asking again, but I'm a noob and I want to be safe :)

 

 

 

Last Edited: Thu. Jul 11, 2019 - 04:28 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Are you plugging the ISP cable into the 6-pin header that is on the same side of the PCB as the ATMega chip?  If yes, then that is the problem. Because that is the wrong side.  

Looking down onto the 6-pin ISP cable header, pin 1 is on the top -left.  On the PCB design uploaded, the pin-1 of the header is shown to be on the top right (assuming that the cable is plugged into the header from the same side that the MCU chip is on.)   A reversed cable is the most likely cause of the observed behavior, since the traces and the Vcc are correct.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The pins are on the opposite side. I checked miso, mosi, clk etc from the mcu pins to the same pins on the isp (on the back of it, where they soldered the pins, it reads what is what).

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

avrcandies wrote:
Did you actually take a look?  Is your ISP 6 pin connector connected to gnd? 

OP, the question is, is pin 6 of the ISP connector actually connected to ground?  I'm guessing that the board has a ground pour which connects all the GND pads to ground, and that isn't being shown in the board image you posted.  But we're asking you to confirm this.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The pins are on the opposite side.

Who would lay out the board with the isp not on the top side?? 

 

I think that the pcb features a ground plane, and thus we don't see all the ground connections.

Show the connection between C5 and gnd 

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

avrcandies wrote:

The pins are on the opposite side.

Who would lay out the board with the isp not on the top side?? 

 

I think that the pcb features a ground plane, and thus we don't see all the ground connections.

Show the connection between C5 and gnd 

 

I cannot, I don't know how.

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

terumi wrote:
I cannot, I don't know how.

Use an ohmmeter.  And/or, post a picture of the same area of the actual board that you posted the board layout image.  Then we can see if there's a ground pour.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Here is an arduino sketch to gen a 1MHz clock on pin 9

 

// UNO version Mega 328
//
// Use of timer1 to generate 1 Mhz clock on pin 9
//
//

const int freqOutputPin = 9;   // OC1A output pin for ATmega328

// Constants are computed at compile time

// If you change the prescale value, it affects CS12, CS11, and CS10
// For a given prescale value, the eight-bit number that you
// load into OCR1A determines the frequency according to the
// following formulas:
//
// With no prescaling, an ocr1val of 7 causes the output pin to
// toggle the value every eight CPU clock cycles. That is, the
// period is equal to 16 clock cycles.
//
// With F_CPU = 16 MHz, the result is 1 MHz.
//
// Note that the prescale value is just for printing; changing it here
// does not change the clock division ratio for the timer!  To change
// the timer prescale division, use different bits for CS12:0 below
const int prescale  = 1;
//const int ocr1aval  = 63; //125kHz
//const int ocr1aval  = 31; //250kHz
//const int ocr1aval  = 15; //500kHz
const int ocr1aval  =  7; //1MHz
//const int ocr1aval  =  3; //2MHz
//

void setup()
{
    pinMode(freqOutputPin, OUTPUT);
   

    // Set Timer 1 CTC mode with no prescaling.  OC1A toggles on compare match
    //
    // WGM12:0 = 010: CTC Mode, toggle OC
    // WGM2 bits 1 and 0 are in TCCR2A,
    // WGM2 bit 2 is in TCCR2B
    // COM1A0 sets OC1A (arduino pin 11 on Uno or Duemilanove) to toggle on compare match
    //
    TCCR1A = (1 << COM1A0);

    // Set Timer 1  No prescaling  (i.e. prescale division = 1)
    //
   
    TCCR1B = ((1 << WGM12) | (1 << CS10));

    // Make sure Compare-match register A interrupt for timer1 is disabled
    TIMSK1 = 0;
    // This value determines the output frequency
    OCR1A = ocr1aval;

   
}


void loop()
{
    //
}

Jim

 

Click Link: Get Free Stock: Retire early! PM for strategy

share.robinhood.com/jamesc3274

 

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Ok people, 

I did solder a wire to pin 7 and programmed an arduino to be a 1Mz Clock.

I run: 

avrdude -c usbtiny -p m328p

 

and the mcu gave me:


avrdude: AVR device initialized and ready to accept instructions

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

avrdude: Device signature = 0x1e950f (probably m328p)

avrdude: safemode: Fuses OK (E:FD, H:D8, L:FF)

avrdude done.  Thank you.

After that I set fuses with avrdude -c usbtiny -p m328p -U lfuse:w:0xff:m -U hfuse:w:0xd8:m -U efuse:w:0x05:m -U lock:w:0x2F:m -F -B4

and it gave me

 


avrdude: AVR device initialized and ready to accept instructions

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

avrdude: Device signature = 0x1e950f (probably m328p)
avrdude: reading input file "0xff"
avrdude: writing lfuse (1 bytes):

Writing | ################################################## | 100% 0.00s

avrdude: 1 bytes of lfuse written
avrdude: verifying lfuse memory against 0xff:
avrdude: load data lfuse data from input file 0xff:
avrdude: input file 0xff contains 1 bytes
avrdude: reading on-chip lfuse data:

Reading | ################################################## | 100% 0.00s

avrdude: verifying ...
avrdude: 1 bytes of lfuse verified
avrdude: reading input file "0xd8"
avrdude: writing hfuse (1 bytes):

Writing | ################################################## | 100% 0.00s

avrdude: 1 bytes of hfuse written
avrdude: verifying hfuse memory against 0xd8:
avrdude: load data hfuse data from input file 0xd8:
avrdude: input file 0xd8 contains 1 bytes
avrdude: reading on-chip hfuse data:

Reading | ################################################## | 100% 0.00s

avrdude: verifying ...
avrdude: 1 bytes of hfuse verified
avrdude: reading input file "0x05"
avrdude: writing efuse (1 bytes):

Writing |                                                    | 0% 0.00s ***failed;
Writing | ################################################## | 100% 0.04s

avrdude: 1 bytes of efuse written
avrdude: verifying efuse memory against 0x05:
avrdude: load data efuse data from input file 0x05:
avrdude: input file 0x05 contains 1 bytes
avrdude: reading on-chip efuse data:

Reading | ################################################## | 100% 0.00s

avrdude: verifying ...
avrdude: verification error, first mismatch at byte 0x0000
         0xfd != 0x05
avrdude: verification error; content mismatch

avrdude: safemode: efuse changed! Was 5, and is now fd
Would you like this fuse to be changed back? [y/n] n
avrdude: safemode: Fuses OK (E:05, H:D8, L:FF)

avrdude done.  Thank you.

And then I uploaded a hex file with the program of the device.

After all these days i saw led blinking on it!

But as soon as I remove the arduino clock, everything stops blinking.

I don't know if it has to do with a loose wire or it has not proper fuses set yet.

What do you think?

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

terumi wrote:
What do you think?

 

I think you have made progress!!!

 

terumi wrote:
I don't know if it has to do with a loose wire or it has not proper fuses set yet.

 

Review your steps....  I see a content mismatch error/verification error.

 

Check your fuse settings too.

 

JIm

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

jgmdesign wrote:

terumi wrote:
What do you think?

 

I think you have made progress!!!

 

YEP!! :)

 

terumi wrote:
I don't know if it has to do with a loose wire or it has not proper fuses set yet.

 

Review your steps....  I see a content mismatch error/verification error.

 

Check your fuse settings too.

 

JIm

 

Yep, progress at last!! Thank you people!

Check your fuse settings too. What do you mean? The values I entered?

 

 

As per this I'm good to go.

 

 

Last Edited: Thu. Jul 11, 2019 - 10:14 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If you disconnect the arduino clock and things are no longer working then you either have an issue with the crystal, or the fuse settings.

 

Thats something you need to review.  No one here can meter your board.

 

As I do not use AVRdude I cannot help you on what settings you should be, or should not be using.

 

Jim

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The hex file (avrdude -c usbtiny -p m328p -P usb -U flash:w:/Users/terumi/Desktop/Electronics/grids.hex) gave me

 

avrdude -c usbtiny -p m328p -P usb -U flash:w:/Users/terumi/Desktop/Electronics/grids.hex


avrdude: AVR device initialized and ready to accept instructions

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

avrdude: Device signature = 0x1e950f (probably m328p)
avrdude: NOTE: "flash" memory has been specified, an erase cycle will be performed
         To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: reading input file "/Users/terumi/Desktop/Electronics/grids.hex"
avrdude: input file /Users/terumi/Desktop/Electronics/grids.hex auto detected as Intel Hex
avrdude: writing flash (12278 bytes):

Writing | ################################################## | 100% 17.45s

avrdude: 12278 bytes of flash written
avrdude: verifying flash memory against /Users/terumi/Desktop/Electronics/grids.hex:
avrdude: load data flash data from input file /Users/terumi/Desktop/Electronics/grids.hex:
avrdude: input file /Users/terumi/Desktop/Electronics/grids.hex auto detected as Intel Hex
avrdude: input file /Users/terumi/Desktop/Electronics/grids.hex contains 12278 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 10.08s

avrdude: verifying ...
avrdude: 12278 bytes of flash verified

avrdude: safemode: Fuses OK (E:FD, H:D8, L:FF)

avrdude done.  Thank you.

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

jgmdesign wrote:

If you disconnect the arduino clock and things are no longer working then you either have an issue with the crystal, or the fuse settings.

 

Thats something you need to review.  No one here can meter your board.

 

As I do not use AVRdude I cannot help you on what settings you should be, or should not be using.

 

Jim

 

Does the loose wire affect the crystal?

How can I measure if the crystal is working? (I have an oscilloscope).

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

terumi wrote:
How can I measure if the crystal is working? (I have an oscilloscope).

 

You should probe the output of the crystal amplifier, which is the XTAL2 pin. You should see a signal there at the proper crystal frequency.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hey people I got it working.

My main problem, yes, it was that I had set the fuses to a wrong value.

Using a tiny wire (boy that was difficult) as gmdesign suggested and giving it an external clock, I was able to program it anew.

 

After programming it, I had some problems with my crystal, but it was due to flux (probably) and when I reflowed the oscillator pads several times, everything started to work as expected.

Thank you people for your time and knowledge, you saved me from a few extra days of sleep deprived research.

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Nice job!

Jim

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Thank you Jim! You, and other Jim made me a happy man again.