It's obvious from the output you posted that you have the Rx/Tx lines around the right way or you wouldn't have got chip recognized etc.
I don't suppose the sketch you are uploading has "???" in it?
Do you have decoupling capacitors?
It's obvious from the output you posted that you have the Rx/Tx lines around the right way or you wouldn't have got chip recognized etc.
I don't suppose the sketch you are uploading has "???" in it?
Do you have decoupling capacitors?
This sketch I'm trying to upload is as followings :
void setup() {
// put your setup code here, to run once:
}
void loop() {
// put your main code here, to run repeatedly:
}
Yes I do have decoupling capacitors.
I've managed to get a few successful uploads with the bare minimum sketch but 9 times out of 10 it fails. Any other sketch that was not the bare minimum I've never been successful.
I get the same error :
Binary sketch size: 534 bytes (of a 130,048 byte maximum)
avrdude: stk500_paged_write(): (a) protocol error, expect=0x14, resp=0x64
avrdude: stk500_cmd(): programmer is out of sync
westfw:
This sounds vaguely like the "1284 resets while bootloading" problem that various people have reported.LFuse = 0xFF
HFuse = 0xDE
EFuse = 0xFD
Try LFUSE = 0xF7 instead.
Would I need a programmer to burn the fuses?
I've just been using nick gammons Arduino sketches to do this.
westfw:
This sounds vaguely like the "1284 resets while bootloading" problem that various people have reported.LFuse = 0xFF
HFuse = 0xDE
EFuse = 0xFD
Try LFUSE = 0xF7 instead.
I managed to change the fuses by modifying nick gammons Arduino sketches found here,
However after changing the fuse I got no response while trying to upload a sketch.
I changed the fuse back and uploaded the regular bootloader with the standard fuses.
I managed to upload the bare minium sketch however when I try to upload anything else (that has any code) I get the same error. However now this sketch seems to fail to upload with the same error.
How is this possible.
One of my sketches (the hex uploader one) has the ability to change fuses (you don't need the SD card to do that).
However if you get an SD card adapter (around $15) and plug that in, that sketch can be used to upload a .hex file which you produce in the IDE. I regularly upload stuff that way (eg., to an ATtiny85).
Alternatively you could get an ISP programmer (they are cheap too) and use that to program via the ICSP (SPI) interface rather than using FTDI. The fact that you have got the bootloader installed proves that particular programming path works.
Yes I do have decoupling capacitors.
Can you circle them in your photo? Show the exact wiring you are using for the FTDI, and indicate where the decoupling capacitors are.
I managed to modify your programmer sketch to change the fuses I wanted too however there was no luck there so I've changed them back.
I've spent the last two days straight going round in cycles and my last hope was problems with breadboard connections so I decided to prototype it on some strip board.
I've got a 0.1uF (100nF) cap between my positive and negative rail. I've also got a 0.1uF cap between my FTDI and 1284P for reset.
I attached my official Arduino FTDI which I've used for years to the header and attempted upload.
I get communication and the RX and TX LED's blink for a few seconds then this same old error :
Binary sketch size: 534 bytes (of a 130,048 byte maximum)
avrdude: stk500_paged_write(): (a) protocol error, expect=0x14, resp=0x64
avrdude: stk500_cmd(): programmer is out of sync
I'm going to try and program it using Arduino as an ISP however my product needs to have the ability to have its firmware updated through USB. This would be done using an FTDI.
How's your set up? Are you using a breadboard and flash it through an FTDI?
This has gone past the point of frustration.
I don't see connections to the power pins on the "far" side of the chip.
On most microcontrollers with multiple power pins, you MUST connect all of them to the appropriate power rails for reliable operation.
Well I thought I would try it out on my 1284 breadboad, which I still had made up. Guess what I got?
Binary sketch size: 3,232 bytes (of a 130,048 byte maximum)
avrdude: stk500_paged_write(): (a) protocol error, expect=0x14, resp=0x62
avrdude: stk500_recv(): programmer is not responding
Lol. I'll look into it.
OK, I got it to work by changing board selections. This one worked:
Mighty 1284p 16 MHz using Optiboot
With the wrong selection it is using the wrong protocol to communicate with the board, and it eventually fails.
Wiring in my case:
westfw:
I don't see connections to the power pins on the "far" side of the chip.
On most microcontrollers with multiple power pins, you MUST connect all of them to the appropriate power rails for reliable operation.
I used them many times without, but just in case I've soldered some wires to connect them.
However I still get the same error.
Wow thanks for the support!
My board selection is correct and my circuit is identical to yours, this could only then be a hardware chip problem or bootloader differences in mine and yours?
What is bringing power to the far power rails?
Try different board selections, as I mentioned above.
CrossRoads:
What is bringing power to the far power rails?
I've connected them both to my power rail with two soldered wires
I've tried every board but that's not the issue.
I just got a successful upload using the bare minimum sketch. Then without touching any hardware tried again and got the same error.
So this doesn't look like its a connection / bootloader problem.
Jack, I tried to follow this thread, but am totally confused. There are a multiplicity of bootloaders for the 1284 in maniacbug, and you brought in 3 more I'd never seen from here: GitHub - jmgiacalone/sanguino1284p: Files for atmega 1284p to work with Arduino 0023
All told, there are the original [old] and optiboot [new] bootloaders, plus 8-Mhz and 16-Mhz crystals, plus multiple variants, including 3 or 4 Sanguino, plus all of maniac's new ones including Bobuino. From reading this thread, I can't tell what you actually did, ?? ??
I would suggest starting over from scratch:
chuck the jmgiacalone stuff in the can, and just stick with the maniac library
exclusively.
pick a maniac variant that uses "optiboot" and 16-Mhz xtal - that's what pretty
much everybody uses anymore.
I suggest the Bobuino variant, but it doesn't matter as long as you do item 2.
burn the bootloader [optiboot, 16-Mhz] anew.
see what happens.
Also, I assume you can find your FTDI adaptor in Control Panel Hardware Devices. Yes?
Also, I sure hope you're using a 1284P, and not a 1284 with no-P.
EDIT:
Also, nobody seems to appreciate it, but avrdude is actually extremely brittle. I assume this is a major reason there are 1000/whatever threads on this forum that say "I got the out-of-sync error, can you help me?". The problem is, if you look at the source code for avrdude, you see it tries to sync up with the Rduino "exactly" one time, and then it bails. It should be re-written to try to sync-up 40 times, instead of just 1 time.
BTW, if you're using a WinXP machine, my old tried and true machine that's 8-10 years old, and which I've used a gazillion times for uploading sketches, now crashes at least 50% of the time --> out-of-sync error. The java install on that machine no longer works properly with the latest IDEs, at least v1.0.5, which is as far as I've used.
oric_dan:
Jack, I tried to follow this thread, but am totally confused. There are a multiplicity of bootloaders for the 1284 in maniacbug, and you brought in 3 more I'd never seen from here: GitHub - jmgiacalone/sanguino1284p: Files for atmega 1284p to work with Arduino 0023All told, there are the original [old] and optiboot [new] bootloaders, plus 8-Mhz and 16-Mhz crystals, plus multiple variants, including 3 or 4 Sanguino, plus all of maniac's new ones including Bobuino. From reading this thread, I can't tell what you actually did, ?? ??
I would suggest starting over from scratch:
chuck the jmgiacalone stuff in the can, and just stick with the maniac library
exclusively.pick a maniac variant that uses "optiboot" and 16-Mhz xtal - that's what pretty
much everybody uses anymore.I suggest the Bobuino variant, but it doesn't matter as long as you do item 2.
burn the bootloader [optiboot, 16-Mhz] anew.
see what happens.
Also, I assume you can find your FTDI adaptor in Control Panel Hardware Devices. Yes?
Also, I sure hope you're using a 1284P, and not a 1284 with no-P.
EDIT:
Also, nobody seems to appreciate it, but avrdude is actually extremely brittle. I assume this is a major reason there are 1000/whatever threads on this forum that say "I got the out-of-sync error, can you help me?". The problem is, if you look at the source code for avrdude, you see it tries to sync up with the Rduino "exactly" one time, and then it bails. It should be re-written to try to sync-up 40 times, instead of just 1 time.BTW, if you're using a WinXP machine, my old tried and true machine that's 8-10 years old, and which I've used a gazillion times for uploading sketches, now crashes at least 50% of the time --> out-of-sync error. The java install on that machine no longer works properly with the latest IDEs, at least v1.0.5, which is as far as I've used.
Firstly, Thanks for your reply!
I've always used maniacbug library and not sure where the other link came from.
I've choose "Mighty 1284P 16MHz using Optiboot"
I started from scratch like you said uploading the bootloader and then attempting to upload a sketch however the same problem. I get communication on both parts for a few seconds and then fails with that error.
However I've tried programming through ISP skipping the bootloader and it works!! However it needs to be uploaded via serial using an FTDI chip for firmware upgrades. It also makes serial monitoring a hassle.
The SPI interface is also used for other devices in my circuit.
I'm using the 1284P 40 Pin package and not the 1284.
I'm using Windows 7 with Arduino 1.05.
I uploaded a sketch via ISP that especially returns any serial data sent to the chip using the same serial pins for programming. It works perfectly returning large chunks of text.
Good, your earlier posts mentioned Sanguino bootloaders, etc. What FTDI device are you using specifically? Does Control Panel Hardware Devices recognize it? Uses RTS or DTR?
Inline with what westfw referred to, try a low-pass filter in the Rx line to the chip. Say 1K or 5K series-R, and 18-22 pF cap to gnd on the Rx pin.
oric_dan:
Good, your earlier posts mentioned Sanguino bootloaders, etc. What FTDI device are you using specifically? Does Control Panel Hardware Devices recognize it? Uses RTS or DTR?Inline with what westfw referred to, try a low-pass filter in the Rx line to the chip. Say 1K or 5K series-R, and 18-22 pF cap to gnd on the Rx pin.
oric_dan:
Good, your earlier posts mentioned Sanguino bootloaders, etc. What FTDI device are you using specifically? Does Control Panel Hardware Devices recognize it? Uses RTS or DTR?Inline with what westfw referred to, try a low-pass filter in the Rx line to the chip. Say 1K or 5K series-R, and 18-22 pF cap to gnd on the Rx pin.
I must of pasted that link in by mistake as I can remember looking but not using that library.
My FTDI is an official arduino breakout which has been used for years to program Atmega328's. It has a DTR pin which is connected to the 1284's reset through a 0.1uF cap.
I attempted to re upload the bootloader using nick gammons Arduino sketches,
His sketch burns the necessary fuses and then uploads the Optiboot bootloader.
I've tried this before, many times and got the same problem however suddenly it works and seems to upload fine now. Which is strange to say the least.
This post and the many threads I've read through,
Seems to clarity the inconsistent hardware bug on the RX pin on UART 0 which could be the source of all these problems.
I guess at the moment it works.
However when I try to use the second UART and software serial I come into more problems.
If it suddenly started working, then it was probably a loose wire. Check your connections. I presume you're using the soldered prototype now. I meant to say this before about whiteboards - bad connections are probably the source of about 90% of people's problems. I never use them. Also, like westfw indicated, I "always" wire up the back-side gnds, Vcc, and Vref pins.
Migrating to the 1284P | The Robot Diaries <--- that link is a riot. No references. His comments are straight out of the excruciatingly long forum thread in 2013, 27 pages or so, where we debugged the RX0 problem using eternal frustration as the motivation.
Also, Serial1 works 100% on the 1284, I use it all the time. So, check your connections and setups.
Also, all the SoftSerial libraries are a POS from my experience, although others swear by them, and you find 100s of examples of their use. They may work somewhat ok for RX only on 1 channel, but are useless for real 2-way comms in my experience. If you must use SoftSerial, try PaulS' AltSoftSerial from the pjrc.com site. I've not used it, but the description sounds like it's competently coded. Try it, and report back, I'd be interested to hear of someone's experience with it, :-).
Also, re your comment on the other thread, I tried the ESP8266 back in December, and gave up on it immediately. Very unreliable. There are MANY threads in the Networking section of people not being able to get it to work properly. I've not checked recently, so maybe someone has had better success now.
Also, despite others' hesitations on the matter, I use 16-Mhz with Vcc=3.3V every single day. Perfect reliability, although I don't go to 80 degC, etc.