[SOLVED] - Breadboard 1284p - 'Blink' uploads OK, but not other sketches.

Hi Arduino-ites,

Bit hard to figure this one out - not for lack of trying!

I’ve successfully built a standalone breadboard version of an ATmega 1284p via Manicbug’s helpful post:
link here

I can upload a simple Blink sketch which toggles an LED fine, but when I try some other example programs that are larger they compile fine but uploading fails. Upon hitting ‘upload’ the Rx Tx LEDs on the FTDI Basic rapidly blink for approx 2-3 secs then upload fails with a return message of:

avrdude: stk500_paged_write(): (a) protocol error, expect=0x14, resp=0x62

Or alternatively:

avrdude: stk500_recv(): programmer is not responding

.

I’ve checked the wiring connections, tried powering the 1284p via a separate 5v and anything else I could think of and searched a bunch of posts on this, but not figured it out.

Could it be related to a time-out issue upon auto reset via the DTR pin on the FTDI Basic? It seems odd that it accepts Blink just fine, then without adjusting anything will not accept more complex sketches.

I’ve a 10K pull-up resistor on the RST pin per Manicbug’s setup & can upload Blink with or without it connected, but no change for other sketches…

Here’s my setup:
Arduino 1.6.5 on Mac OS X 10.11,
In IDE - Selected Board: MightyCore ATmega1284p
Correct USB port connected to: FTDI Basic from Sparkfun (also tried newer Module -same result)

Wiring
FTDI Basic <----> 1284p

DTR line goes to RST on 1284p (physical pin 9 ) via 0.1 uF Cap,
RX ---- TX (D9, physical pin 15 )
TX ---- RX (D8, physical pin 14 )
5v ---- 5v (via breadboard rails to all appropriate pins)
Gnd ---- Gnd (via breadboard rails to all appropriate pins)

Any help greatly appreciated, thanks!

Rich.

Do you have decoupling caps (Vcc to ground) on all Vcc pins on the 1284p? 0.1uf ceramic, right next to the chip

Can you post the full output of the upload with verbose upload enabled?

Hi DrAzzy,

Thanks for your reply.

Yes, I've decoupling caps between the Vcc and Gnd pairs on either side of the breadboard 1284p and the caps are as close to the pin legs as possible (same goes for the external crystal - as close as possible).

I'll re-run the upload and post the verbose output later today...

Rich.

What kind of version of MightyCore are you using? I've fixed a nasty ATmega1284 related bug last week that messed up the clock speed. The new version works fine on my development board. It would also be nice if you posted a picture of your setup :slight_smile:

DrAzzy:
Can you post the full output of the upload with verbose upload enabled?

Hi DrAzzy, I’m attaching the verbose output from a standard sketch in the Arduino 1.6.5 IDE that fails to upload: File > Examples > Sensors > Ping

Please see attached ping_err.txt

I’ll also attach the image and the version of MightyCore I’m using in reply to hansibull’s questions…

https://mcudude.github.io/MightyCore/package_MCUdude_MightyCore_index.json

Hope the above helps.

Thanks.

Rich

ping_err.txt (24.4 KB)

hansibull:
What kind of version of MightyCore are you using? I’ve fixed a nasty ATmega1284 related bug last week that messed up the clock speed. The new version works fine on my development board. It would also be nice if you posted a picture of your setup :slight_smile:

Hi Hansibull, For MightyCore I’m using the 1.0.0 version (per the Boards Manager) which I added into the preferences from here:

https://mcudude.github.io/MightyCore/package_MCUdude_MightyCore_index.json

I just tried updating to 1.0.3-r1 and the Blink which previously uploaded OK, failed (the output is attached), so I rolled it back to 1.0.0 and Blink does upload again.

Hope the above helps!

Thanks.

Rich

blink_with_MightyCore_1_0_3-r1_error.txt (26.5 KB)

It's really weird. I haven't done any changes to the upload process since version 1.0.0, only core changes.

I've tried with the latest version from Github and the latest boards manager version (v1.0.3r1) but I'm not able to reproduce the problem. Try upgrading to v1.0.3r1 again, restart Arduino IDE and burn the bootloader again. What kind of ISP programmer are you using?

hansibull:
What kind of ISP programmer are you using?

That’s a good question!
I used an ATmega 2560 as an ISP following: https://www.arduino.cc/en/Tutorial/ArduinoISP
and looking again at these steps & also re-visting the programmer selection in Arduino 1.6.5 IDE, I see more options & there’s a bootloader choice of “ArduinoISP (MightyCore)” - I don’t recall seeing that option before… (it was a few weeks ago I bootloaded) - or are these additions in v1.0.3r1 update?

I also see programming options for using both of these units which I have here too:
AVRISP mkII (MightyCore)
USBtinyISP (MightyCore)

Perhaps I should try the AVRISP mkII or the USBtinyISP (Adafruit ver 2)? -would you recommend that & if so, any preference?

Thanks!

Rich

I tested using an USBtinyISP. You’ll get an error after burning the ATmega1284p bootloader (since it only supports <64k flash), but the bootloader works just fine. It doesn’t matter if you use “USBtinyISP” or "USBtinyISP (MightyCore), it should bootload anyway :slight_smile:

hansibull:
I tested using an USBtinyISP. You’ll get an error after burning the ATmega1284p bootloader (since it only supports <64k flash),

is that true because there should be no difference between 32kwords or 64kwords for isp. >128kwords is the real barrier and m1284 is below that. is usbtinyusp firmware that defective? do all of them suffer from that or just this particular unit?

Thats at least what I've read. Optiboot (using STK500v1) supports microcontrollers up to 128kB, and USBtinyISP officially support microcontrollers unto 64kB.

From Adafruit's website:

