going from 328 proto to mega8 production

Guys, I have put myself in a bit of a bind… most of it my own doing, but could really use some advice from experienced ATmega8 board/circuit designers. I prototyped and demo’d my project using mini pro (ATmega 328) but my production board is very limited on space. My PCB guy laid out the board using the package for the mega8 (long story, PCB design part library error I didn’t catch) I also completely overlooked the fact that the parts do not come with the bootloader, DUH! and I only brought out the pins for the FTDI interface. I soon felt my shame when I couldn’t get the system to download! :blush:
So, I have a couple of unresolved options - I will have to do a board turn regardless in order to get to the MISO, MOSI and SCK pins I will have to use to either load the bootloader or program direct. Since I am going from the 328 to the 8, am a bit concerned that I might need the serial monitor for debugging so that would make my 6 pin connector into a 9 pin, might not fit. Do you only get the serial monitor if you install the bootloader? Seems like that’s the case but I haven’t been able to verify that.
Secondly, I did a quick experiment and tried to verify my code would build for the mega8 by selecting that board option and trying to verify; it failed with a bunch of errors stemming from my use of the softserial lib (critical for my app). Do I deduce that SoftSerial is not supported on mega8? Any suggestions for what I might use in place of SoftSerial lib?
Are there yet to be discovered issues with trying to move my code backward from 328 to mega8?

I will have to go take a whipping from my customer next week. I am hoping I can smile and describe the way forward.

I would be happy to post my code and schematics if anyone thinks it may be useful in resolving my dilemma.

Thanks for any and all advice.

The bootloader and Serial library are two different things.
You can upload a sketch without bootloader and still have the Serial library.

The ATmega8 is so much smaller, you can do one task, maybe one and a half.
The Serial library takes up a big part of the ATmega8, and the SoftwareSerial perhaps even more.
I use the Serial library for my ATmega8 during testing. When there are 2 sensors, I test them one by one. After that I disable the Serial and enable both sensors. That's how I get them working.

You can get a smaller bootloader with the Optiboot and save a few bytes for the sketch.

Some libraries don't work well with the ATmega8, like the Tone library. Since the PCINT interrupt are not available on the ATmega8, I guess that is the reason that the SoftwareSerial won't work.

Can you use the ATmega328p ? You can use that instead of the ATmega8 (I'm sure about the DIP and maybe the TQFP package), it's has the same pins and layout. Or is it already soldered in place ? If so, forget the serial monitor, use the hardware serial for the other chip and upload the sketch without bootloader.

Yes, I understand about the bootloader, not being tied to the SoftSerial library, but I was asking about the serial monitor, the feature that acts like a console port in the arduino IDE. I think your observation regarding the PCINT may be the killer here. My app essentially listens on a serial port that I make out of D8 and D9 (per the Soft Serial lib), parses the data stream until a key sequence is detected, then sends a guid code back to the host system. Pretty simple, but my circuit board is restricted to 250 mm in diameter, so not a lot of room. the ATmega8 comes in the 32-M1 package that is only 5 mm square, if I can find the 328 in the 32-M1 package then I will be home free, otherwise I will have to see if I can either make the mega8 work or go to a two board design, which I really don't want to do.
Thanks for your feedback.

Ducatiguy:
Yes, I understand about the bootloader, not being tied to the SoftSerial library, but I was asking about the serial monitor, the feature that acts like a console port in the arduino IDE...."

The serial monitor of Arduino works for every device using UART. I've watched PIC's and TEXAS microcontroller saying "Hello World" from it.
Yes, an AVR without arduino bootloader can be debugged too.

I think they exist : http://www.atmel.com/devices/ATMEGA328P.aspx

Well I apparently did not do my research fully, It appears that the 328 does indeed come in the 5 mm square 32-M1 package and Digikey has them. Digikey offers a pre programming service so I have inquired regarding having them pre program the bootloader. If they can do that my existing circuit board might just work after all! Would that be a stroke of good fortune! I think I saw where you can pick up the hex file for the bootloader on the Arduino site.

Thanks to all for the help.

When you let others write the bootloader, also the fuses have to be set.

When you write the bootloader yourself, use the Arduino IDE.
You have to use a programmer, and when you use the Arduino IDE to upload the bootloader, also the fuses and so are set. It's in the menu somewhere.

Maybe you could check some of the other 32-pin parts in the 328 family:
ATmega48A; ATmega48PA; ATmega88A; ATmega88PA;ATmega168A; ATmega168PA; ATmega328; ATmega328P
Search Mouser & Digikey for -AU ending:
atmega48a-au, atmega88a-au, etc
as price saving methods.

I think I should be searching for the -MU, isn't that the -31M 5mm square package? If I'm wrong on that please correct me.
DIgiKey lists them at about $3.50 ea. If I can get the boot loader pre-programmed, then I can just drop these onto my board and I should be good to go. No board turn!

Yes, the -MA. So used to typing -AU for the leaded part.

Atmega48A-MU looks to be the lowest in small qty, $2.54:

How little would it cost to have new boards made that are designed for the 328?

Some times it's best just to say ***k it and start over.

...R

Not so cheap, the first set cost me about $500 for ten quick turn (SunStone very close by). I would rather not have to eat another 1/2 grand (and I am rapidly running out of schedule). But if I can't get the parts with the bootloader pre-programmed I can turn the board $$$, add two more pins to the micro connector (i have the interface for the FTDI like on the mini pro built in) and make a secondary harness for the ISP connection to load the bootloader as part of board assembly before the thing goes into the final assembly where the app gets loaded by the customer (slightly different apps for different models). Not out of the game, just a bit of inconvenience because I did not do all my homework... When do we learn???

Ducatiguy:
Not so cheap, the first set cost me about $500

I feel your pain.

...R

Crossroads, perhaps you can advise on this question:
I have talked with Digikey and they can pre-program the parts for me ($50 set up $0.25 per device) . This looks pretty attractive to me. Can I use the Arduino bootloader hex file without restriction? It is freeware is it not? Second would you recommend I stay with the Arduino bootloader or migrate to the so called "enhanced" bootloader from Lady Ada as suggested by CodingBadly in another thread? I want my customer to be able to load the sketch using the Arduino IDE.
And what about that pesky checksum that digikey wants for the hex file? any idea how to go about calculating that ? Is that just a mod 65,536 of the sum of all bytes? probably need to ask Digikey but thought you might know.

Read the license page:
http://creativecommons.org/licenses/by-sa/3.0/
I've never had any issues with the standard bootloader.
What's the enhancement?
Checksum as sum of all bytes sounds reasonable - if you look at your hexfile, it's probably the last byte or int of the file. You need to tell them fuse bytes also, otherwise you end up with a 1 MHz internal clock.

yeah, I'm chewing on the fuse programming now, I may have a question or two on that topic.

From the Lady Ada site :
This version has a few fixes: first it integrates the 'no-wait' and 'no-hang' fixes below. It also fixes the annoying "missing signature bytes" bug that freaks out avrdude when programming without the IDE. I also repaired the EEPROM code so that now you can upload and download the EEPROM memory as well as flash. Finally, theres a 'upload feedback' using the LED, for arduino clones that don't have TX/RX leds.

I think I will stick with the Arduino bootloader, it seems to be working fine for me. I only need to load the sketch once.

Thanks for the license link.