Error flashing bootloader to atmega328p au board I design
-
hi.
the factory state for chip is Internal RC 1Mhz. So be careful, when you set the fuses to not set External fuses ON if you have no crystal onboard. because you will need one then ;)
Did you program the fuses with avrdude or avrdudess? and then upload your bootloader with arduino ide...or do you try to change fuses with arduino ide?@scalz said:
hi.
the factory state for chip is Internal RC 1Mhz. So be careful, when you set the fuses to not set External fuses ON if you have no crystal onboard. because you will need one then ;)
Did you program the fuses with avrdude or avrdudess? and then upload your bootloader with arduino ide...or do you try to change fuses with arduino ide?The only thing I tried is what I wrote. I didnt try to mess with fuses. Isnt boards.txt implies that the fuses changed also by trying to bootloader burn?
Any way if I want to program this chip what are the fuses state to change? I would like 8mhz internal... -
@Mickey Nice board ! Just a question: why did you add the 56K (R1) ?
The schematic does not show U3, is the schematic complete ?@GertSanders said:
@Mickey Nice board ! Just a question: why did you add the 56K (R1) ?
The schematic does not show U3, is the schematic complete ?U3 is not relevant to topic but yes the schematic is short u3 which is ADXL345
Also I used 56k because I didnt find 47k in my stock...(is it a problem?) -
@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.
-
@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.
@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...
-
@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.
-
@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.
@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?
-
@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 trueanother 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.hFor me this is the fastest and most reliable way to flash my processors.
-
@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:
- program fuses with : avrdudess+usbasp.
-
@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:
@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 runavrdude -b 19200 -c usbasp -p m328p -vI get

- program fuses with : avrdudess+usbasp.
-
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.
-
@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 runavrdude -b 19200 -c usbasp -p m328p -vI get

- program fuses with : avrdudess+usbasp.
-
@Mickey Maybe you need to disconnect the radio. I am not able to use SPI programming with the radio connected...
@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:

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

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.