Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. Hardware
  3. Error flashing bootloader to atmega328p au board I design

Error flashing bootloader to atmega328p au board I design

Scheduled Pinned Locked Moved Hardware
15 Posts 4 Posters 15.4k Views 3 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • GertSandersG Offline
    GertSandersG Offline
    GertSanders
    Hardware Contributor
    wrote on last edited by GertSanders
    #6

    @Mickey I'm just wondering why you would need a pull up of 56K, since the internal pullup resistor of those pins in the atmega328 is about the same value (somewhere between 30K and 50K according to datasheet). I see no need for R1.

    M 1 Reply Last reply
    0
    • GertSandersG GertSanders

      @Mickey I'm just wondering why you would need a pull up of 56K, since the internal pullup resistor of those pins in the atmega328 is about the same value (somewhere between 30K and 50K according to datasheet). I see no need for R1.

      M Offline
      M Offline
      Mickey
      wrote on last edited by
      #7

      @GertSanders said:

      @Mickey I'm just wondering why you would need a pull up of 56K, since the internal pullup resistor of those pins in the atmega328 is about the same value (somewhere between 30K and 50K according to datasheet). I see no need to R1.

      When I design the board I use the sensebender micro as reference. I did ask my self is it really needed but Deside to go with that but its not part of the problem...

      1 Reply Last reply
      0
      • GertSandersG Offline
        GertSandersG Offline
        GertSanders
        Hardware Contributor
        wrote on last edited by
        #8

        @Mickey Correct, if electrically your board is OK, and you do not have a spare working Arduino board, you will need to use an AVR programmer to flash the bootloader.

        M 1 Reply Last reply
        0
        • GertSandersG GertSanders

          @Mickey Correct, if electrically your board is OK, and you do not have a spare working Arduino board, you will need to use an AVR programmer to flash the bootloader.

          M Offline
          M Offline
          Mickey
          wrote on last edited by
          #9

          @GertSanders said:

          @Mickey Correct, if electrically your board is OK, and you do not have a spare working Arduino board, you will need to use an AVR programmer to flash the bootloader.

          What is correct? I use an Avr programmer - Usbasp as I mention . I have a few working arduinos is it better to use them as a programmer? Can you tell me what values should I need to the fueses?

          1 Reply Last reply
          0
          • GertSandersG Offline
            GertSandersG Offline
            GertSanders
            Hardware Contributor
            wrote on last edited by GertSanders
            #10

            @Mickey As I do not have a AVR programmer, I flash my processors with my old Arduino. The fuses I use are the same I have in one of the earlier messages.

            For me, the easiest way to work was to extend the sketch made by GAMMON (Atmega_Board_Programmer), but how I changed that sketch is a bit complicated to explain in a mail. I basically converted my bootloader HEX file into an ascii string, which I added in a '.h' file to his sketch. Then I hacked his code so that when I choose atmega328 I get my boatloader, instead of the default.

            GAMMON's sketch also reprograms the fuses.

            In his sketch I started with this change:

            //#define USE_ATMEGA168 true
            //#define USE_ATMEGA328P_8M true
            #define USE_ATMEGA328P_8Mi true
            //#define USE_ATMEGA328P true

            another piece of code I changed was this:
            // ATmega328P
            { { 0x1E, 0x95, 0x0F },
            0x7E00, // start address
            #if USE_ATMEGA328P_8Mi
            optiboot_atmega328_8Mhz_B0_hex, // loader image
            sizeof optiboot_atmega328_8Mhz_B0_hex,
            // 0xE2, // fuse low byte: internal clock, max start-up time
            0xFF, // fuse low byte: external clock, max start-up time
            0xDE, // fuse high byte: SPI enable, boot into bootloader, 512 byte bootloader
            0x07, // fuse extended byte: brown-out detection off
            #else
            atmega328_optiboot,
            sizeof atmega328_optiboot,
            0xFF, // fuse low byte: external clock, max start-up time
            0xDE, // fuse high byte: SPI enable, boot into bootloader, 512 byte bootloader
            0x05, // fuse extended byte: brown-out detection at 2.7V
            #endif
            0x2F
            }, // lock bits: SPM is not allowed to write to the Boot Loader section.

            I also added the attached '.h' file to his sketch:
            optiboot_atmega328p_8M_B0.h

            For me this is the fastest and most reliable way to flash my processors.

            1 Reply Last reply
            0
            • scalzS Offline
              scalzS Offline
              scalz
              Hardware Contributor
              wrote on last edited by
              #11

              @Mickey: I think you have to change fuses. What I usually do is:

              • program fuses with : avrdudess+usbasp.
                you can check your fuse here: http://www.engbedded.com/fusecalc/
              • Then copy atmega boards files, and you can use arduino ide to upload your bootloader, still with usbasp of course.
              • Finally, you can bootload with ftdi.

              But, adding atmega board files doesn't reprogram the fuses if I remember right. If it doesn't work like I explained, then maybe hardware connection..

              On my side, I prefer usbasp/avrspi. it's very easy too, I think :smiley: most important is that it works :wink:

              M 1 Reply Last reply
              0
              • scalzS scalz

                @Mickey: I think you have to change fuses. What I usually do is:

                • program fuses with : avrdudess+usbasp.
                  you can check your fuse here: http://www.engbedded.com/fusecalc/
                • Then copy atmega boards files, and you can use arduino ide to upload your bootloader, still with usbasp of course.
                • Finally, you can bootload with ftdi.

                But, adding atmega board files doesn't reprogram the fuses if I remember right. If it doesn't work like I explained, then maybe hardware connection..

                On my side, I prefer usbasp/avrspi. it's very easy too, I think :smiley: most important is that it works :wink:

                M Offline
                M Offline
                Mickey
                wrote on last edited by Mickey
                #12

                @scalz said:

                @Mickey: I think you have to change fuses. What I usually do is:

                • program fuses with : avrdudess+usbasp.
                  you can check your fuse here: http://www.engbedded.com/fusecalc/
                • Then copy atmega boards files, and you can use arduino ide to upload your bootloader, still with usbasp of course.
                • Finally, you can bootload with ftdi.

                But, adding atmega board files doesn't reprogram the fuses if I remember right. If it doesn't work like I explained, then maybe hardware connection..

                On my side, I prefer usbasp/avrspi. it's very easy too, I think :smiley: most important is that it works :wink:

                Hi
                How can I change fuses if the avr programmer doesn't even detect the chip? when I run

                avrdude -b 19200 -c usbasp -p m328p -v
                

                I get

                cmd.png

                AWIA 1 Reply Last reply
                0
                • GertSandersG Offline
                  GertSandersG Offline
                  GertSanders
                  Hardware Contributor
                  wrote on last edited by
                  #13

                  Double check the connections. If the programmer does not see your processor, there is not much more that can be done on the software side. First check hardware again.

                  1 Reply Last reply
                  0
                  • M Mickey

                    @scalz said:

                    @Mickey: I think you have to change fuses. What I usually do is:

                    • program fuses with : avrdudess+usbasp.
                      you can check your fuse here: http://www.engbedded.com/fusecalc/
                    • Then copy atmega boards files, and you can use arduino ide to upload your bootloader, still with usbasp of course.
                    • Finally, you can bootload with ftdi.

                    But, adding atmega board files doesn't reprogram the fuses if I remember right. If it doesn't work like I explained, then maybe hardware connection..

                    On my side, I prefer usbasp/avrspi. it's very easy too, I think :smiley: most important is that it works :wink:

                    Hi
                    How can I change fuses if the avr programmer doesn't even detect the chip? when I run

                    avrdude -b 19200 -c usbasp -p m328p -v
                    

                    I get

                    cmd.png

                    AWIA Offline
                    AWIA Offline
                    AWI
                    Hero Member
                    wrote on last edited by
                    #14

                    @Mickey Maybe you need to disconnect the radio. I am not able to use SPI programming with the radio connected...

                    M 1 Reply Last reply
                    0
                    • AWIA AWI

                      @Mickey Maybe you need to disconnect the radio. I am not able to use SPI programming with the radio connected...

                      M Offline
                      M Offline
                      Mickey
                      wrote on last edited by
                      #15

                      @AWI said:

                      @Mickey Maybe you need to disconnect the radio. I am not able to use SPI programming with the radio connected...

                      I also thought that but I made another board without the radio with the same error.
                      I needed a fast way to figure it out so I desolder the atmega from an old arduino nano board but before I did it I read the fuses and got this:
                      nanofuses.png

                      then I soldered the virgin series I have and read the fuses:

                      virginfuses.png

                      so first of all It appears that I need the chips first hook up to an external clock just to be able to read the fuses and then change them.

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      20

                      Online

                      11.7k

                      Users

                      11.2k

                      Topics

                      113.1k

                      Posts


                      Copyright 2025 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • MySensors
                      • OpenHardware.io
                      • Categories
                      • Recent
                      • Tags
                      • Popular