Reliable communications for small memory microcontrollers

Hi, does anyone have any recommendations for a reliable communications protocol for a PC/Mac to an atmega328 that doesn't depend on a high memory footprint solution such as TCPIP?

The comms chain will probably look like this:
Mac running Python program > USB to serial converter > Xbee (series 1) > Xbee > serial cable > atmega328
The computer will be polling the atmega328 about once per minute.

The baud rate will be 57600 (to enable occasional over the air programming), but the average data once running rate will only be about 300 bytes per minute, but I need to know that the messages are getting through (or failing).

Adding ACK/NAK and checksums to something like Firmata would create yet another custom protocol, so I would prefer to use an existing standard if at all possible.

Thanks
Mike

to make a protocol reliable you should follow the steps also taken in TCP/IP -> something like

layer 0 : single bytes

layer 1: group bytes into a packet

  • add start and stop byte => determine packet from stream
  • add a CRC byte => check packet is OK

layer 2 : get stream of packets right

  • add sequence number => check no packet is missing
  • send ACK/NACK for every packet with sequence nr.
  • optionally add address bytes

I found an Xmodem library (S.F.T. XMODEM Library) that looks like the sort of thing that will do the job. The minimum packet size is 128 bytes, and the library is designed for writing to SD cards, but can probably be simplified.

xmodem is a file transfer protocol, don't know if that matches your needs

A file is just an array of bytes that has a name.
The contents of the file could be anything such as a serialised struct or something human readable.