Any AVR that uses the ISP interface for programming and has 64K or less of flash can be programmed.
Chips such as the Atmega1280/1281 and Atmega2560/2561 have more than 64K and cannot be programmed.

thank you for clearing that up. i have a couple ebay and one scratch built usbtinyisp (2313 and t44) but not a lot of experience using them. i am in a position to recommend programmers to others and this looks like another reason among many to steer clear of this particular design. arduino-as-isp and usbasp seem to surface as best options these days for several reasons.

there should be no difference between 32kwords or 64kwords for isp. >128kwords is the real barrier

There is a 64k limit in (many of) the communications protocol between the PC and the "programmer", because the "start address" for each block to be programmed is sent as two bytes. Whether that is 64k bytes or 64k words depends on which protocol you are using, and the USBtinyISP uses a different protocol from "Arduino as ISP", so it could have a different limit.

The original problem sounds a lot like the "RESETS occur when uploading code on UART0" that has been reported off and on with the m1284. This was supposed to be mostly fixed by using fuse settings for "full swing" crystal oscillator rather than the "low power" crystal oscillator. Can you confirm that you're using that fuse setting?

For a standalone 1284, you might consider using UART1 for bootloading instead.

I changed the standard fuse setting to full swing for all external oscillators in early January (IIRC). If richCharthew bootloaded his Atmega1284 using MightyCore v1.0.0 it doesn't got the full swing setting.

hansibull:
I changed the standard fuse setting to full swing for all external oscillators in early January (IIRC). If richCharthew bootloaded his Atmega1284 using MightyCore v1.0.0 it doesn't got the full swing setting.

@hansibull & @westfw

Yes, I did see some posts on the oscillator issue when I first started with this project...

So I'll first try a new bootload using MightyCore v1.0.3r1 - using the USBtinyISP - if successful bootload, that MightyCore version should reset the fuse for fullswing, then I'll try Blink, then some larger sketches.

If no joy, I'll try bootloading v1.0.3r1 with the AVRISP mkII unit I bought from Atmel a year or so ago.

The goal for using the 1284p in this case is to have enough memory and pins to run a Adafruit CC3000 along with a small LCD screen similar to this: link

Overall though, I really want to build my own aesthetic style of boards manually and the 1284p hits the sweet spot between great features & functionality, but still with a form factor that allows hand soldering (once I get this working, I'll use a TQFP 44).

Thanks!

Like mentioned earlier in this post, there are some issues when burning the bootloader on chips with larger flash memory when using the USBtinyISP. Please try both ISP programmers and give us an update on how it went :slight_smile:

hansibull:
Like mentioned earlier in this post, there are some issues when burning the bootloader on chips with larger flash memory when using the USBtinyISP. Please try both ISP programmers and give us an update on how it went :slight_smile:

Success!

Perseverance pays off, thanks everyone for your suggestions and advice, esp Hansibull, very much appreciated.

@Hansibull, I'm pretty sure you were correct - I think it was the existing bootloader code on the 1284p that was causing problems.

Also the USBtinyISP threw an error after bootloading, but thanks to you mentioning it, I tried uploading a few large sketches anyway with a snippet of LED blink code in the setup() to visually confirm that they uploaded correctly without having to wire up the CC3000 = seems all systems are go.

So here's how I have it set up for anyone else who might need it:

BOOTLOADING:

Wiring:
I used an Adafruit USBtinyISP (v2) that I bought a few years ago.

USBtinyISP -- to -- Atmega 1284p connections:

+5vdc ----- +5vdc Breadboard rail

Ground ---- Ground Breadboard rail

MOSI ------- D5 ( physical pin 6 )

MISO ------- D6 ( physical pin 7 )

SCK -------- D7 ( physical pin 8 )

Reset ------- 0.1 uF cap ------ Reset ( physical pin 9 ) ---- 10K pullup to +5vdc on Breadboard rail.

Uploading the bootloader with Arduino 1.6.5:

For the Board software, I'm using MCUdude's MightyCore version 1.0.3-r1
For the Board, Tools > MightyCore - ATmega1284
For the Programmer, I'm using "USBtinyISP"

Here's the error that I ignored:

avrdude: verification error, first mismatch at byte 0x1fc00
         0xff != 0x1f
avrdude: verification error; content mismatch
Error while burning bootloader.

A small note - when I used the USBtinyISP to bootload breadboard ATmega328's in the past, the red LED indicator stayed lit for over a minute, whereas with bootloading this 1284p today, it stayed lit for about 5 seconds only.

Cheers all!

Rich.

Good to hear! :slight_smile: Yes, boot loading the ATmega1284 (and all the other MightyCore compatible ones) just takes a few seconds. Honestly I don’t know why it takes so much time in the mega328p - it’s the same bootloader… I often edit the first post and add [Solved] in front of the topic name. It makes it much easier for other members searching a solution for a similar problem :wink:

hansibull:
I often edit the first post and add [Solved] in front of the topic name. It makes it much easier for other members searching a solution for a similar problem :wink:

Ahhh, that’s how it’s done… I tried to do it, but only ended up changing my last post’s title. thanks - I’ll update 1st post title now.

Looking forward to building with the 1284p - I tried to build with the 2560, but could never get the bootloader onto my homemade chip - possibly the dimensions are a wee bit too small on the pins to solder successfully, although I did give it a go last year… check out the attached pic :slight_smile:

Rich.

Wow! That’s how it should be done :slight_smile: Is the Atmega2560 board completely dead, or do you just get an error message when burning the bootloader? I don’t see any bypass capacitors close to the chip. This often causes stability problems.

I’m planning to build an ATmega64/128 development board to test my other Arduino core. The breakout module itself was sent to production on Tuesday. These microcontrollers are a bit easier to solder than the 1280/2560, and they cost next to nothing at eBay and Aliexpress