Pages: 1 [2] 3   Go Down
Author Topic: Bootloader for a 1284P @ 16MHz - problems :-(  (Read 4625 times)
0 Members and 1 Guest are viewing this topic.
nr Bundaberg, Australia
Online Online
Tesla Member
***
Karma: 121
Posts: 8447
Scattered showers my arse -- Noah, 2348BC.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks skyjumper, that may save people (me included) a lot of hair tearing.

______
Rob
Logged

Rob Gray aka the GRAYnomad www.robgray.com

Rapa Nui
Offline Offline
Edison Member
*
Karma: 53
Posts: 1990
Pukao hats cleaning services
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

1.check the fuses as well (these work with mine):

atmega1284.bootloader.low_fuses=0xFF
atmega1284.bootloader.high_fuses=0xDC
atmega1284.bootloader.extended_fuses=0xFD

see:
http://www.engbedded.com/fusecalc

mind: the boot flash section size shall be 1024 WORDS and boot start address =$fC00

when using LDSECTION  = --section-start=.text=0x1F800    (as $1F800 = 2x $FC00)

2. do not use high baudrates, start with 19200 when troubleshooting the bootloader. Btw, did you set the baudrate properly? (it can be done in the .c or or in makefile, check it pls)..

3. adjust the baudrate in boards.txt accordingly, choose the proper board then  smiley-yell

P.
« Last Edit: May 17, 2011, 03:54:43 pm by pito » Logged

UK
Offline Offline
Sr. Member
****
Karma: 7
Posts: 436
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I've just bought 10 of these as the 328p didn't have enough IO ports. 

So if I hook up the 1284p on a bread board (for the moment) with the 6 pin programming header and hook up the USBtinyISP will this work and where do I get the bootloader?  Will I need to use AVRDUDE?

Sorry but I have no experience of this and with you getting it working I am hoping to pick your brains !

 smiley-mr-green

Can you program a sketch to the AVR chip using the 6 pin header?  If so how?
Logged

Smithfield, Rhode Island
Offline Offline
God Member
*****
Karma: 2
Posts: 843
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

To program the chip using the 6 pin header you'll need an Atmel AVRISP mkII programmer. This connects between your computers USB port and the 6 pin header. You will also need AVR Studio, a free download from the Atmel website.

The initial programming of the chip must be done at the slowest speed! You'll see what this means after you download the software and try it out.

You can put a "sketch" onto the CPU with this programmer, but then there will be no bootloader and you'll have to do it this way each time.
« Last Edit: June 20, 2011, 05:57:57 pm by skyjumper » Logged

UK
Offline Offline
Sr. Member
****
Karma: 7
Posts: 436
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

To program the chip using the 6 pin header you'll need an Atmel AVRISP mkII programmer. This connects between your computers USB port and the 6 pin header. You will also need AVR Studio, a feww download from the Atmel website.

The initial programming of the chip must be done at the slowest speed! You'll see what this means after you download the software and try it out.

You can put a "sketch" onto the CPU with this programmer, but then there will be no bootloader and you'll have to do it this way each time.

Thanks.

I have one of the 1284p chips set up on a breadboard with the RST held high with a 10K resistor, a 20MHz crystal between pins 12&13 with those pins going to 0V through 22nF caps, pin 10&30 to 5v, pin 11&31 to 0V plus the 6 connections for the ICSP going to 0V,5V plus pins 6,7,8 & 9.

I have now bought an AVRISP mk II

I have downloaded the AVR studio software

I have a HEX file which is supposed to be for the 1284p @ 20MHz

I have spent all day trying to sort this out but nothing!

Is there by any chance a step by step guide ??  I am really tearing my hair out now.

I have also downloaded the files from http://aka47.adsl24.co.uk/serendipity/index.php?/pages/Min644pWarez.html and updated my Arduino installation.  The 1284p appears in the list of available board but if I try to connect the setup via either the AVRISP mk II or ISPtinyUSB I get the error message "avrdude: AVR Part "atmega1284p" not found."

PLEASE can you help me!
Logged

Smithfield, Rhode Island
Offline Offline
God Member
*****
Karma: 2
Posts: 843
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I have to run out in a few but since I know what its like to pull my hair out on this issue, I'll send some quick comments, then I can help in more detail later.

There are two different things at issue here. First, forget about AVRDUDE for now. That can only work once you successfully have a boot loader installed.

Next, forget about Arduino cores for the 1284p. You're not up to that yet.

Let's first get things to a state where the Atmel programer can communicate with yor chip.

Conenct the Atmel programmer to the breadboard. Make sure the wires are going to the right pins. Keep in mind that on the programmer, the red stripe marks the side of the connector with pin 1. You'll need to dig around to find which pin goes where. The Arduino Uno schematic is a good reference.

Start AvrStudio. I don't have it in front of me but there is a menu option that says something like "AVR Programming" or "Program AVR" or something liek that. Select that, and a window pops up. First select the chip, 1284P. Then use the slider control to set the communication speed all the way to the elft, the slowest speed.

Next, try to read the device ID. If you get an error that says something like "unable to communicate with the processor" or whatever, then most likely the processor is not runnign right or something is not hooked up right. Disconnect the Atmel programmer from the breadboard and try to read the dfevice ID, and you'll get the very same error.

If you can't get it to work, try it with an Uno or some other known good Arduino with the 6 pin header. Make sure you're able to communicate with the Uno (or whatever) by reading its device ID, locks and fuses.

Let me know how you make out.

Logged

Smithfield, Rhode Island
Offline Offline
God Member
*****
Karma: 2
Posts: 843
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

lso, remember that the Atmel programmer can not power your device! You need to power it using its power jack or another USB cable. Make sure the device on your breadboard is powered.

Also, you didn;t mention any caps on your crystal. Check out the Uno schematic and make sure your support circuitry is correct on your breadboard.

In fact, forget the breadboard and start with a known working Arduino.

Logged

UK
Offline Offline
Sr. Member
****
Karma: 7
Posts: 436
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

lso, remember that the Atmel programmer can not power your device! You need to power it using its power jack or another USB cable. Make sure the device on your breadboard is powered.

Also, you didn;t mention any caps on your crystal. Check out the Uno schematic and make sure your support circuitry is correct on your breadboard.

In fact, forget the breadboard and start with a known working Arduino.



No, sorry my post was quite long I did, there are 2 x 22nF caps on pins 12&13 with them going to GND.  I also have a 328p sat there on the breadboard next to it smiley  They were so much easier to bootload!!

Will power the device, didn't realise it couldn't take it's power from the programmer. 

Yes I will try first of all to use a known working device.  I will stick a fresh new 328p in one of the Deomilanove boards and get that going with the AVR studio.

I'm surprised that there is no official support for the 1284p in the IDE as it is the best DIL socketed chip in the range (that I could see) and most of us don't have the equipment to be making boards with 2560s and the like on them!!

Again, I really do appreciate your taking the time to help me out!
« Last Edit: June 20, 2011, 06:21:01 pm by cowasaki » Logged

SF Bay Area (USA)
Offline Offline
Tesla Member
***
Karma: 106
Posts: 6373
Strongly opinionated, but not official!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
forget about AVRDUDE for now. That can only work once you successfully have a boot loader installed.
That's not strictly true.  AVRDUDE is a general purpose communications interface that talks to a variety of programmers and bootloaders, including the AVRISP Mk2.

OTOH, I think I agree with the general idea that you should get AVRStudio talking to the 1284 as a first step...

On the gripping hand, if avrdude doesn't recognize 1284p as a known chip, it won't do so AFTER you have a bootloader installed, either.  You probably need to either get a newer version of AVRDUDE (many of which are buggy when it comes to talking to Arduino-like boards), or at least modify the device file to include info about the 1284p.

You did read the AVRISP MkII user guide, right?  It looks like a pretty step-to-step guide starting in the section titled "Frontend Software"...
Logged

UK
Offline Offline
Sr. Member
****
Karma: 7
Posts: 436
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

westfw, thanks for your input. I have read pages of stuff but after 17 hours yesterday my head was like cabbage.  I had not realised that you must supply the breadboard with a 5V supply as I thought that it took the power from the programmer.  Skyjumper mentioned this and I have just got out of bed and down to the work shop.  Within 5 minutes I have the PC running AVR studio and now talking to my 1284p on the breadboard.......

Skyjumper,  inspirational smiley  Yes it was the lack of a 5V line that was doing it.  AVR studio is talking to the 1284p as we speak.

I will now carry on and try to flash it was a bootloader etc.  Will now decide which bootloader is best.  The main challenge then will be getting it working fully with the IDE.
Logged

UK
Offline Offline
Sr. Member
****
Karma: 7
Posts: 436
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Well I've copied the hex file to the PC and tried to upload it.

The software reads the device, the fuses etc
It says "Eraseing device... OK"

But the fails to write the hex saying communications timeout.......  that is where I am at the moment.

Hmmmm....  It was just timing out due to the VERY slow speed I was using. 

First 1284p now flashed smiley

Now to get the IDE working with it.

Also can I use a quicker speed or should I use the slow speed to begin with and then speed up?
« Last Edit: June 21, 2011, 04:01:10 am by cowasaki » Logged

SF Bay Area (USA)
Offline Offline
Tesla Member
***
Karma: 106
Posts: 6373
Strongly opinionated, but not official!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
can I use a quicker speed
You should be able to use a quicker speed as soon as you have reprogrammed the fuses to use your 20MHz crystal instead of the default internal 1MHz clock...
Logged

UK
Offline Offline
Sr. Member
****
Karma: 7
Posts: 436
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
can I use a quicker speed
You should be able to use a quicker speed as soon as you have reprogrammed the fuses to use your 20MHz crystal instead of the default internal 1MHz clock...


its working at 32.65 KHz.....  I increased the speed upwards and it failer to verify at 250KHz.  Now it will not verify at 32KHz but still reads the chip info
Logged

UK
Offline Offline
Sr. Member
****
Karma: 7
Posts: 436
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Replaced the crystal and caps just in case.  It will program and verify at 250 Khz but no more.

Could it be the fuse settings?
« Last Edit: June 21, 2011, 05:26:40 am by cowasaki » Logged

UK
Offline Offline
Sr. Member
****
Karma: 7
Posts: 436
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Setting the fuses at low_fuses=0xF7, high_fuses=0xD8 & extended_fuses=0xFD allowed me to program the 1284p at 4MHz and with the warning that the ISP clock frequency must be lower than 1/4 of the frequency the device is operating at leads me to think that the bread board is all correct.

Now it is the problem of trying to get the IDE to work.

I have a new STK500_v2 directory which has the entry for a 1284p as above but when you create a simple sketch like "blink" avrdude fails with the following:
Code:
Binary sketch size: 1168 bytes (of a 126976 byte maximum)
/Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/bin/avrdude -C/Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/etc/avrdude.conf -v -v -v -v -patmega1284p -cstk500v2 -P/dev/cu.usbserial-A900aeDN -b115200 -D -Uflash:w:/var/folders/TV/TVIbXQREG6GdFXOVaACCOE+++TI/-Tmp-/build8524607269580543963.tmp/Blink.cpp.hex:i

avrdude: Version 5.4-arduino, compiled on Oct  9 2007 at 11:20:31
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/

         System wide configuration file is "/Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/etc/avrdude.conf"
         User configuration file is "/Users/darren/.avrduderc"
         User configuration file does not exist or is not a regular file, skipping

avrdude: AVR Part "atmega1284p" not found.

Valid parts are:
  m6450 = ATMEGA6450      [/Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/etc/avrdude.conf:11538]
  m3250 = ATMEGA3250      [/Applications/A.......................

Now I did download and thought I had installed version 5.9 of avrdude so will look at that now.

EDIT: Just checked and if I type avrdude into terminal it comes up with version 5.10!
« Last Edit: June 21, 2011, 11:04:09 am by cowasaki » Logged

Pages: 1 [2] 3   Go Up
Jump to: