Arduino Forum

Using Arduino => Microcontrollers => Topic started by: jayakrishnan on Dec 29, 2012, 02:45 pm

Title: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: jayakrishnan on Dec 29, 2012, 02:45 pm
Thanks to Nick Gammon's blog http://www.gammon.com.au/forum/?id=11637, I successfully burned the bootloader on to my 1284P. Since my ftdi cable is en route, i thought i'd burn some programs using my arduino dumilanalov. I removed the atmega328, and took pins from
RX(arduino)-- TXD0(pin15),
TX(arduino)-- RXD0(pin14),
RESET(arduino) -- RESET(pin 9),
5v--5v,
GND--GND

to the 1284p which is on a breadboard.

Then i tried burning a simple sketch.

Code: [Select]
int led = 3;


void setup() {               

  pinMode(led, OUTPUT);     
}


void loop() {
  digitalWrite(led, HIGH);   
  delay(1000);             
  digitalWrite(led, LOW);   
  delay(1000);               
}




I got the following error message when i used AVRISP mk||.
Quote
avrdude: stk500_paged_write(): (a) protocol error, expect=0x14, resp=0x62
avrdude: stk500_cmd(): programmer is out of sync


Where did i go wrong?
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: Tom Carpenter on Dec 29, 2012, 02:48 pm
You need to swap the RX and TX lines over if you are trying to use the built in FTDI chip. (RX means the 328p's RX pin, which means that is the FTDI's TX pin).
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: jayakrishnan on Dec 29, 2012, 03:26 pm
Thanks for the reply. :) I swapped the pins like you said and it showed "done uploading", with an error,
Quote
avrdude: stk500_getsync(): not in sync: resp=0x00
. I have an LED conected at pin 4 and there weren't any blinking as well...
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: Tom Carpenter on Dec 29, 2012, 03:32 pm
Could you post a picture of your circuit?
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: jayakrishnan on Dec 30, 2012, 11:50 am
Image attached..
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: retrolefty on Dec 30, 2012, 03:13 pm
Image is correct connecting TX to TX and Rec to Rec. However I don't see any connection to the auto-reset circuit from the arduino to the 1284p chip, so the arduino IDE has no way to initate a auto-reset for the 1284p chip to start the bootloader at the proper time. A simple jumper from the arduino board's reset pin to the 1284p reset pin should fix that situation. Try that and let us know how it works.

You may have to also remove the reset pull-up resistor on the 1284p chip as there is already a reset pull-up on the arduino board and having two in parallel may be too low a resistance for the auto-reset pulse to pull the signal low on initiation of the DTR signal.

Lefty
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: jayakrishnan on Dec 30, 2012, 03:46 pm
Quote
A simple jumper from the arduino board's reset pin to the 1284p reset pin should fix that situation. Try that and let us know how it works.

You may have to also remove the reset pull-up resistor on the 1284p chip as there is already a reset pull-up on the arduino board and having two in parallel may be too low a resistance for the auto-reset pulse to pull the signal low on initiation of the DTR signal.


Still, got the error, "avrdude: stk500_getsync(): not in sync: resp=0x00".


Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: retrolefty on Dec 30, 2012, 04:38 pm

Quote
A simple jumper from the arduino board's reset pin to the 1284p reset pin should fix that situation. Try that and let us know how it works.

You may have to also remove the reset pull-up resistor on the 1284p chip as there is already a reset pull-up on the arduino board and having two in parallel may be too low a resistance for the auto-reset pulse to pull the signal low on initiation of the DTR signal.


Still, got the error, "avrdude: stk500_getsync(): not in sync: resp=0x00".





That's too bad. The error message just means that AVRDUDE and the bootloader aren't talking to each other. Are you sure you are selecting the proper comm port and board type (1284p) to use in the arduino IDE?

Lefty
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: jayakrishnan on Dec 30, 2012, 06:55 pm
Yep. Board is Mighty 1284p 16Mhz using optiboot, and COM port's right...
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: JoeO on Dec 31, 2012, 04:30 am

Image attached..

The image shows no connection between the 220 ohm resistor and ground.
Move the wire.

If it still doesn't work, please take a real picture of your hardware and post it here.
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: jayakrishnan on Dec 31, 2012, 07:09 am
Quote
The image shows no connection between the 220 ohm resistor and ground.
Move the wire.


The connection is right in my circuit. :) Plus that shouldn't be a reason why the upload is failing....
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: JoeO on Dec 31, 2012, 02:52 pm

Quote
The image shows no connection between the 220 ohm resistor and ground.
Move the wire.


The connection is right in my circuit. :) Plus that shouldn't be a reason why the upload is failing....

I know that it will not fix your problem.
But it does show that the image you posted is not what you have wired up.
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: nickgammon on Dec 31, 2012, 09:28 pm
It's hard to debug hardware issues remotely. If I was there I would hook up the logic analyzer. Perhaps an LED and 1K resistor on each of Tx/Rx lines to confirm data is getting through?
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: jayakrishnan on Jan 02, 2013, 01:53 pm
Thanks for the replies, guys. :)

Quote
Perhaps an LED and 1K resistor on each of Tx/Rx lines to confirm data is getting through?


Will try that.. thanks :)
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: InitialForce on Jan 16, 2013, 02:53 am
I am having a similar issue, except I am using an FTDI Basic (https://www.jameco.com/webapp/wcs/stores/servlet/Product_10001_10001_2117341_-1) set for 5v.
It uploaded the blink sketch just fine but anytime I am trying to upload anything larger than 2kb it gives me this error:

Quote
avrdude: stk500_paged_write(): (a) protocol error, expect=0x14, resp=0x64
avrdude: stk500_cmd(): programmer is out of sync


Bootloader is functional (Might 1284p) and I followed maniacs schematic write up to the letter: http://maniacbug.wordpress.com/2011/11/27/arduino-on-atmega1284p-4/

Any ideas why I can change and upload the blink sketch as much as I want but as soon as I try to upload a larger file I get the error?

Edit: I am getting RX TX led activity for about 2 seconds than nothing. On smaller sketches this seems to be enough time to get it uploaded before it goes out of sync? I am so lost...
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: tack on Jan 16, 2013, 03:12 am
I get the same issue with teh 1284P using Mighty1284 Optiboot (Bobuino pinmap).

I can upload Blink but not larger sketches. I eventually gave up and just program via ISP. It's a bit of a pain for serial monitor as I have to keep switching my USB>TTL adapter to monitor, but I'm just going to order another cheap one to use with MTTTY for monitoring.

I have seen mention that trying a swap of the crystal resonator, or switching to a ceramic resonator can cure it, but I've not tried that as yet.

If anyone does know a link to a definitive fix then it would be useful to knoe.
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: retrolefty on Jan 16, 2013, 03:26 am

I get the same issue with teh 1284P using Mighty1284 Optiboot (Bobuino pinmap).

I can upload Blink but not larger sketches. I eventually gave up and just program via ISP. It's a bit of a pain for serial monitor as I have to keep switching my USB>TTL adapter to monitor, but I'm just going to order another cheap one to use with MTTTY for monitoring.

I have seen mention that trying a swap of the crystal resonator, or switching to a ceramic resonator can cure it, but I've not tried that as yet.

If anyone does know a link to a definitive fix then it would be useful to knoe.


This really sounds like the 1284P DIP internal hardware bug effecting the serial input pin. The folks over at avrfreaks site had lots on it in the past. Seems the fix is to wire a low pass filter to the serial input pin which is a .1 ufd cap from the rec pin to ground and a series 10K resistor from the pin to whatever is supplying the serial data. Date code on the chip may or may not help identify a vulnerable chip. Another fix is to use a bootloader for the 1284P that was been compiled to use the second serial port on the 1284P that wasn't effected by with internal hardware bug. There was such a bootloader made available a while back by someone. Who remembers all those details.  ;)

And of course these days you can use a arduino board running the arduinoISP sketch and upload your sketch using the IDE file/upload with programmer option the IDE now offers.

Lefty
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: InitialForce on Jan 16, 2013, 04:03 am
I will need to try the low pass filter and the second UART alternative.

For the moment I am using the Arduino as ISP and uploading through the programmer instead :/
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: CrossRoads on Jan 16, 2013, 04:26 am
I don't see these problems when bootloading 1284's via Atmel AVR ISP MKii and sketch downloads with FTDI modules.

Can you try with this bootloader?
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: InitialForce on Jan 16, 2013, 06:19 am
I am getting an error message when trying to download the .hex and .txt file. Can you look into this please? I would love to see if those 2 files would fix my issue. Thanks
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: CrossRoads on Jan 16, 2013, 06:39 am
PM with an e-mail address.  I can't download them either. Get that weird 503 error message.
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: leo72 on Jan 16, 2013, 09:29 pm

I get the same issue with teh 1284P using Mighty1284 Optiboot (Bobuino pinmap).

I can upload Blink but not larger sketches. I eventually gave up and just program via ISP. It's a bit of a pain for serial monitor as I have to keep switching my USB>TTL adapter to monitor, but I'm just going to order another cheap one to use with MTTTY for monitoring.

I have seen mention that trying a swap of the crystal resonator, or switching to a ceramic resonator can cure it, but I've not tried that as yet.

If anyone does know a link to a definitive fix then it would be useful to knoe.

I worked for a while with Atmega1284P in the past weeks and I also experienced problems during the upload of a sketch using the bootloader.
I looked for help on the form (here (http://arduino.cc/forum/index.php/topic,80483.msg957901.html#msg957901) and following posts) then I googled and found on AvrFreaks that this could be an hardware bug on the USART0 (read here (http://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&t=107115)).
So I solved using an RC filter with a 10K resistor in series and a 100 pF capacitor to ground, both put very close to the TX RX pin of the Arduino 1284P. Also, cut a little the pins of the capacitor.
Try it.
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: retrolefty on Jan 16, 2013, 09:31 pm
Quote
both put very close to the TX pin of the Arduino 1284P. Also, cut a little the pins of the capacitor.


Don't you mean the Rec pin RX0?

Lefty
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: CrossRoads on Jan 16, 2013, 09:50 pm
Was that some specific date-code lot of parts?  I have never seen that happen.
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: CrossRoads on Jan 16, 2013, 09:59 pm
Skyjumper from our Arduino forum posted this on the other forum, testing with this board that I had wirewrapped up here
http://arduino.cc/forum/index.php/topic,56567.0.html

And he ran the serial ports fast in his applicatio. We never did anything special for the serial ports with low pass filters.
I suspect poor wiring where the error is occurring.

"skyjumper 
Posted: May 24, 2011 - 04:12 AM 

Joined: Feb 15, 2011
Posts: 81
Location: Smithfield, RI

Hm, I have been building a 1284P based product for a while and its serial intensive, no problems noticed here. I just wrote an app on my wire wrapped prototype with its 1284P in DIP. We'll see how long it runs.

Is there any info about what triggers this bug, or exactly what problems it causes?"

(http://www.crossroadsfencing.com/Sailboat_card.jpg)


Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: retrolefty on Jan 16, 2013, 10:04 pm

Was that some specific date-code lot of parts?  I have never seen that happen.


Yes, (datecode 1017) was mentioned for the avrfreaks site poster, but not clear if it applies to other date codes. Probably need to research Atmel errata notes for that chip series. I'm pretty sure it was also limited to DIP package only, but that sounds kind of strange as I would think the dies are the same for any datecode chips made?

Lefty
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: CrossRoads on Jan 16, 2013, 10:26 pm
Dies all the same as far as I know.
The Errata sheets have no mention of any serial port issues.
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: leo72 on Jan 17, 2013, 10:20 am

Quote
both put very close to the TX pin of the Arduino 1284P. Also, cut a little the pins of the capacitor.


Don't you mean the Rec pin RX0?

Lefty


Yeah. My mistake. Corrected.
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: leo72 on Jan 17, 2013, 10:26 am
My chip's datacode is 1139.
I don't have an oscillo to look at the signals so I don't know why/how the RX0 pin works with or without the RC in front of it but can say for sure that without it I cannot program the 1284P via serial using the bootloader.
Of course, no problems using the ISP programming.

A friend of mine has a datacode of 12xx and he is experiencing that bug in a stronger manner than me, because he isn't able to program the 1284P using the bootloader nor with nor without the RC filter.
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: leo72 on Jan 17, 2013, 04:36 pm
I got another Atmega1284P, its datacode is 1151.
Same behaviour, I can easily flash the bootloader using the ISP programming but, then, I can NOT upload a sketch unless I use the RC filter on pin RXD0
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: leo72 on Jan 17, 2013, 10:43 pm
I've read about the RC filter I've suggested on the AvrFreaks forum I've linked some posts above.
Initially, I didn't think it was possible that a similar solution could help me but finally I got my chips working correctly.

Your analysis about the interferences between the crystal caps and the RX0 pin could be correct but I don't have an oscillo to check the signals and at the moment I've only did some experiments on a breadboard and maybe the interferenes between adjacent pin rows could disturb the serial transission.

BTW, using a 12 MHz cer resonator I could program the chip without the RC filter. Some people talked about clock issues but he did only with frequencies around 20 MHz, I'm experiencing troubles at 16 MHz, while at lower clocks the chips seems to work correctly.
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: CrossRoads on Jan 17, 2013, 10:47 pm
There is no ground plane on this protoboard. FTDI Basic plugs onto the 6-pin header to the left of the crystal, MKii plugs onto 6-pin header above the board. All signals are 30 guage wirewrap to wirewrap socket pins.  I do not see any serial download issues.
(http://www.crossroadsfencing.com/BobuinoRev17/1284_test_board_ICSP_FTDI.jpg)
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: CrossRoads on Jan 18, 2013, 03:53 am
Ok, I am sticking with user error/poor wiring.
I just bootloaded & downloaded a simple sketch, both succeeded on first pass.
Datecode on chip: 1050

The Rx/Tx wires do not overlap the crystal pins.
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: CrossRoads on Jan 18, 2013, 08:23 am
That's what I am saying. Poor layout, poor wiring, poor who knows what.
I have made over 50 1284 boards in various designs - DIPs, wirewrap, surface mount - and I have not had a problem 1 time.
Not even with older date code parts, such as the 1050 I demonstrated with tonight.
Bootloading with Atmel MKii, and serial downloading with a couple of different FTDI based modules.
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: leo72 on Jan 18, 2013, 03:59 pm

Aha, that didn't seem to come out so clearly previously, with all the comments from others.
50 boards and no problems sounds like a lot of others with shaky board designs, starting over
on avrfreaks.


Ok.
And what about those messages in the AvrFreaks forum and in other sites coming from users that are not able to use a bootloader to flash a sketch on that chip?
Those messages are old (3/4 years old), the problem is known. Several people had this issue.
The user that suggested the use of the RC filter on the AvrFreak forum isn't a newbie. I gave him credit and I solved the problem.

BTW, a friend of mine had tried 5 different chips with sevaral datacodes and he wasn't able to bootload a sketch. He tried to use an FTDI card and an MCP2200 as USB/serial converter but he didn't solve.

PS:
I tried my chips on a breadboard. The SAME circuit on the SAME b.b. worked perfectly with an Atmega644PA.
I flashed the bootloader and was able to upload a sketch on it using its bootloader. So I can exclude a circuit problem (in my case).
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: retrolefty on Jan 18, 2013, 06:30 pm
It's pretty clear that the problem symptom is real for many people, as well as it's true many people have not seen the same problem symptom. The low pass filter does seem to be a 'solution' for many that are seeing that problem. Atmel does not seen to have ever claimed it's a chip internal problem, but rather they speculate that it's most likely a problem that may be caused by noise coupling from the chips clock lines pin(S) to the RX0 pin, so circuit layout external to the chip may be a variable that increases or decreases the possibility of one having the problem, and is supported by the observation that it's only been seen in DIP packaged 1284P chips. Changing to a bootloader that uses the second serial port has been a solution for some that have experienced the problem also.

My participation on this topic has been mostly academic and I just mostly passed on what I had read on the avrfreaks site (which I consider credible on this topic), and from what I've read on postings on this site. I'm still waiting for my 1284P chip to arrive from a slow boat from China (Futurlec, known for good prices and slow deliveries). So far using CrossRoads' 1284P through hole duem.. style board, I've seen no uploading problems using a 644P chip (even with a 60KB test sketch), but I am at least now knowledgeable to know what may or may not happen when I finally do get my 1284P, and possible solutions if indeed I see the uploading problem.

Lefty
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: tack on Jan 18, 2013, 06:38 pm
Uploading small sketches is fine. I can load the blink sketch via serial every time. It only manifests with larger sketches,  even 20k sort of size.
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: oric_dan on Jan 18, 2013, 07:11 pm
Quote
Atmel does not seen to have ever claimed it's a chip internal problem, but rather they speculate that it's most likely a problem that may be caused by noise coupling from the chips clock lines pin(S) to the RX0 pin, so circuit layout external to the chip may be a variable that increases or decreases the possibility of one having the problem,

That seems to be a new piece of information, unless I missed it in the jumble.
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: retrolefty on Jan 18, 2013, 07:14 pm

Quote
Atmel does not seen to have ever claimed it's a chip internal problem, but rather they speculate that it's most likely a problem that may be caused by noise coupling from the chips clock lines pin(S) to the RX0 pin, so circuit layout external to the chip may be a variable that increases or decreases the possibility of one having the problem,

That seems to be a new piece of information, unless I missed it in the jumble.


It was a passing comment by one (or a couple of) avrfreaks poster that apparently sought out ATMEL's help, he was told effectively to clean up his circuit layout. That coupled with the fact that the problem is never mentioned in the errata section of any published Atmel datasheet for the 1284P lends credence to that 'speculation'.

Lefty
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: oric_dan on Jan 18, 2013, 07:37 pm
Quote
It was a passing comment by one (or a couple of) avrfreaks poster that apparently sought out ATMEL's help, he was told effectively to clean up his circuit layout.

This probably explains why Bob's boards "don't" show the problem.
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: retrolefty on Jan 18, 2013, 07:50 pm

Quote
It was a passing comment by one (or a couple of) avrfreaks poster that apparently sought out ATMEL's help, he was told effectively to clean up his circuit layout.

This probably explains why Bob's boards "don't" show the problem.


That could very well be and I will add or subtract from that speculation when my 1284P chip finally arrives.  :D

Lefty
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: leo72 on Jan 18, 2013, 08:31 pm

Uploading small sketches is fine. I can load the blink sketch via serial every time. It only manifests with larger sketches,  even 20k sort of size.

In my tests, the synch problems manifest both with small (Blink) o large sketches. Simply, without RC filter the chip doesnt' respond to the data sent through the serial line.


It was a passing comment by one (or a couple of) avrfreaks poster that apparently sought out ATMEL's help, he was told effectively to clean up his circuit layout.

Uhm. this has a sense for me. Since today, I've only tested the 1284P on a breadboard because I didn't want to make a board for the serial programming using the bootloader if I wasn't SURE that I could do that to upload a sketch.
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: retrolefty on Jan 18, 2013, 08:36 pm
Quote
Uhm. this has a sense for me. Since today, I've only tested the 1284P on a breadboard because I didn't want to make a board for the serial programming using the bootloader if I wasn't SURE that I could do that to upload a sketch.


Well that leaves you in a catch 22 situation doesn't it?   :D

So maybe make provisions in your PCB to install a resistor/cap filter near the RX0 pin and just don't install the components and jumper around them with a wire jumper or a 'zero' ohm resistor if testing proves they are not required with whatever layout you end up using.

Lefty
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: CrossRoads on Jan 18, 2013, 08:41 pm
The only times I have trouble with serial downloading is when I accidentally leave the DTR cap off, or forget to burn the bootloader first. I'm slowly getting better about that!  :smiley-mr-green:
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: retrolefty on Jan 18, 2013, 08:47 pm

The only times I have trouble with serial downloading is when I accidentally leave the DTR cap off, or forget to burn the bootloader first. I'm slowly getting better about that!  :smiley-mr-green:


So OK fess up. Did you purposely do some 'special' PCB layout for the clock/RX0 lines on your 1284P boards being aware of the possible problems of noise interactions with serial communications? Or did you just get lucky.  :D

Lefty
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: CrossRoads on Jan 18, 2013, 09:05 pm
In one of my earliest design postings here, someone like Grumpy_Mike mentioned that it was good practice to not have signals going under the crystal.
When I wirewrap cards, the crystal is right next to the xtal pins also, with no wires crossing them.
This also goes along with Atmel's Design Consideration app note, see Section 5.
Being an electrical engineer who designed for the defense industry, I know how to follow good design practices.

"Atmel AVR042: AVR Hardware Design Considerations" Rev. 2521K-AVR-03/11
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: leo72 on Jan 18, 2013, 10:11 pm

Well that leaves you in a catch 22 situation doesn't it?   :D

ROTFL  :smiley-yell:

Quote

So maybe make provisions in your PCB to install a resistor/cap filter near the RX0 pin and just don't install the components and jumper around them with a wire jumper or a 'zero' ohm resistor if testing proves they are not required with whatever layout you end up using.

Good solution ;)
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: leo72 on Jan 18, 2013, 10:16 pm

Being an electrical engineer who designed for the defense industry, I know how to follow good design practices.

;)

EDIT:
link doesn't work  :P
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: CrossRoads on Jan 18, 2013, 10:24 pm
Link works, its a forum wide problem. No downloads are working.

Just figured out why I couldn't find an online link earlier - I was searching at maxim-ic.com for it  :smiley-red:
I can design, I just can't surf 8)

http://www.atmel.com/images/doc2521.pdf
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: cyclegadget on Jan 19, 2013, 04:51 am
I am using one of CrossRoad's Bobuino boards for a project of mine. I have loaded variations of my sketch about 50+ times with no problems. The date code is 1050.

Sketch size currently is:
Code: [Select]
Binary sketch size: 28,640 bytes (of a 130,048 byte maximum)

Estimated used SRAM memory: 2,352 bytes
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: oric_dan on Jan 19, 2013, 09:47 am
cyclegadget, how did you get it to display SRAM memory usage?

How does one tell the datecode? Is it stamped on the chip under the p/n, like where
mine says 1216?
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: oric_dan on Jan 19, 2013, 10:10 am
I have a bit more of information. First off, I've been reading through the interminably
long thread "ATmega1284P: End to End using 1.0 IDE", and there were gazillions of sketch
uploading and other problems over there, fuse settings/whatever. Was anything finally
resolved, or just a bunch of suggestions proferred?

http://arduino.cc/forum/index.php/topic,80483

My bit of information is, I've been uploading good-sized 32KByte sketches to my 1284 by
the bushload, using IDE 1.0 and 1.3, and using both FTDI cable and FTDI Friend, and not
seen even a single glitch.

I do have the 1284, and not the 1284P, chip programmed with the Bobuino variant of
maniacbug's v4.5 optiboot.

Secondly, my board here is a hacked proto typing shield with a lot of soldered wires and
a lot of wirewraps. In fact, the connection to the RX0 pin is a 3" long wirewrap wire
that I have now purposely strung "between" the crystal pins, just to try and inject some
extra noise onto RX0.

So, no low-pass filter on RX0, RX0 signal passing in between crystal pins, large 32KB
sketch, and nary an uploading glitch after several dozen burns. So, all in all, ...
no problema. Maybe the moon here is in its happy phase, or because I'm playing
Mozart. ???



Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: CrossRoads on Jan 19, 2013, 04:04 pm
oric_dan, yes, 1216 is the data code.
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: cyclegadget on Jan 19, 2013, 07:30 pm

cyclegadget, how did you get it to display SRAM memory usage?



I use ERW Arduino IDE  http://arduino.cc/forum/index.php/topic,118440.0.html

I had to added the Bobuino board  .txt file to make it work but, it is a very similar process to the standard Arduino IDE.

Also, I just realized that my chip is a 1284P if that makes a difference on my earlier statements. I know for a fact that I am using the maniacbug bootloader as I installed it myself to make sure I had the latest and greatest bootloader.
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: retrolefty on Jan 19, 2013, 07:34 pm

oric_dan, yes, 1216 is the data code.


And it is usually decoded as year 20(12) and week(16) or possibly batch(16)

Lefty

Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: oric_dan on Jan 19, 2013, 08:01 pm
Thanks in regards the datacode. So I have chips from a fairly recent batch.

Also am using the 1284 rather than 1284P. Maybe it's the 'P' pico-power version that
has the RX0 sensitivity problem, as I figure draping the RX0 line around the xtal pins
like I did should aggravate any noise issues, but uploads are solid. I plan to get some
1284P chips soon to try.

Does anyone know of a very large sketch I could try uploading? For my 32KB sketch, I
just created a humungus initialized data array, clearly far over the RAM size for the
chip.

One other question - there was talk on some of the other threads about Arduino-central
producing a standard pinout for 1284P chips. Is that a possiblility?

Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: cyclegadget on Jan 19, 2013, 08:09 pm

Here is a code that I used to test the Uno against the Teensy 3.0. If you make this array larger: float sinanswers[401]  and make the two "for" loops larger too, you can make the sketch much bigger. I had to settle on 400 to make it fit the Uno easily enough.
If you like, you can use the other math processes to perform other tasks and make the sketch bigger.


Code: [Select]
[code]
float sinanswers[401];

unsigned long time1 = 0;
unsigned long time2 = 0;
void setup()
{

  Serial.begin(9600); // USB is always 12 Mbit/sec
  delay(1000);
  Serial.print("Here");
  delay(4000);
  time1 = micros();
  for (int i = 0; i < 400; i++)
  {
    sinanswers[i] = sin(i);

  }
  time2 = micros();

  unsigned long elapsed = time2 - time1;
  for (int i = 0; i < 400; i++)
  {
    Serial.println(sinanswers[i]);
    Serial.print(" ");
    Serial.println(i);
  }

  Serial.print("time elasped = ");
  Serial.print(elapsed);
  Serial.print(" micros");
}

void loop()
{

}
[/code]
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: retrolefty on Jan 19, 2013, 08:09 pm

Thanks in regards the datacode. So I have chips from a fairly recent batch.

Also am using the 1284 rather than 1284P. Maybe it's the 'P' pico-power version that
has the RX0 sensitivity problem, as I figure draping the RX0 line around the xtal pins
like I did should aggravate any noise issues, but uploads are solid. I plan to get some
1284P chips soon to try.

Does anyone know of a very large sketch I could try uploading? For my 32KB sketch, I
just created a humungus initialized data array, clearly far over the RAM size for the
chip.

Funny you should ask, I just posted such a sketch yesterday in preping for such a 1284P test. I haven't
worked out the correct value to use for arraysize variable for use with the 1284P but I'm sure with the comments you can work it out close enough. See code below.

One other question - there was talk on some of the other threads about Arduino-central
producing a standard pinout for 1284P chips. Is that a possiblility?

Where was that posted, have a link?




Code: [Select]

#include <avr/pgmspace.h>   //To store arrays into flash rather then SRAM
// Simple sketch to create large sketch sizes for testing purposes
/*
 Blink
 Turns on an LED on for one second, then off for one second, repeatedly.

 This example code is in the public domain.
*/

// Pin 13 has an LED connected on most Arduino boards.
// give it a name:
int led = 13;

/*
Make arraysize = to 1500 for 328P chip, 4000 for 1280P chip?,
3600 for 644P chip, xxxx for 1284P,  etc.
*/
const int arraysize= 1500;  // value to mostly fill avalible flash capacity

long myInts0[arraysize] PROGMEM = {};  //Store initilized array into flash memory
long myInts1[arraysize] PROGMEM = {};
long myInts2[arraysize] PROGMEM = {};
long myInts3[arraysize] PROGMEM = {};

// the setup routine runs once when you press reset:
void setup() {                
 // initialize the digital pin as an output.
 pinMode(led, OUTPUT);
 int i = random(0,arraysize);      // Work around any optimization for constant values
 Serial.print(myInts0[i]);         //  Access some random element so the array can't be optimized away.
 Serial.print(myInts1[i]);         //  Access some random element so the array can't be optimized away.
 Serial.print(myInts2[i]);         //  Access some random element so the array can't be optimized away.
 Serial.print(myInts3[i]);         //  Access some random element so the array can't be optimized away.
}

// the loop routine runs over and over again forever:
void loop() {
 
 digitalWrite(led, HIGH);   // turn the LED on (HIGH is the voltage level)
 delay(1000);               // wait for a second
 digitalWrite(led, LOW);    // turn the LED off by making the voltage LOW
 delay(1000);               // wait for a second
}


Lefty
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: oric_dan on Jan 19, 2013, 08:21 pm
cyclegadget, I don't think your example sketch will be very big, as the float array is not
initialized. lefty's example should do it, I'm sure.

Quote
One other question - there was talk on some of the other threads about Arduino-central
producing a standard pinout for 1284P chips. Is that a possiblility?

Where was that posted, have a link?

There was mention of this in a number of posts of the enormous 39-page thread I linked
to a couple of posts ago. I'm not sure if it was a desire or an actual effort, or what became
of it. The Bobuino pinout is pretty good for UNO-like compatibility, but I wondered if
something was in the brew in officialdom.
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: retrolefty on Jan 19, 2013, 08:28 pm

cyclegadget, I don't think your example sketch will be very big, as the float array is not
initialized. lefty's example should do it, I'm sure.

Quote
One other question - there was talk on some of the other threads about Arduino-central
producing a standard pinout for 1284P chips. Is that a possiblility?

Where was that posted, have a link?

There was mention of this in a number of posts of the enormous 35-page thread I linked
to a couple of posts ago. I'm not sure if it was a desire or an actual effort, or what became
of it. The Bobuino pinout is pretty good for UNO-like compatibility, but I wondered if
something was in the brew in officialdom.


Very very unlikely in my opinion. The 'official' IDE distrubution has never directly supported 3rd party boards not designed and/or sold by the arduino people. And if they did they would end up owning all future support changes needed (bootloader upgrades, library upgrades, etc, to support the 'non-standard' chip), so it's really wishing for what isn't really possible. The have done a great job for making the IDE easily 'expandable' by having the user's sketch folder/hardware folder allow for adding 3rd party board support, and that goes a long way at making future IDE version upgrades less painful (but not 100% I think) then in the days when one had to replace or modify the files inside the main IDE core folders.

Lefty
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: oric_dan on Jan 19, 2013, 09:09 pm
Ok, here is some progress. I tried lefty's sketch, with arraysize set = 4000 to 7000.
I uploaded a dozen or so times, using both the FTDI Friend and the FTDI cable, and
it never failed to burn and verify properly. I still have the RX0 wirewrap wire
running inbetween the xtal pins, and no low-pass filter on the RX0 pin.

arraysize = 4000 gives a 67808 byte file, and 7000 gives 115808 bytes. Upload and
verify takes 70-sec for the 115808 byte file.

One thing of interest - for arraysize > 4000 or so, the sketch no longer works correctly,
ie Led 13 does not flash after uploading. At 4000 and below, Led 13 blinks ok.
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: cyclegadget on Jan 19, 2013, 09:10 pm

This works on the 1284P:
Code: [Select]
#include <avr/pgmspace.h>   //To store arrays into flash rather then SRAM
// Simple sketch to create large sketch sizes for testing purposes
/*
  Blink
  Turns on an LED on for one second, then off for one second, repeatedly.

  This example code is in the public domain.
*/

// Pin 13 has an LED connected on most Arduino boards.
// give it a name:
int led = 13;

/*
Make arraysize = to 1500 for 328P chip, 4000 for 1280P chip?,
3600 for 644P chip, xxxx for 1284P,  etc.
*/
const int arraysize= 4000;  // value to mostly fill avalible flash capacity

long myInts0[arraysize] PROGMEM = {};  //Store initilized array into flash memory
long myInts1[arraysize] PROGMEM = {};
long myInts2[arraysize] PROGMEM = {};
long myInts3[arraysize] PROGMEM = {};

// the setup routine runs once when you press reset:
void setup() {               
  // initialize the digital pin as an output.
  pinMode(led, OUTPUT);
  Serial.begin(115200);
   digitalWrite(led, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(1000);               // wait for a second
  digitalWrite(led, LOW);    // turn the LED off by making the voltage LOW
  delay(1000);
  int i = random(0,arraysize);      // Work around any optimization for constant values
  Serial.print(myInts0[i]);         //  Access some random element so the array can't be optimized away.
  Serial.print(myInts1[i]);         //  Access some random element so the array can't be optimized away.
  Serial.print(myInts2[i]);         //  Access some random element so the array can't be optimized away.
  Serial.print(myInts3[i]);         //  Access some random element so the array can't be optimized away.
}

// the loop routine runs over and over again forever:
void loop() {
 
  digitalWrite(led, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(1000);               // wait for a second
  digitalWrite(led, LOW);    // turn the LED off by making the voltage LOW
  delay(1000);               // wait for a second
}


Code: [Select]
Binary sketch size: 67,994 bytes (of a 130,048 byte maximum)

Estimated used SRAM memory: 365 bytes


This code with a bigger array, loads OK but, does not  run:

Code: [Select]
#include <avr/pgmspace.h>   //To store arrays into flash rather then SRAM
// Simple sketch to create large sketch sizes for testing purposes
/*
  Blink
  Turns on an LED on for one second, then off for one second, repeatedly.

  This example code is in the public domain.
*/

// Pin 13 has an LED connected on most Arduino boards.
// give it a name:
int led = 13;

/*
Make arraysize = to 1500 for 328P chip, 4000 for 1280P chip?,
3600 for 644P chip, xxxx for 1284P,  etc.
*/
const int arraysize= 5000;  // value to mostly fill avalible flash capacity

long myInts0[arraysize] PROGMEM = {};  //Store initilized array into flash memory
long myInts1[arraysize] PROGMEM = {};
long myInts2[arraysize] PROGMEM = {};
long myInts3[arraysize] PROGMEM = {};

// the setup routine runs once when you press reset:
void setup() {               
  // initialize the digital pin as an output.
  pinMode(led, OUTPUT);
  Serial.begin(115200);
   digitalWrite(led, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(1000);               // wait for a second
  digitalWrite(led, LOW);    // turn the LED off by making the voltage LOW
  delay(1000);
  int i = random(0,arraysize);      // Work around any optimization for constant values
  Serial.print(myInts0[i]);         //  Access some random element so the array can't be optimized away.
  Serial.print(myInts1[i]);         //  Access some random element so the array can't be optimized away.
  Serial.print(myInts2[i]);         //  Access some random element so the array can't be optimized away.
  Serial.print(myInts3[i]);         //  Access some random element so the array can't be optimized away.
}

// the loop routine runs over and over again forever:
void loop() {
 
  digitalWrite(led, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(1000);               // wait for a second
  digitalWrite(led, LOW);    // turn the LED off by making the voltage LOW
  delay(1000);               // wait for a second
}


Code: [Select]
Binary sketch size: 83,994 bytes (of a 130,048 byte maximum)

Estimated used SRAM memory: 365 bytes
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: cyclegadget on Jan 19, 2013, 09:12 pm
Quote
One thing of interest - for arraysize > 4000 or so, the sketch no longer works correctly,
ie Led 13 does not flash after uploading. At 4000 and below, Led 13 blinks ok.


I agree.
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: retrolefty on Jan 19, 2013, 09:21 pm

Ok, here is some progress. I tried lefty's sketch, with arraysize set = 4000 to 7000.
I uploaded a dozen or so times, using both the FTDI Friend and the FTDI cable, and
it never failed to burn and verify properly. I still have the RX0 wirewrap wire
running inbetween the xtal pins, and no low-pass filter on the RX0 pin.

arraysize = 4000 gives a 67808 byte file, and 7000 gives 115808 bytes. Upload and
verify takes 70-sec for the 115808 byte file.

One thing of interest - for arraysize > 4000 or so, the sketch no longer works correctly,
ie Led 13 does not flash after uploading. At 4000 and below, Led 13 blinks ok.




Yes, that is a problem, and it's very likely that the sketch is not being loaded correctly after a certain size is reached even though it's less then maximum flash memory size. There is no AVRDUDE error reported after the upload, but obviously the blink program is not running after the upload. It's believed to be a bug in the bootloaders for large (but still legally sized) sketches. For instance when using the Uno's bootloader one can load up a sketch right up to near the flash memory maximum size limit, but with a mega1280 I can't even get close to near max size. Coding Badly is of the opinion that is a bug in older bootloaders and their interaction with AVRDUDE on large code size uploads. So if the 1284P bootloader is just a recompilation based on one of the older mega bootloader programs it may have 'inherited' the same problem. This should be investigated further but I'm afraid I'm not knowledgeable enough in software/bootloaders to be a direct help other then testing.

I guess a first step is for someone to try a different method to developing large sketch sizes just to make sure it's not my sketch causing the problem symptom. Anyone up for the challenge?

Lefty
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: oric_dan on Jan 19, 2013, 09:21 pm
For arraysize > 4000, the program does not appear to start. The Serial.print()
statements in setup() do not print either. I also added Serial.begin() that lefty left
out. So, out of one frying pan and into the next.
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: oric_dan on Jan 19, 2013, 09:27 pm
avrdude has probably been patched so many times, it's probably a wonder it works
at all. There is probably an int somewheres where there should be a long. arraysize
of 4000 gives a 67808 byte size file that is just over the 16-bit boundary.

Do you suppose the .hex file address indexing is handled correctly during compilation?
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: retrolefty on Jan 19, 2013, 09:35 pm

For arraysize > 4000, the program does not appear to start. The Serial.print()
statements in setup() do not print either. I also added Serial.begin() that lefty left
out. So, out of one frying pan and into the next.


Actually I didn't add the serial statements to have them output anything useful as that is why there is no Serial.begin(), it's a way someone showed me to keep the compiler from optimizing away the otherwise unused arrays. It the arrays are not referenced in the sketch they won't be created in the final compilation and thus the sketch size wont' grow in size.

Lefty
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: retrolefty on Jan 19, 2013, 09:37 pm

avrdude has probably been patched so many times, it's probably a wonder it works
at all. There is probably an int somewheres where there should be a long. arraysize
of 4000 gives a 67808 byte size file that is just over the 16-bit boundary.

Do you suppose the .hex file address indexing is handled correctly during compilation?


I don't know, but I really do believe it's a bootloader/AVRDUDE legacy bug that has not been fully explored or explained let alone solved for the larger mega size chips when using AVRDUDE. Testing with a 644P chip showed no problem loading up to very near it's flash limit size, so I think the problem is when using sketches larger then the 644P size is.

Lefty

Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: cyclegadget on Jan 19, 2013, 09:51 pm
I remove programem and made the array smaller, although it should fit the chip it uploads but, does not work.

Code: [Select]
Binary sketch size: 3,994 bytes (of a 130,048 byte maximum)

Estimated used SRAM memory: 48,365 bytes


Code: [Select]
//#include <avr/pgmspace.h>   //To store arrays into flash rather then SRAM
// Simple sketch to create large sketch sizes for testing purposes
/*
  Blink
  Turns on an LED on for one second, then off for one second, repeatedly.

  This example code is in the public domain.
*/

// Pin 13 has an LED connected on most Arduino boards.
// give it a name:
int led = 13;

/*
Make arraysize = to 1500 for 328P chip, 4000 for 1280P chip?,
3600 for 644P chip, xxxx for 1284P,  etc.
*/
const int arraysize= 3000;  // value to mostly fill avalible flash capacity

long myInts0[arraysize]  = {};  //Store initilized array into flash memory
long myInts1[arraysize]  = {};
long myInts2[arraysize]  = {};
long myInts3[arraysize]  = {};

// the setup routine runs once when you press reset:
void setup() {               
  // initialize the digital pin as an output.
  pinMode(led, OUTPUT);
  Serial.begin(115200);
   digitalWrite(led, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(1000);               // wait for a second
  digitalWrite(led, LOW);    // turn the LED off by making the voltage LOW
  delay(1000);
  int i = random(0,arraysize);      // Work around any optimization for constant values
  Serial.print(myInts0[i]);         //  Access some random element so the array can't be optimized away.
  Serial.print(myInts1[i]);         //  Access some random element so the array can't be optimized away.
  Serial.print(myInts2[i]);         //  Access some random element so the array can't be optimized away.
  Serial.print(myInts3[i]);         //  Access some random element so the array can't be optimized away.
}

// the loop routine runs over and over again forever:
void loop() {
 
  digitalWrite(led, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(1000);               // wait for a second
  digitalWrite(led, LOW);    // turn the LED off by making the voltage LOW
  delay(1000);               // wait for a second
}

Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: cyclegadget on Jan 19, 2013, 09:53 pm

SRAM memory issue?????
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: oric_dan on Jan 19, 2013, 09:53 pm
So, I assume the mega2560 chips also have problems above 64KB/whatever?
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: retrolefty on Jan 19, 2013, 09:56 pm
Quote
I remove programem and made the array smaller, although it should fit the chip it uploads but, does not work.

Code:
Binary sketch size: 3,994 bytes (of a 130,048 byte maximum)

Estimated used SRAM memory: 48,365 bytes


Well that isn't testing with rather large flash sizes and as the 1284P does not have SRAM that big I don't think it's a legit test to hang one's hat on. We need another sketch that creates large sketch flash sizes independent of my sketch to verify it's not a sketch problem but rather just a sketch size problem.

Lefty
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: retrolefty on Jan 19, 2013, 09:58 pm

So, I assume the mega2560 chips also have problems above 64KB/whatever?



I would bet so, but don't have a mega2560 board to test, just a arduino mega1280 and a seeeduino mega1280 board that both choke on larger sketch sizes.

Lefty
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: leo72 on Jan 19, 2013, 10:03 pm

Yes, that is a problem, and it's very likely that the sketch is not being loaded correctly after a certain size is reached even though it's less then maximum flash memory size. There is no AVRDUDE error reported after the upload, but obviously the blink program is not running after the upload. It's believed to be a bug in the bootloaders for large (but still legally sized) sketches. For instance when using the Uno's bootloader one can load up a sketch right up to near the flash memory maximum size limit, but with a mega1280 I can't even get close to near max size. Coding Badly is of the opinion that is a bug in older bootloaders and their interaction with AVRDUDE on large code size uploads. So if the 1284P bootloader is just a recompilation based on one of the older mega bootloader programs it may have 'inherited' the same problem. This should be investigated further but I'm afraid I'm not knowledgeable enough in software/bootloaders to be a direct help other then testing.

I guess a first step is for someone to try a different method to developing large sketch sizes just to make sure it's not my sketch causing the problem symptom. Anyone up for the challenge?

Lefty

There's a problem related to a bug inside the GNU avr-gcc compiler. If I remember well, the compiler cannot create code that can directly access data in FLASH is it is stored over the 64 kB limit. Latest versions of avr-gcc aren't affected by this bug, the one that is included with the Ardino IDE is.
You can upgrade the Avr toolchain to fix it. I did it for my Linux box.
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: oric_dan on Jan 19, 2013, 10:07 pm

SRAM memory issue?????

Yeah, 1284 has only 16KB of SRAM. Setting arraysize up to 960 = 4*4*960 = 15360 bytes
works, but arraysize = 1000 crashes, since there isn't room left for the background functions
and serial buffers.

Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: oric_dan on Jan 19, 2013, 10:31 pm
Ok, I do have a mega2560 board [although only used a couple of times], and I tested
lefty's sketch. It works the same as on the 1284 chip. For arraysize = 4000, it uploads
and runs, but at arraysize = 7000, it uploads and verifies ok, but the sketch doesn't run.

And I am using Enhanced IDE ERW v.1.03 here, so the toolchain fix doesn't seem to have
gotten over into the latest version here either.

And yet another problem. With ERW 1.03, starting Serial Monitor does NOT send a reset
to the mega2560 board. I have to reset manually. Sheesh.

Ok, I went back to test Serial Monitor on both IDE 1.0 and 1.03, and they both send a
reset to the atmega2560 board when you open Serial Monitor. So, triple sheesh - it's
aways something around this place!
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: cyclegadget on Jan 19, 2013, 10:48 pm
Quote
starting Serial Monitor does NOT send a reset


The ERW author felt is was best to remove the reset feature/problem. It depends how you look at it. If you read some of his posts in the last few pages of his thread, he explains how to modify the serial monitor behavior.
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: retrolefty on Jan 20, 2013, 12:18 am


Yes, that is a problem, and it's very likely that the sketch is not being loaded correctly after a certain size is reached even though it's less then maximum flash memory size. There is no AVRDUDE error reported after the upload, but obviously the blink program is not running after the upload. It's believed to be a bug in the bootloaders for large (but still legally sized) sketches. For instance when using the Uno's bootloader one can load up a sketch right up to near the flash memory maximum size limit, but with a mega1280 I can't even get close to near max size. Coding Badly is of the opinion that is a bug in older bootloaders and their interaction with AVRDUDE on large code size uploads. So if the 1284P bootloader is just a recompilation based on one of the older mega bootloader programs it may have 'inherited' the same problem. This should be investigated further but I'm afraid I'm not knowledgeable enough in software/bootloaders to be a direct help other then testing.

I guess a first step is for someone to try a different method to developing large sketch sizes just to make sure it's not my sketch causing the problem symptom. Anyone up for the challenge?

Lefty

There's a problem related to a bug inside the GNU avr-gcc compiler. If I remember well, the compiler cannot create code that can directly access data in FLASH is it is stored over the 64 kB limit. Latest versions of avr-gcc aren't affected by this bug, the one that is included with the Ardino IDE is.
You can upgrade the Avr toolchain to fix it. I did it for my Linux box.


I guess that could be it, but I think I've read it speculated in the past that it is something to do with the AVRDUDE/bootloader protocol of stk500 or stk500v1 that is responsible for this behaviour.

Sheesh, you would think as long as the arduino mega1280/2560 boards have been available that the exact problem and or solution would have been well known and published by now? I sure it's not common to write sketches greater then 64KB but you think a few have had the need?

Lefty
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: oric_dan on Jan 20, 2013, 04:54 am
Quote
Sheesh, you would think as long as the arduino mega1280/2560 boards have been available that the exact problem and or solution would have been well known and published by now? I sure it's not common to write sketches greater then 64KB but you think a few have had the need?


Sheesh, that makes 4 sheeshs now. I'm not too surprised that Arduinophiles in general aren't
writing too many programs over 64KB, but you'd think some might have. For my part, the
control s.w. for my robot tank exceeded 32KB code and 2KB RAM way last spring, so I've
wanted a larger space chip in a small size board [ala 1284 & UNO formfactor] to keep growing,
but even 64KB will be gone quickly. Hmmm.

It's also amazing the 1284 chips have been the object of 2000-3000 posts now on multiple
threads, and the limitations aren't flagged everywheres. Guess I'll have to learn how to
bypass the bootloader.

Is it possible to develop code using the Arduino IDE, with its libraries etc, and upload those
.hex files via a regular ICSP programmer, or will they not run without having the bootloader
to bootstrap off of?

Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: retrolefty on Jan 20, 2013, 05:11 am
Quote
Is it possible to develop code using the Arduino IDE, with its libraries etc, and upload those
.hex files via a regular ICSP programmer, or will they not run without having the bootloader
to bootstrap off of?


Sure, the current IDE supports in the files/menu option of upload sketch using programmer that will use your selected programmer (such as arduinoISP) to burn the sketch directly into flash without needing a bootloader, in fact if the chip had a bootloader installed prior to uploading using programmer, it will end up with no bootloader, just the sketch when completed.

HOWEVER the big question is will this change the large sketch not large enough problem? That depends on if the root cause is the bootloader/AVRDUDE or if the compiler version is the root cause. I'll see if I can play around and see if I get different results using upload using programmer on my mega1280 board.

Lefty
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: retrolefty on Jan 20, 2013, 05:50 am
So I tried uploading large size mega1280 sketches without using the serial bootloader, but rather the upload using programmer option using another arduino running the arduinoISP sketch as the hardware programmer. The results were no change in symptom, I still could not load a mega1280 board to near it's maximum flash size limit.

So that would tend to appear to lend credence that it's a tool chain version cause (Although there may still be an issue with AVRDUDE and the protocol it uses with the arduinoISP programmer sketch I guess, we would need someone with a different hardware programmer, such as a AVRISP mkII to test out the problem), and explain the reason the problem has not be addressed even if known by the arduino developer's group.  I have read them discussing about upgrading the AVR tool chain for quite a long time but there appears to be a lot of resistance as the upgrade carries the possibility of breaking a lot of older sketches and library code and unless there was clear benefits identified, some question upgrading the tool chain?

Oh well, it's not as if I thought I could fix the problem by myself, I just wanted to more clearly understand if there was a real problem or not ( it's real ), what it's root cause is (probably the tool chain? ), and what if any fix one might apply to the situations (I'm stuck). So I've kind of reached my limit of usefulness and will just stand back unless asked something about the issue.

Lefty
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: oric_dan on Jan 20, 2013, 06:45 pm
lefty, do you know if avrdude was built by Atmel as part of an official tool set, or something
jinned up by freaks? If by Atmel, one might think they would have proofed it on their larger chips,
and it would be 100%. Microchip's tools like MPLAB are continually updated to reflect their newer
chips.

Quote
There's a problem related to a bug inside the GNU avr-gcc compiler. If I remember well, the compiler cannot create code that can directly access data in FLASH is it is stored over the 64 kB limit. Latest versions of avr-gcc aren't affected by this bug, the one that is included with the Ardino IDE is.
You can upgrade the Avr toolchain to fix it. I did it for my Linux box.

leo, have you tried uploading files > 64KB to your boards, and had the programs run successfully?
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: retrolefty on Jan 20, 2013, 07:26 pm
AVRDUDE is it's own independent open source project with no 'official' relationship to Atmel or Arduino that I am aware of.

http://savannah.nongnu.org/projects/avrdude

Lefty
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: oric_dan on Jan 20, 2013, 08:12 pm

AVRDUDE is it's own independent open source project with no 'official' relationship to Atmel or Arduino that I am aware of.

http://savannah.nongnu.org/projects/avrdude

Lefty

I notice that the avrdude version installed with IDE v1.03 is dated 2 Sept 2011, so it's fairly recently
updated. Do you know any of those people who you could contact about the > 64KB issue?

OTOH, the avrdude version supplied with enhanced ERW IDE v.1.03 is dated 5 Nov 2012, and that
IDE still didn't upload working code, re post #75. It sounds like there may be 3 problems needing
fixing: IDE toolchain, avrdude, optiboot/others.
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: retrolefty on Jan 20, 2013, 08:34 pm
I don't believe the issue(s) have anything to do with AVRDUDE directly. It's what protocol type any specific bootloader code is using to work with AVRDUDE, which can handle several different protocols of which some have no problem writing to large flash memory sizes such as the SK500v2 protocol. That would effect the ability to load large sketches I believe. The other related issue but different is the ablitiy to properly create large sketches using the PROGMEM attribute, which seems to be a AVR gcc compiler bug/limitation.

I truly believe we have not uncovered any new problems, or problems that don't have a work around. For instance I'm sure someone can easily create super large sketches that don't rely on using the PROGMEM command. I also believe the a 'correct' bootloader for any specific chip type that uses the SK500v2 protocol with AVRDUDE would be able to load such large sketches. It's just identifying all the correct pieces and parts and implementing them correctly in the custom hardware folder. I suspect the current 1284p bootloader is correct and would test ok with a 'real' sketch of large proportions if they don't utilize PROGMEM to build that sketch.

At least that is my current take on what we are seeing.

Lefty
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: oric_dan on Jan 20, 2013, 09:20 pm
I started a new thread on this issue, see if we can get any enlightenment?

http://arduino.cc/forum/index.php/topic,143876.0.html

Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: leo72 on Jan 21, 2013, 10:59 am

Sheesh, you would think as long as the arduino mega1280/2560 boards have been available that the exact problem and or solution would have been well known and published by now? I sure it's not common to write sketches greater then 64KB but you think a few have had the need?

Lefty

Yes I Do say that the current Avr toolchain that is included in the Arduino IDE doesn't let the user write a sketch that isn't affected by that bug.
The bug only affects the access of data in the FLASH memory over the 64 kB limit, not the execution of code in that space.

The problem is inside the avr-gcc compiler.
The bug that cannot permit to access data from the Flash put over the 64 kB limit has been solved in avr-gcc 4.3.5 (or 4.4, I don't remember exactly) but the Arduino IDE comes with avr-gcc 4.3.2, and the bug is present.

EDIT: Moreover, the avr-gcc 4.3.2 has another limit: it cannot compile functioning sketches bigger than 128 kB (64 kBword).

EDIT2:
here is the a bug segnalation concerning the 64 kB limit with the data access. It's dated 9 oct 2012, so it's recent.
http://code.google.com/p/arduino/issues/detail?id=1067

Here is the guide to update the software using the latest toolchian from Atmel:
[LINUX]: http://www.leonardomiliani.com/2012/come-aggiornare-la-toolchain-avr-alla-versione-3-4-1-linux/?lang=en
[WIN]: http://www.open-electronics.org/arduino-full-memory-upgrade-to-the-last-atmel-toolchain-version/
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: oric_dan on Jan 21, 2013, 05:45 pm
leo, thanks for the information. I know nothing myself about using the raw AVR toolchain,
just the Arduino IDE stuff.

My results seem to agree with you, in that PROGMEM usage > 64KB is broken, however,
I did manage to build a large program and upload to the mega2560, with binary size of
212,525 bytes, and which seemed to work ok. See post #13.

http://arduino.cc/forum/index.php/topic,143876.0.html
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: oric_dan on Jan 21, 2013, 06:26 pm
In the end, after everything these mega1284 threads have been through, I'm still
not certain why many people are having the uploading problem. I haven't needed
the low-pass filter on RX0, and my tests earlier indicated I couldn't even reproduce
the upload problem by running the RX0 line directly through the crystal area, or
under and between the xtal pins. So ????
...........

However, I did discover a sensitivity that I forgot to mention earlier. On my mega1284
proto-test board, I am using a 6-pin header to connect the FTDI cable and FTDI Friend.
Otherwise, the RX0 pin was floating.

I found you "definitely" need to have a pullup on RX0, for when the FTDI interface is
not connected. This stands to reason, of course, as you will otherwise get noise
injected on that pin. However, unlike essentially every "other" pin on the chip, which
will be floating unless specifically terminated, noise coming in on RX0 will actually reset
the chip.

I did this test by touching each of the 1284 pins with my finger [my usual try to kill
the chip test]. Doing this had no effect for other pins, but touching the floating RX0
pin "always" reset the processor immediately. So, this is interesting....
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: leo72 on Jan 22, 2013, 11:15 am
I read here (http://www.seanet.com/~karllunt/1284pmemprob.html) that a 1283P owner suggested that these RX0 pin problems could be related to the PicoPower version of the chip.
Do you have a "non-P" chip to try if it shows the same behaviour (I don't have it)?
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: retrolefty on Jan 22, 2013, 03:27 pm

In the end, after everything these mega1284 threads have been through, I'm still
not certain why many people are having the uploading problem. I haven't needed
the low-pass filter on RX0, and my tests earlier indicated I couldn't even reproduce
the upload problem by running the RX0 line directly through the crystal area, or
under and between the xtal pins. So ????
...........

However, I did discover a sensitivity that I forgot to mention earlier. On my mega1284
proto-test board, I am using a 6-pin header to connect the FTDI cable and FTDI Friend.
Otherwise, the RX0 pin was floating.

I found you "definitely" need to have a pullup on RX0, for when the FTDI interface is
not connected. This stands to reason, of course, as you will otherwise get noise
injected on that pin. However, unlike essentially every "other" pin on the chip, which
will be floating unless specifically terminated, noise coming in on RX0 will actually reset
the chip.

I did this test by touching each of the 1284 pins with my finger [my usual try to kill
the chip test]. Doing this had no effect for other pins, but touching the floating RX0
pin "always" reset the processor immediately. So, this is interesting....




I believe this is the same failure mode/symptom that people having trouble uploading via RX0, noise being injected via RX0 corrupting internal data bus.

Lefty
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: oric_dan on Jan 22, 2013, 08:06 pm

I read here (http://www.seanet.com/~karllunt/1284pmemprob.html) that a 1283P owner suggested that these RX0 pin problems could be related to the PicoPower version of the chip.
Do you have a "non-P" chip to try if it shows the same behaviour (I don't have it)?

leo, so far I have been using only the 1284 "non-P" version, and have had no problems
with those. Today I ordered some of the 1284P chips, so will see how those work in a
couple of days.
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: leo72 on Jan 23, 2013, 10:10 am


I read here (http://www.seanet.com/~karllunt/1284pmemprob.html) that a 1283P owner suggested that these RX0 pin problems could be related to the PicoPower version of the chip.
Do you have a "non-P" chip to try if it shows the same behaviour (I don't have it)?

leo, so far I have been using only the 1284 "non-P" version, and have had no problems
with those. Today I ordered some of the 1284P chips, so will see how those work in a
couple of days.

OK. I stay tuned  ;)
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: john1993 on Jan 24, 2013, 08:00 pm
i can verify atmel is correct stating that uart0 is a customer layout problem. a client came to me with an m1284p board that failed to upload and we found adding a guard ring around the pin fixed it. there were several other avrs showing similar problems over the years, 90s1200 and 90s8515 being infamous examples. in every case proper layout fixed it.
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: oric_dan on Jan 24, 2013, 08:11 pm
John, do you have any idea if adding a guard ring around the next-door crystal cktry will
have a similar effect?
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: john1993 on Jan 24, 2013, 08:39 pm
most of the dozen or so occurences ive seen were spurious interrupts and resets due to fast signals nearby and not so much crystal issues. in the case i just mentioned and most others autorouted fill pretty much served as guard ring for the clock pins. maybe thats why this did not seems to be the cause for us. i do know there were several choices for a fix that worked and narrowed it down to resistor (no cap) right on the rx pin or ground ring. chose the latter because partlist and schematic stayed the same and much easier to refit existing boards.
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: oric_dan on Jan 24, 2013, 08:48 pm
A dozen - that's pretty serious. Can you explain the bit about "fast signals nearby" a little more.
What exactly are you talking about here? I'm not even sure what fast signals on an Arduino even
means, as I/O is pretty slow in general. The crystal oscillator is by far the fastest. Thanks.
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: E40racer on Jan 24, 2013, 09:20 pm
A couple of months ago I had a PCB made for the ATmega1284 by Seeed. I've only been playing with electronics/Arduino for a year. So I was a bit nervous, would it work? To make it even more interesting it's powered by a LM2596 switch mode voltage regulator. I have now used the board extensively, uploaded hundreds of sketches and have not had any issues. Maybe I'm lucky? I even put the crystal and caps inside the socket. The board has an I2C logic level converter to talk to 3V3 I2C sensors and a header for a nRF24L01 wireless module. I have not tried uploading really big sketch. My biggest sketch is 30kb, anyone have an example of a really big sketch (+64kb) that I could upload?
Pic of my board: http://www.bajdi.com/wp-content/uploads/2012/12/bajduino-mega-3A.jpg
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: john1993 on Jan 24, 2013, 09:28 pm

A dozen - that's pretty serious. Can you explain the bit about "fast signals nearby" a little more.
What exactly are you talking about here? I'm not even sure what fast signals on an Arduino even
means, as I/O is pretty slow in general. The crystal oscillator is by far the fastest. Thanks.


actually avr has faster io than most other chips of its type. not high frequency, high drive capability. it contributes to fast rise and fall times and avr are very high current. the xtl signal is quite slow by comparison and may actually be a sine wave if ckopt aint enabled.

but this is not what im talking about. it was external signals coming from outside the chip and not so much self-interference. specially if there were long wires from external serial. even 50ohm or 100ohm suppressed so im guessing its transmission line ringing. probably really skinny hv pulses causing clamp zeners to forward bias. that can show up in completely unrelated areas of the chip and totally unpredictable. even 100k+ worked but because im fond of avr pull-ups 1-2k would be a better choice for the series resistor there. but like i said we decided on pcb shielding instead in the case of the m1284p. btw as others noted m1284 in the same socket did not show the problem.
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: oric_dan on Jan 24, 2013, 09:51 pm
Quote
Pic of my board: http://www.bajdi.com/wp-content/uploads/2012/12/bajduino-mega-3A.jpg


Interesting, I see you're using the 1284P chip here, which is the one people have been having all
the trouble with. So, you have an smt crystal and caps underneath the chip?
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: oric_dan on Jan 24, 2013, 09:59 pm
Quote
but this is not what im talking about. it was external signals coming from outside the chip and not so much self-interference. specially if there were long wires from external serial. even 50ohm or 100ohm suppressed so im guessing its transmission line ringing. probably really skinny hv pulses causing clamp zeners to forward bias. that can show up in completely unrelated areas of the chip and totally unpredictable. even 100k+ worked but because im fond of avr pull-ups 1-2k would be a better choice for the series resistor there. but like i said we decided on pcb shielding instead in the case of the m1284p. btw as others noted m1284 in the same socket did not show the problem.


Ok, thanks, John, external signals. "even 50ohm or 100ohm suppressed" - is this on the pcb or at
the source? There is such a thing as "source series termination", which is using a 50R series-R at
the source end to quench ringing on a long line, and it works really really well.

There is also an issue with the RX0 pin floating. On my proto-test pcb, I use an FTDI cable, and
when it was disconnected, I found the chip would reset and reboot by touching the RX0 pin [no
other pins did this, except sometimes the xtal pins]. A pullup fixed the problem.

Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: E40racer on Jan 24, 2013, 10:01 pm

Quote
Pic of my board: http://www.bajdi.com/wp-content/uploads/2012/12/bajduino-mega-3A.jpg


Interesting, I see you're using the 1284P chip here, which is the one people have been having all
the trouble with. So, you have an smt crystal and caps underneath the chip?


It's a 16MHz low profile through the hole crystal from Tayda electronics (I buy most of my stuff there). Inside the socket there is also a small inductor and capacitor (between vcc and avcc). 
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: oric_dan on Jan 26, 2013, 08:17 am



I read here (http://www.seanet.com/~karllunt/1284pmemprob.html) that a 1283P owner suggested that these RX0 pin problems could be related to the PicoPower version of the chip.
Do you have a "non-P" chip to try if it shows the same behaviour (I don't have it)?

leo, so far I have been using only the 1284 "non-P" version, and have had no problems
with those. Today I ordered some of the 1284P chips, so will see how those work in a
couple of days.

OK. I stay tuned  ;)

Alright, I received 4 atmega1284P chips today, data code = 1247. Definitely got the "P"
version this time. I've uploaded my large 84Kbyte program now about a dozen times total
into the 4 chips. Still using my proto-shield turned 1284 test board. I am not using a low-
pass filter on RX0.

Bad news is, I cannot repeat the upload and RX0 sensitivity problems that other people
have been seeing. Good news is, I cannot repeat the upload and RX0 sensitivity problems
that other people have been seeing. So, where I live, it always works, both non-P [data code
1216] and P [data code 1247] version chips.

Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: retrolefty on Jan 26, 2013, 03:54 pm




I read here (http://www.seanet.com/~karllunt/1284pmemprob.html) that a 1283P owner suggested that these RX0 pin problems could be related to the PicoPower version of the chip.
Do you have a "non-P" chip to try if it shows the same behaviour (I don't have it)?

leo, so far I have been using only the 1284 "non-P" version, and have had no problems
with those. Today I ordered some of the 1284P chips, so will see how those work in a
couple of days.

OK. I stay tuned  ;)

Alright, I received 4 atmega1284P chips today, data code = 1247. Definitely got the "P"
version this time. I've uploaded my large 84Kbyte program now about a dozen times total
into the 4 chips. Still using my proto-shield turned 1284 test board. I am not using a low-
pass filter on RX0.

Bad news is, I cannot repeat the upload and RX0 sensitivity problems that other people
have been seeing. Good news is, I cannot repeat the upload and RX0 sensitivity problems
that other people have been seeing. So, where I live, it always works, both non-P [data code
1216] and P [data code 1247] version chips.



Ah, but did you wait and try at a low tide? How about a full moon? Environmental effects can be hard to sort out sometimes.
:D 
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: oric_dan on Jan 26, 2013, 08:27 pm
Actually, the moon just hit full-phase here, but I don't know about so.cal. It has warmed up
greatly - a few days ago it was down to 8 degF at night, now it's not below freezing.

In any case, my plans are to use the 1284P chip, in order that I don't have to keep patching
avrdude.conf for the non-P version, and on my pcb layout, I added both a low-pass filter on
RX0, plus a guard ring around the pin, and also added a pullup on RX0 for when the FTDI
cable is not connected. Lastly, am hoping the weather doesn't change again.

Also, thanks for straightening me out on the variants pins_arduino.h files. I now realize the
same optibootloader is burned into all the variants, and this file is only used during compilation.
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: leo72 on Jan 28, 2013, 06:27 pm
During the last days I did a lot of tests trying to solve the problem.
If you're using the Mighty-1284p files (https://github.com/maniacbug/mighty-1284p) by maniacbug, select the board "Mighty 1284p 16 MHz w/Optiboot" then put a 220K resistor in series on the line beetween the FT232 TX and the 1284p RX0 pins.

If you're using the "Original Mighty 1284p" board, then you could try with a 120K R. Or, maybe, without components.

With my 1284P, I was able to flash a sketch using a 175K over the line beetween my Arduino UNO R1 RX pin and the 1284P RX0 pin when I chose the 1284p board. Using the "Original Mighty" board, I was able to flash a sketch with no extra components. Using this board, remember to check the upload speed in file boards.txt: it has to be set a 57600 (it is by default).
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: oric_dan on Jan 28, 2013, 08:49 pm

During the last days I did a lot of tests trying to solve the problem.
If you're using the Mighty-1284p files (https://github.com/maniacbug/mighty-1284p) by maniacbug, select the board "Mighty 1284p 16 MHz w/Optiboot" then put a 220K resistor in series on the line beetween the FT232 TX and the 1284p RX0 pins.

If you're using the "Original Mighty 1284p" board, then you could try with a 120K R. Or, maybe, without components.

With my 1284P, I was able to flash a sketch using a 175K over the line beetween my Arduino UNO R1 RX pin and the 1284P RX0 pin when I chose the 1284p board. Using the "Original Mighty" board, I was able to flash a sketch with no extra components. Using this board, remember to check the upload speed in file boards.txt: it has to be set a 57600 (it is by default).

Hi leo, I don't understand. You're actually bridging the Rx and Tx pins using a 220K resistor?
What does that do? Where did that idea come from?

Also, isn't 175K greater than the 1284P program space?

Also, I don't understand why the UNO board is in there during sketch uploading. ??

Also, I think the 1284P optiboot uses 115,200.

So, I don't understand anything here. [early morning] ?????

Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: john1993 on Jan 29, 2013, 01:25 am

Ok, thanks, John, external signals. "even 50ohm or 100ohm suppressed" - is this on the pcb or at
the source? There is such a thing as "source series termination", which is using a 50R series-R at
the source end to quench ringing on a long line, and it works really really well.


any long wires hanging directly off the pin can be a source of noise pulse pickup so the series resistor had to be right on the avr pin to solve the problem. and youre right about low value series being common. specially high speed dram bus where pico-seconds matter. but for the rx0 problem 1k or 2k is better. has added advantge of allowing direct connection to 12v rs232 equipment w/o issues.

and i saw the xtl pin reset too but not much you can do about that except dont touch them. :)
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: leo72 on Jan 29, 2013, 02:16 pm

Hi leo, I don't understand. You're actually bridging the Rx and Tx pins using a 220K resistor?

No. I put a 175K in series on the line between the Arduino pin and the 1284 pin.
Arduino RX ------ R ------- RX0 1284P

Quote

What does that do? Where did that idea come from?

A friend of mine investigated the problem using an oscilloscope and he went to the result that the 1284p bootloader based on the Optiboot 4.5 works too early. It sends the reset and then start sending the datas on the line. A R introduces a little retard on the transmission, helping the bootloader to properly receive the datas.

Quote

Also, isn't 175K greater than the 1284P program space?

I was talking about R values, not firmware sizes  :smiley-sweat:

Quote

Also, I don't understand why the UNO board is in there during sketch uploading. ??

I don't have an USB/serial board, so I removed the chip from my Arduino and I use the Atmega8U2 as a USB/serial converter.

Quote

Also, I think the 1284P optiboot uses 115,200.

The Optiboot 4.5 works at 115,200, the other bootloader included in the maniacbug's core is based on the Stk500v2 bootloader from Atmel, also used on oldest Arduinos (like 2009). It works at 57,600 and has a better management of the timings.

Quote

So, I don't understand anything here. [early morning] ?????



I hope I have explained better  ;)
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: retrolefty on Jan 29, 2013, 03:19 pm
Quote
A friend of mine investigated the problem using an oscilloscope and he went to the result that the 1284p bootloader based on the Optiboot 4.5 works too early. It sends the reset and then start sending the datas on the line. A R introduces a little retard on the transmission, helping the bootloader to properly receive the datas.


This sounds technically incorrect on many levels. The resistor may be acting as a low pass filter element in conjunction with the Rx input pin capacitance but that is all, there is no 'delay' possible otherwise. So if this does help then it's just a simpler one component low pass filter design, just like the resistor/cap low pass filter 'solution'.

Lefty
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: leo72 on Jan 29, 2013, 06:40 pm

This sounds technically incorrect on many levels. The resistor may be acting as a low pass filter element in conjunction with the Rx input pin capacitance but that is all, there is no 'delay' possible otherwise. So if this does help then it's just a simpler one component low pass filter design, just like the resistor/cap low pass filter 'solution'.

Lefty

It did help. Your explanation sounds correct. I didn't think about the internal capacitance of the pin.

BTW I solved using the bootloader based on the Stk500v2 code included in the maniacbug's package. Burning that bootloader I can upload a sketch with no external components.
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: oric_dan on Jan 29, 2013, 07:53 pm


This sounds technically incorrect on many levels. The resistor may be acting as a low pass filter element in conjunction with the Rx input pin capacitance but that is all, there is no 'delay' possible otherwise. So if this does help then it's just a simpler one component low pass filter design, just like the resistor/cap low pass filter 'solution'.

Lefty

It did help. Your explanation sounds correct. I didn't think about the internal capacitance of the pin.

BTW I solved using the bootloader based on the Stk500v2 code included in the maniacbug's package. Burning that bootloader I can upload a sketch with no external components.


leo, thanks for the explanation. I guess I read everything backwards! With a 175K series-R and
talk of slowing things down, I would immediately assume it's a low-pass filter in conjunction
with the RX0 pin input impedance. Eg, R*C = 175K * 20pF = 3.5 usec approx. And the 10K,
100pF filter others are using would have similar effect.

As mentioned, I've been using maniacbug's optiboot at 115.2, and no low-pass, and have not
worried about any reset delays, and have had no problems with anything. And my 1284 test
board is a jumble of wires. So, still a little fuzzy about what's going on with everyone else.

I would think one could try patching maniacbug's optiboot to check for a delay problem.
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: pito on Feb 01, 2013, 07:16 pm
I've taken my old 1284p off the shelf and tried to flash the mighty-optiboot (hex latest from repo, IDE 1.5.1r2, 16MHz xtal, 115k2), with no success. I am using Usbasp, optiboot_atmega1284p.hex from repo and from the forum topics as well (not compiled by myself yet), and all possible fuses settings.
When burned in I do not see the led on pin 13 flashing few times (D13 on mighty pin layout I guess) after a reset and the upload of a sketch shows:
Code: [Select]
..Binary sketch size: 15,508 bytes (of a 130,048 byte maximum)
processing.app.debug.RunnerException
at processing.app.debug.BasicUploader.uploadUsingPreferences(BasicUploader.java:126)
at processing.app.Sketch.upload(Sketch.java:1664)
at processing.app.Sketch.exportApplet(Sketch.java:1623)
at processing.app.Sketch.exportApplet(Sketch.java:1595)
at processing.app.Editor$DefaultExportHandler.run(Editor.java:2393)
at java.lang.Thread.run(Thread.java:619)


"Upload Using Programmer" (with the same Usbasp) works fine.
A similar setup with 328p and optiboot works fine here as well. It seems to me the 1284p' optiboot hex file includes something my programmer cannot process properly..

PS: when trying to burn the bootloader via Usbasp from IDE (Tools/Burn Bootloader) I get:
Code: [Select]

processing.app.debug.RunnerException
at processing.app.debug.BasicUploader.burnBootloader(BasicUploader.java:288)
at processing.app.Editor$47.run(Editor.java:2509)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)

And my board:
Code: [Select]
##############################################################
mighty_opt.name=Mighty 1284p 16MHz using Optiboot
mighty_opt.upload.protocol=arduino
mighty_opt.upload.maximum_size=130048
mighty_opt.upload.speed=115200
mighty_opt.bootloader.low_fuses=0xff
mighty_opt.bootloader.high_fuses=0xde
mighty_opt.bootloader.extended_fuses=0xfd
#mighty_opt.bootloader.path=optiboot1284p
mighty_opt.bootloader.file=optiboot1284p/optiboot_atmega1284p.hex
mighty_opt.bootloader.unlock_bits=0x3F
mighty_opt.bootloader.lock_bits=0x0F
mighty_opt.build.mcu=atmega1284p
mighty_opt.build.f_cpu=16000000L
#mighty_opt.build.core=arduino:arduino
mighty_opt.build.core=standard1284p
mighty_opt.build.variant=mighty
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: retrolefty on Feb 01, 2013, 08:51 pm
I have a USBtiny programmer that also fails to burn the optiboot onto a 1284P chip, but can do it for a 644P chip. But this is a known limitation of the USBtiny programmer not being able to handle addresses higher then 64KB. But I was able using a standard arduino board to burn the optiboot loader onto the 1284P chip using Nick's great sketch. It has the optiboot loader code built into the sketch so the IDE is not involved.

http://www.gammon.com.au/forum/?id=11635

Lefty
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: pito on Feb 01, 2013, 09:15 pm
Frankly, I am not aware of the fact Usbasp cannot flash at the top addresses. I used it with amforth for example - afaik it stores code on the top within the bootloader section - no issues ever..
So burned in with Nick's code:
Code: [Select]
Atmega chip programmer.
Written by Nick Gammon.
Entered programming mode OK.
Signature = 0x1E 0x97 0x05
Processor = ATmega1284P
Flash memory size = 131072 bytes.
LFuse = 0xFF
HFuse = 0xDE
EFuse = 0xFD
Lock byte = 0xFF
Clock calibration = 0x53
Bootloader address = 0x1FC00
Bootloader length = 508 bytes.
Type 'V' to verify, or 'G' to program the chip with the bootloader ...
Erasing chip ...
Writing bootloader ...
Committing page starting at 0x1FC00
Committing page starting at 0x1FD00
Written.
Verifying ...
No errors found.
Writing fuses ...
LFuse = 0xFF
HFuse = 0xDE
EFuse = 0xFD
Lock byte = 0xEF
Clock calibration = 0x53
Done.
Type 'C' when ready to continue with another chip ...


And uploading the working sketch:
Code: [Select]
Binary sketch size: 15,558 bytes (of a 130,048 byte maximum)
processing.app.debug.RunnerException
at processing.app.debug.BasicUploader.uploadUsingPreferences(BasicUploader.java:126)
at processing.app.Sketch.upload(Sketch.java:1664)
at processing.app.Sketch.exportApplet(Sketch.java:1623)
at processing.app.Sketch.exportApplet(Sketch.java:1595)
at processing.app.Editor$DefaultExportHandler.run(Editor.java:2393)
at java.lang.Thread.run(Thread.java:619)

:~
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: retrolefty on Feb 01, 2013, 09:18 pm

Frankly, I am not aware of the fact Usbasp cannot flash at the top addresses. I used it with amforth for example - afaik it stores code on the top within the bootloader section - no issues ever..


And I too don't know if USBasp has such a limitation or not, just reporting that a USBtiny does and a simple work around for me was using an arduino board and Nick's program.

Lefty

Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: leo72 on Feb 01, 2013, 11:44 pm
I knew that USBasp didn't have the 64 kB limit.
This is from the changelog of the last version of the firmware:

Quote

usbasp.2011-05-28 (v1.4)
------------------------
- added support for controllers with flash >128kb (by Slawomir Fra?)
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: pito on Feb 02, 2013, 01:49 am
Ok, an interesting stuff, indeed.
1. LED is on PB0 on my board, it flashes after reset, all programmers work fine :)
2. I did some editing of the avrdudeconf (added resetdelay = 15, similar to uno, and added ..tool=avrdude into boards) - that causes the avrdude resets the BT pin32 (aka dtr) now before the upload (I am using a BT module).

So the upload started, but finished with errors already published here. I did about 70 uploads of a 15kB sketch and my current findings are as follows (chip date 1027, breadboard, good decoupled, short wires (5cm long Rx, Tx to BT), no crossing with other signals or crystal):
1. without pull up/down resistor on RX and w/ short wires the probability of a successful upload ~10%
2. with pull-up/down 10k res on Rx - about 40%
3. with serial 10k in RX - 100% upload, even with a 20cm long Rx wire and while the wire touched/hold during the upload (the 20cm wire at the 1284p's Rx pin side)
4. w/o the serial 10k and with 20cm long Rx wire no luck.

That behavior might be caused, except "Rx pin signal/noise sensitivity", by a reversal of the 1284p's  Rx input pin direction, even for a very short time, thus it fires against the other output (ftdi's or BT's Tx), and when the current peak is not limited (ie. by a serial resistor) it flips internally into an undefined state. Hopefully the bootloader does not change the Rx direction (or switches internal pullups on/off on that pin) somewhere in the code..

Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: pito on Feb 02, 2013, 03:11 am
I did following experiment - 58cm long Rx wire, passed beneath the crystal, did few loops with it creating a mess :) with 10k serial resistor wired as follows:

BTmodule_Tx --10kohm------>>---------58cm_wire------->>-----Crystal---->>----Rx pin 1284p

Uploaded an 127kB large sketch:
Code: [Select]

Binary sketch size: 127,052 bytes (of a 130,048 byte maximum)

Done 12x while touching the 58cm long wire during the upload from time to time - upload 100% ok. I did not test the code actually works, though :).

Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: pito on Feb 02, 2013, 10:28 am
Solved?
With Low Fuse= F7 (Full Swing Oscillator 16K CK + 45ms) I cannot reproduce the upload errors anymore (the 10k serial resistor is not needed). It could be the 1284p operated @16MHz and 3V3 needs full swing (more power), otherwise the nearby RX pin may influence (modulate) the crystal oscillator frequency (especially with the DIP package with larger capacitance between the pins) and it comes to errors then..
PS: XTAL1 pin13 (RX is 14) - is the input of the crystal oscillator (high impedance, easy to modulate), would be better to have XTAL2 pin - the oscillator output - there (low impedance, harder to modulate)..
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: pito on Feb 02, 2013, 12:17 pm
FYI - a simulation - signal from FTDI to the Rx pin, and Rx coupled via a parasitic capacitance to the XTAL1 pin of the 1284p's oscillator. For 3 parasitic capacitances - 1pF, 5pF, 10pF. You may see the effect on the frequency when the rising edge of the Rx signal comes in. May behave differently - depends on the gate (here 4011 gate model used), xtal (??), etc. parameters used.

Disclaimer: this is only a simple simulation with parts with different parameters as the 1284p probably includes. For demonstration purposes only. No warranties of any kind.
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: pito on Feb 02, 2013, 12:55 pm
And the same for 5pF parasitic capacitance between the pins and 200ohm (no resistor), 10k, 200k serial resistor. It seems the 200k does not create a glitch in the oscillation (in this simulation).

Disclaimer: simple simulation only, with different parts as included within 1284p. For demo purposes only. No warranties of any kind.

PS: The very bottom picture is probably the most realistic simulation out of all above- with 4049 inverter simulating the 1284p oscillator with more power (full swing), and 10pF capacitance between the RX and XTAL1 pins. The oscillator period changed from 127.1ns to 135.4ns after the Rx' rising edge (thus the frequency)..
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: oric_dan on Feb 02, 2013, 08:09 pm

Solved?
With Low Fuse= F7 (Full Swing Oscillator 16K CK + 45ms) I cannot reproduce the upload errors anymore (the 10k serial resistor is not needed). It could be the 1284p operated @16MHz and 3V3 needs full swing (more power), otherwise the nearby RX pin may influence (modulate) the crystal oscillator frequency (especially with the DIP package with larger capacitance between the pins) and it comes to errors then..
PS: XTAL1 pin13 (RX is 14) - is the input of the crystal oscillator (high impedance, easy to modulate), would be better to have XTAL2 pin - the oscillator output - there (low impedance, harder to modulate)..

Huh! It's extremely cool that you've been carrying on with this problem while the rest of us have
been sleeping!

I don't know anything about USBasp or the ATmega fuses, and can barely understand the
convoluted description of the latter in the 1284 d/s, but you may have solved the problem.
Ref Table 9-1, maniacbug's boards.txt setup uses the low-power oscillator, low fuses = 0xFF,
instead of full swing oscillator, low-fuses = 0xF7 and there lies the RX0 sensitivity problem.
Plus, possibly the XTAL1 is in the wrong place.

Sheesh, can this endless muckup on 7 continents be that simple? !!!



Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: pito on Feb 03, 2013, 07:39 pm
I am using it just now w/o the resistor on a noisy breadboard with F7 and it works fine, no issues yet.. ;)

BTW, the 328p arduinos are lucky not to be affected by the issue as well as the Rx and Tx pins are far away off the XTAL1 pin. Moreover, XTAL1 (the critical sensitive crystal oscillator input) is flipped around against the 1284p and close to GND - GND acts as a shielding (GOOD)! See below..

IMHO the issue severity depends on the design (parasitic capacitance), crystal parameters, 2 crystal capacitors values, and how off is the actual crystal frequency from the recommended ie for 115k2:
Code: [Select]
8MHz crystal
57k   3.7% error
115k 7.8% error
16MHz crystal
57k   2.1% error
115k 3.7% error

Thus even a small additional error introduced ie. by such frequency pulling by Rx signal edges may disturb the Uart communication easily..
That is my current understanding  :P If Atmel plans a new die revision, I would recommend them to swap the oscillator pins, my invoice will follow :)
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: oric_dan on Feb 03, 2013, 08:36 pm
Good analysis, I think. Funny how Atmel flipped XTAL1,2 around between the 328 and 1284.
Also, 2.1 and 3.7% errors are on the edge of reliability, AFAIAC.
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: pito on Feb 03, 2013, 08:38 pm
BTW - hand wired constructions usually have less parasitic capacitances as the PCBs do..
BTW2 - the capacitance between two adjacent rows on a solder-less breadboard is around 3.5pF..
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: tack on Feb 03, 2013, 11:06 pm
I've been uploading to my 1284P via ICSP due to this problem, even just a 23k sketch failed every time via the bootloader and serial.

I've just re-burnt the bootloader and tried the same sketch 3 times and it failed.

I added the 10k series resistor on RX0 and tried again and it worked!

Tried it 6 times and it uploaded 100%.

Removed the 10k resistor and it failed.

Replaced the resistor and it worked 3 times in a row again.

I'll now try re-burning the fuses with the 0xF7 low bit and report back.

EDIT: Used Nick's Bootloader Programmer (for the first time) to re-burn the bootloader and set the fuses (I changed Low Fuse from 0xFF to 0xF7 in his sketch) and retried the upload with no resistor. It worked! Now I just need a big sketch to verify it really.

The most profound thanks to you guys for working together to track down and find a solution to this problem. Ye, you can upload via ICSP, but when your board is in a device that means you have to take everything off the SPI bus. On the board I just had made I actually included a 4 pin DIP switch so I could separate everything else form the ICSP header for any code updates that needed to be programmed. I also have a serial header available as well.

Right, now it appears that the 644P family is in the sketch to be identified but there is no entry for a bootloader or fuses setup. Does anyone know how we might go about adding 644P support?
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: pito on Feb 03, 2013, 11:31 pm
Enclosed 127kB large sketch. Not to be run, just for upload tests.
Enjoy!

EDIT: deleted - please use the BLINK sketch below..
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: tack on Feb 03, 2013, 11:37 pm

Enclosed 127kB large sketch. Not to be run, just for upload tests.
Enjoy!

Thanks for that, but I can't compile and upload as it needs some libraries; NilTROS, NilAnaolg, NilSerial and SDFat

SDFat I can get, but I can't find the others at all so I'm guessing they are ones of your own?
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: pito on Feb 03, 2013, 11:41 pm
http://arduino.cc/forum/index.php/topic,144715.0.html
But you may take ANY sketch you have handy - just copy and paste those LARGE
Code: [Select]
byte PROGMEM atmega2560_v2 [] = {
0x0D, 0x94, 0x89, 0xF1, 0x0D, 0x94,

bla-bla stuff from the sketch I posted in it.. You can easily make 512kB sketch from it if you like :)
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: pito on Feb 03, 2013, 11:58 pm
This BLINK compiles 129,948 bytes. You have to have SdFat lib there.
Not for running, just for compile and 1284p upload test..
Remove your SDCARD when playing with it..
No warranties of any kind. Use at your own risk.. :P
Code: [Select]
Binary sketch size: 129,948 bytes (of a 130,048 byte maximum)
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: tack on Feb 04, 2013, 12:01 am
I managed to find the libraries to use your sketch.

O...M...G...It works!! 127k Sketch uploaded several times.

Fantastic work.
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: retrolefty on Feb 04, 2013, 12:12 am


Right, now it appears that the 644P family is in the sketch to be identified but there is no entry for a bootloader or fuses setup. Does anyone know how we might go about adding 644P support?


I have a optiboot version working on a 644P Bobuino board. I just used my USBtiny to burn the bootload, but the arduinoISP sketch should work also from the IDE once you have the bootloader saved in the correct folder and make the boards.txt entry.

Code: [Select]

:020000000504F5
:10FC0000112484B714BE81FFF2D085E08093810077
:10FC100082E08093C00088E18093C10086E08093F9
:10FC2000C20080E18093C4008EE0CBD0209A86E0B1
:10FC300020E33CEF91E0309385002093840096BB55
:10FC4000B09BFECF189AA8958150A9F7CC24DD244B
:10FC500088248394B5E0AB2EA1E19A2EF3E0BF2E69
:10FC6000A4D0813471F4A1D0082FB1D0023811F49E
:10FC700085E005C0013811F484E001C083E08DD037
:10FC800089C0823411F484E103C0853419F485E01D
:10FC9000A6D080C0853579F488D0E82EFF2485D0A1
:10FCA000082F10E0102F00270E291F29000F111F09
:10FCB0008ED068016FC0863521F484E090D080E05A
:10FCC000DECF843609F040C070D06FD0082F6DD0E1
:10FCD00080E0C81680EED80618F4F601B7BEE895A5
:10FCE000C0E0D1E062D089930C17E1F7F0E0CF16C5
:10FCF000F0EEDF0618F0F601B7BEE89568D007B65B
:10FD000000FCFDCFA601A0E0B1E02C9130E01196FF
:10FD10008C91119790E0982F8827822B932B129625
:10FD2000FA010C0187BEE89511244E5F5F4FF2E0A7
:10FD3000A030BF0751F7F601A7BEE89507B600FC53
:10FD4000FDCF97BEE89526C08437B1F42ED02DD0D4
:10FD5000F82E2BD03CD0F601EF2C8F010F5F1F4FF8
:10FD600084911BD0EA94F801C1F70894C11CD11CFE
:10FD7000FA94CF0CD11C0EC0853739F428D08EE10F
:10FD80000CD086E90AD08AE07ACF813511F488E078
:10FD900018D01DD080E101D063CF982F8091C00092
:10FDA00085FFFCCF9093C60008958091C00087FF27
:10FDB000FCCF8091C00084FD01C0A8958091C60051
:10FDC0000895E0E6F0E098E1908380830895EDDF08
:10FDD000803219F088E0F5DFFFCF84E1DECF1F939A
:10FDE000182FE3DF1150E9F7F2DF1F91089580E04B
:08FDF000E8DFEE27FF2709946C
:040000030000FC00FD
:00000001FF



And here is the boards.txt entry for the 644P

Quote

##############################################################


bobuino644.name=Bobuino 644P optiboot
bobuino644.upload.protocol=arduino
bobuino644.upload.maximum_size=63488
bobuino644.upload.speed=115200
bobuino644.bootloader.low_fuses=0xff
bobuino644.bootloader.high_fuses=0xdc
bobuino644.bootloader.extended_fuses=0xfd
bobuino644.bootloader.path=optiboot
bobuino644.bootloader.file=optiboot_atmega644p-4-5.hex
bobuino644.bootloader.unlock_bits=0x3F
bobuino644.bootloader.lock_bits=0x0F
bobuino644.build.mcu=atmega644p
bobuino644.build.f_cpu=16000000L
#bobuino644.build.core=arduino:arduino
bobuino644.build.core=standard
bobuino644.build.variant=bobuino

##############################################################


Lefty
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: pito on Feb 04, 2013, 01:09 am

..and there lies the RX0 sensitivity problem.


To clarify a little bit - No, it is not the "RX0 sensitivity" problem. That is an urban myth..

RX0 is perfectly fine.

It is definitely the XTAL1-pin placement problem (crystal oscillator input) - and most notably a not good decision at Atmel not to follow ie. the 328p as far as the crystal oscillator pins layout is concerned..
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: retrolefty on Feb 04, 2013, 05:33 am

lefty, where did you get this file? --> optiboot_atmega644p-4-5.hex


I think here:

http://code.google.com/p/optiboot/downloads/list

from here:

http://code.google.com/p/optiboot/

The only bootloader I can't remember a source site from is the optiboot compiled for the mega1280 chip which I found only after several days of searching. But I finely did locate a copy somewhere and now all my mega1280 boards (both of them LOL) are working well with optiboot.

Lefty
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: tack on Feb 04, 2013, 07:21 am


I managed to find the libraries to use your sketch.

O...M...G...It works!! 127k Sketch uploaded several times.

Fantastic work.

So, just to be sure, this is using the 0xF7 fuse setting, and no low-pass filter on RX0?

Correct.

With the Low Fuse Byte set at 0xFF, the default with the maniacbug files, a 10k series resistor in RX0 fixed upload.

Changing the Low Fuse Byte to 0xF7 cured the failed upload issue completely, with no series resistor or RC filter required at all.

Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: pito on Feb 04, 2013, 09:19 am
With original setting the crystal oscillator of the 1284p is set to a low-power mode. The oscillations are weaker and the oscillator's input (XTAL1 pin) is much more prone to be pulled/modulated by an external signal. As the analysis has shown it may even come to a stoppage of the oscillation.

The closest pin to the XTAL1 is the RX0 (uart input). When the data come to this RX0 pin from FTDI or other serial data source, the fast leading/falling edges of the serial data may pass through a parasitic capacitance, call it Cpar (Cpar is the capacitance between the XTAL1 and RX0 pins) to the oscillator's input (XTAL1) which is very sensitive in low power mode. The faster/steeper the edges of the data signal the easier they pass through. Even a small Cpar (a few pF) may let pass the serial data signal to XTAL1 pin and thus influence the crystal oscillator frequency (even shut him down).

When you put a serial resistor into the serial data path, you introduce a low-pass filter (RC), thus the edges of the data signal are more rounded, not so steep (not so fast, not so energetic, with less high frequency content), and they cannot pass via Cpar easily (because the Cpar is small), so the negative effect on the oscillator is smaller. Therefore it helps.

When you set the mode of the crystal oscillator to "Full Swing Oscillator" the operational condition of the oscillator stage changes, the oscillator takes more power (it becomes a harder signal source), its amplitude is much larger (rail to rail swing, saturated), the input of the oscillator (XTAL1) less sensitive, thus the oscillator is much less prone to be influenced by a parasitic feed through of the energetic edges from the serial data to the pin XTAL1.

The actual issue depends on other factors as well - ie.:
. PCB design (how much Cpar you create, do you use GND guard ring around XTAL1 pin??, are the traces leading to the XTAL1 pin short??, etc),
. crystal parameters (ie some crystals are easier to be driven into oscillation, other not..),  
. the oscillator design itself (the circuit inside the chip, may vary based on the chip version),
. frequency of the crystal,
. voltage (the lower the voltage, the lower the recommended crystal frequencies),
. temperature (it shifts the crystal oscillator operational conditions),
. decoupling (bad or missing decoupling capacitors mean a lot of mess on the power lines - that mess modulates the crystal oscillator as well, especially in the low power modes or at lower voltages).

That is my current understanding..  ;)
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: john1993 on Feb 04, 2013, 05:40 pm
Code: [Select]
8MHz crystal
57k   3.7% error
115k 7.8% error
16MHz crystal
57k   2.1% error
115k 3.7% error

Thus even a small additional error introduced ie. by such frequency pulling by Rx signal edges may disturb the Uart communication easily..


that does sum it up. except its the errors that allows this to work at all. urban myths notwithstanding, the actual problem is arduino designers infatuation with round numbers. taking into account 3% is considered fatal error for pc rs232 its a miracle any of the boards work at 115k. failure is the rule rather than exception at 8mhz. often the poor noobs blame hardware or boot code when in fact slightly different xtl choice would fix everything. its just another reason i prefer using the internal oscillator which allows far more reliable serial than xtls at those frequencies.
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: westfw on Feb 04, 2013, 09:21 pm
The alternate fuse setting was mentioned way back in http://arduino.cc/forum/index.php/topic,109550.msg902341.html#msg902341
But did not solve all problems.
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: pito on Feb 04, 2013, 09:26 pm
http://www.wormfood.net/avrbaudcalc.php
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: westfw on Feb 05, 2013, 05:00 am
I dunno.  Trying to second guess hardware problems, remotely, without pictures, or test equipment, or actual part numbers and datasheets (for the crystals, for instance), or expertise (this is a pretty hard problem, so the amount of test equipment and expertise required could be quite high), is a pretty frustrating experience.

I thought everyone was already using the "full swing driver" fuse :-(
Of course, I also thought I had already changed in the the Optiboot repository makefiles, and it isn't changed there either!  Sigh.

Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: oric_dan on Feb 05, 2013, 09:31 pm
Quote
I thought everyone was already using the "full swing driver" fuse :-(

All 5 board selections in the boards.txt file of the maniacbug 1284 library show the
0xFF lower-power oscillator fuse setting. Maybe you might mention this whole issue
to him. I had no luck getting his attention in the past.
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: xenocid on Feb 14, 2013, 10:43 pm
Hello everyone!
This is just to let you know that 0xF7 lfuse trick solved the upload problem for my standalone 1284 board. That's right, just 1284, no P.
Thanks!
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: oric_dan on Feb 14, 2013, 11:02 pm

Hello everyone!
This is just to let you know that 0xF7 lfuse trick solved the upload problem for my standalone 1284 board. That's right, just 1284, no P.
Thanks!

Interesting, did you verify that you actually had a problem with the 1284 non-P chip when
using the 0xFF fuse settings? I don't remember anyone else having a problem with non-P. 
I am also interested in the data code on your chip - something like 1216 or 1247, under the
part number on the top surface.
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: xenocid on Feb 14, 2013, 11:21 pm
The top surface says ATMEGA 1284 PU 1216. It is definitely a non-P since i had to change the signature in avrdude.conf to have it recognized (0x1e 0x97 0x06 as opposed to 0x1e 0x97 0x05 for Ps).  And yes it had problems with uploading anything larger than ~1000B. Both RC filter and 0xF7 lfuse solved this issue.
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: oric_dan on Feb 15, 2013, 12:31 am
Thanks, another fact to put in the book on 1284s.
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: Osgeld on Mar 04, 2013, 04:29 am
I just went though this exercise, thought I would share

Had a 1284 non P sitting around, wanted to use it for tv out library

downloaded mighty1284, extracted it to my sketchbook folder under a folder named hardware (have to add hardware folder yourself if you have not already)

changed lfuse to 0xF7 in the given boards.txt under the 16Mhz optiboot option

edited avrdude.conf to reflect the different device signature from 0x1e 0x97 0x05 to 0x1e 0x97 0x06

hooked up a 328p home made arduino with ArduinoISP sketch loaded, choose serial port, choose 1284p 16Mhz optiboot entry, burned bootloader. This took its sweet time but did complete.

Afterwards uploading with the bootloader gave an error that the chip was ID-ing as 0x1e 0x97 0x05 and 0x1e 0x97 0x06 was expected. Edited avrdude.conf back to 0x1e 0x97 0x05

seems to work fine, uploaded tv out's NTSC demo and now running a TV display at 240x192
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: oric_dan on Mar 04, 2013, 07:09 am
Yep, I burned 1284 non-P also, and had to follow exactly the same procedure in regards
changing the device signature back and forth. I'm not sure why it uploads sketches to
1284 non-P using the 1284P signature.
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: Osgeld on Mar 04, 2013, 07:23 am
its a bootloader thing
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: pak on Mar 23, 2013, 04:54 am
Hello dude,
   I'm testing Mighty 1284p 16MHz Optiboot with Arduino IDE v1.0. I use FTDI usb-serial converter to upload the sketch. when I upload the following sketch, the maximum value of "arraysize" is 4070 while led blinking?

Code: [Select]
#include <avr/pgmspace.h>   //To store arrays into flash rather then SRAM
// Simple sketch to create large sketch sizes for testing purposes
/*
 Blink
 Turns on an LED on for one second, then off for one second, repeatedly.

 This example code is in the public domain.
*/

// Pin 13 has an LED connected on most Arduino boards.
// give it a name:
int led = 13;

/*
Make arraysize = to 1500 for 328P chip, 4000 for 1280P chip?,
3600 for 644P chip, xxxx for 1284P,  etc.
*/
const int arraysize= 7700;  // value to mostly fill avalible flash capacity

long myInts0[arraysize] PROGMEM = {};  //Store initilized array into flash memory
long myInts1[arraysize] PROGMEM = {};
long myInts2[arraysize] PROGMEM = {};
long myInts3[arraysize] PROGMEM = {};

// the setup routine runs once when you press reset:
void setup() {                
 // initialize the digital pin as an output.
 pinMode(led, OUTPUT);
 int i = random(0,arraysize);      // Work around any optimization for constant values
 Serial.print(myInts0[i]);         //  Access some random element so the array can't be optimized away.
 Serial.print(myInts1[i]);         //  Access some random element so the array can't be optimized away.
 Serial.print(myInts2[i]);         //  Access some random element so the array can't be optimized away.
 Serial.print(myInts3[i]);         //  Access some random element so the array can't be optimized away.
}

// the loop routine runs over and over again forever:
void loop() {
 
 digitalWrite(led, HIGH);   // turn the LED on (HIGH is the voltage level)
 delay(1000);               // wait for a second
 digitalWrite(led, LOW);    // turn the LED off by making the voltage LOW
 delay(1000);               // wait for a second
}


And 'avrsize' is showing the usage...
Code: [Select]
AVR Memory Usage
----------------
Device: atmega1284p

Program:  127366 bytes (97.2% Full)
(.text + .data + .bootloader)

Data:        427 bytes (2.6% Full)
(.data + .bss + .noinit)


I can upload sketch size 127k (arraysize=7700) without error, but led is not blinking.  :D  Meaning that it stuck somewhere.
When I change the value of "arraysize" = 4070 (69k byte), led is blinking. It's too bad.  :( Any idea?

Regards,
pak
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: retrolefty on Mar 23, 2013, 05:08 am

Hello dude,
   I'm testing Mighty 1284p 16MHz Optiboot with Arduino IDE v1.0. when you upload the following sketch, what is the maximum value of "arraysize" while led blinking?

Code: [Select]
#include <avr/pgmspace.h>   //To store arrays into flash rather then SRAM
// Simple sketch to create large sketch sizes for testing purposes
/*
 Blink
 Turns on an LED on for one second, then off for one second, repeatedly.

 This example code is in the public domain.
*/

// Pin 13 has an LED connected on most Arduino boards.
// give it a name:
int led = 13;

/*
Make arraysize = to 1500 for 328P chip, 4000 for 1280P chip?,
3600 for 644P chip, xxxx for 1284P,  etc.
*/
const int arraysize= 7700;  // value to mostly fill avalible flash capacity

long myInts0[arraysize] PROGMEM = {};  //Store initilized array into flash memory
long myInts1[arraysize] PROGMEM = {};
long myInts2[arraysize] PROGMEM = {};
long myInts3[arraysize] PROGMEM = {};

// the setup routine runs once when you press reset:
void setup() {                
 // initialize the digital pin as an output.
 pinMode(led, OUTPUT);
 int i = random(0,arraysize);      // Work around any optimization for constant values
 Serial.print(myInts0[i]);         //  Access some random element so the array can't be optimized away.
 Serial.print(myInts1[i]);         //  Access some random element so the array can't be optimized away.
 Serial.print(myInts2[i]);         //  Access some random element so the array can't be optimized away.
 Serial.print(myInts3[i]);         //  Access some random element so the array can't be optimized away.
}

// the loop routine runs over and over again forever:
void loop() {
 
 digitalWrite(led, HIGH);   // turn the LED on (HIGH is the voltage level)
 delay(1000);               // wait for a second
 digitalWrite(led, LOW);    // turn the LED off by making the voltage LOW
 delay(1000);               // wait for a second
}


And 'avrsize' is showing the usage...
Code: [Select]
AVR Memory Usage
----------------
Device: atmega1284p

Program:  127366 bytes (97.2% Full)
(.text + .data + .bootloader)

Data:        427 bytes (2.6% Full)
(.data + .bss + .noinit)


I can upload sketch size 127k (arraysize=7700) without error, but led is not blinking.  :D
When I change the value of "arraysize" = 4070 (69k byte), led is blinking. It's too bad.  :( Any idea?

Regards,
pak


This was reported on extensively in a prior posting thread sometime last year. I believe the root problem ended up being a compiler thingee with the PROGMEM command. You can have code up to the full flash size of the 1284 chip but data sizes using PROGMEN doesn't work over the 64KB boundary. At least that is the best of my recollection on the subject.

Lefty
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: Docedison on Mar 23, 2013, 06:05 am
That just came up again... A day or two back... In a search... easy too.
[edit RKJ]
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: oric_dan on Mar 23, 2013, 06:36 am
1. That just came up again... A day or two back.
2. go to 1.
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: Andy2No on May 14, 2013, 12:57 pm
I'm trying Arduino 1.5.2 and the maniacbug 1284P boards don't appear in the Board menu any more.  The ATtiny AVR ones didn't either, but there was a new release that fixed that - and uses the new options for selecting the CPU and speed variants separately, making the Board menu shorter.

Is there a fix for maniacbug Mighty 1284P to work with Arduino 1.5.2, or would I just have to stick with 1.0.4?  That still shows them, but suffers from the very long Board menu, that doesn't fit on my screen unless I comment out some of them.
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: pito on May 14, 2013, 01:52 pm
Mighty 1284p works fine with 1.5.2.
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: Andy2No on May 15, 2013, 02:09 am

Mighty 1284p works fine with 1.5.2.


Not for me, it doesn't.  The boards don't appear in the Board menu.  I don't know where to go from there.

What is your picture supposed to illustrate?

EDIT:  I see now - in the bottom right hand corner.  But how did you select the board?  Are you using the Windows distribution or a Linux one?
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: oric_dan on May 15, 2013, 03:41 am
If you're not seeing the 1284 boards in the IDE, then the maniac1284 library is likely in
the wrong place.

It's not totally trivial to locate where the following page is found, but it indicates where
you are supposed to have the libraries located, namely in your sketch directory, and not
in your IDE directory.
http://arduino.cc/en/Guide/Libraries

The other thing is, when you uncompress the library zip files, they often end up one
subdirectory down too far, and you have to move them up - at least from my experience.
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: pito on May 15, 2013, 08:35 am
Quote
But how did you select the board?  Are you using the Windows distribution or a Linux one?

Add the mighty board to boards.txt
Win XP

The dirs:
Code: [Select]
..\arduino-152\hardware\arduino\avr\cores\mighty1284p
..\arduino-152\hardware\arduino\avr\variants\mighty1284p\pins_arduino.h
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: Andy2No on May 15, 2013, 09:53 am
Thanks, pito

# Manually added the boards.txt content for Maniacbug Mighty 1284P to the main boards.txt
#
# Also moved the cores from it into
# C:\Program Files\arduino-1.5.2\hardware\arduino\avr\cores\mighty1284P_standard
# and the variants form it into
# C:\Program Files\arduino-1.5.2\hardware\arduino\avr\variants\mighty1284P_avr_developers
# C:\Program Files\arduino-1.5.2\hardware\arduino\avr\variants\mighty1284P_bobuino
# C:\Program Files\arduino-1.5.2\hardware\arduino\avr\variants\mighty1284P_standard

I can't help wondering if there's a cleaner way of doing it, so it's easier to keep upgrading the Arduino environment, but that seems fine for now - the different types of 1284P board are now on my Board menu.
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: Andy2No on May 15, 2013, 09:57 am

It's not totally trivial to locate where the following page is found, but it indicates where
you are supposed to have the libraries located, namely in your sketch directory, and not
in your IDE directory.
http://arduino.cc/en/Guide/Libraries


Thanks, oric_dan.  I'd been putting them in the program files folder, which works, and means I have a separate copy for each installation of the Arduino environment (I currently have 1.01, 1.04 and 1.52 installed, separately, just to make sure :)). 

I suppose I ought to do it the official way though, and I didn't realise that's how it was supposed to be done.  It would make the next upgrade just a touch easier, but then I might break something that worked in an older version of Arduino, and not be able to fall back to using that.
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: scargill on Jul 07, 2014, 10:04 pm
I don't suppose anyone has any answers in here? I've just installed 1.57 of Arduino as I got sick and tired of not being able to scroll menus - I've followed the instructions above - I can compile for Manicbug's 1284 Optiboot - but it fails - can't find <Arduino.h>

Any ideas?
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: CrossRoads on Jul 07, 2014, 10:14 pm
Try asking here:
http://forum.arduino.cc/index.php?topic=235521
New activity going on for getting 1284 into the mainstream.
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: bperrybap on Jul 08, 2014, 12:28 am

I don't suppose anyone has any answers in here? I've just installed 1.57 of Arduino as I got sick and tired of not being able to scroll menus - I've followed the instructions above - I can compile for Manicbug's 1284 Optiboot - but it fails - can't find <Arduino.h>

Any ideas?


The easiest solution is to simply install Paul's Teensyduino add-on
even if you aren't using a teensy board.
The installer modifies the IDE to add scrollable menus.
https://www.pjrc.com/teensy/td_download.html

--- bill
Title: Arduino not getting voltages from Agilent E3631A
Post by: israelm28 on Jul 08, 2014, 05:03 am
So I hooked up my dc power supply (Agilent E3631A) to the arduino Mega 2560 and tried to test it out using the examples given from the website (ReadAnalogVoltage). I tired it out but it did not work at all, A0 just acted like it wasn't connected. I connected it to the arduino power and that was fine but tried it back on the power supply but to no avail. Any help on that?
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: CrossRoads on Jul 08, 2014, 08:00 am
@israelm28,
That has nothing to do with this thread. Start yourself a new topic in an appropriate forum.
Title: Re: Help in programming the Atmega1284 with maniacbug-mighty-1284p.
Post by: Phoebus1966 on Mar 15, 2018, 11:23 pm
Thanks all for your help on this ATmega1284P RX in issue. Was about to torture them (oh no help please no!).