How I got my old Classic Atmel AT90S8515 to work with Arduino IDE

Searching for AT90S8515 I came across a few posts by people wanting to use these chips.
I wanted to get it work, just because I had it and it was just sitting there doing nothing.
It took a while and some help from users of this forum, but I thought I should share what I did in case others would like to do the same.

Requirements:

  • Arduino IDE with a few mods
  • Obviously an AT09S8515-8 with an 8 MHz crystal connected to across pins 18 and 19, each with a 22pF cap to the ground //Edited per DrAzzy's comment below to 22pF
  • A programmer. I built a PonySer compatible one for a few bucks using this: AVR Programmer

I made the ICSP programmer header compatible with the Arduino 6 pin header because I thought it made sense, in case I need to upload a bootloader or whatever.

Since I was working under some assumptions, I am going to list them here:

  • AT90S8515 is pin compatible with ATMega8515, so I used files pertaining to ATMega8515
  • Although the AVR has an analog comparator, all I am doing is using digital pins
  • Doing this involves a certain risk, damage to the AVR, the computer it is connected to or other components is possible and I won't be held responsible for what you do if you decide to follow these steps.

So here are the steps:

I added this to my boards.txt file:

s8515.name=AT90S8515-8PC

s8515.upload.tool=avrdude
s8515.upload.maximum_data_size=8192
s8515.upload.protocol=ponyser
s8515.upload.speed=9600

s8515.build.mcu=at90s8515
s8515.build.f_cpu=8000000L
s8515.build.board=AVR_8515
s8515.build.core=arduino
s8515.build.variant=s8515

I added this to my programmers.txt file:

ponyser.name=Custom Ponyser
ponyser.communication=serial
ponyser.protocol=ponyser
ponyser.program.protocol=ponyser
ponyser.program.tool=avrdude
ponyser.program.extra_params=-P{serial.port}

I created a folder in \variants named s8515 and I saved in there this pins_arduino.h file:
http://www.avrfreaks.net/sites/default/files/pins_arduino.h

I then had to fix this file in order to make it work for the 8515.
This definition: const uint8_t PROGMEM digital_pin_to_timer_PGM[] = { will break the compiler, so you need to replace TIMER for pin 0 to NOT_ON_TIMER.
Also, this definition is missing the closing curly bracket and the semicolon. See below.
So here is the final definition in my file: //Edit: this is no good, see posted pins_arduino.h below, which works for the 8515

const uint8_t PROGMEM digital_pin_to_timer_PGM[] = {
NOT_ON_TIMER, NOT_ON_TIMER, NOT_ON_TIMER, NOT_ON_TIMER, // 0 - 3 // 0 was TIMER but brreaks compile
NOT_ON_TIMER, NOT_ON_TIMER, NOT_ON_TIMER, NOT_ON_TIMER, // 4 - 7
NOT_ON_TIMER, NOT_ON_TIMER, NOT_ON_TIMER, NOT_ON_TIMER, // 8 - 11
NOT_ON_TIMER, TIMER1A, NOT_ON_TIMER, NOT_ON_TIMER, // 12 - 15
NOT_ON_TIMER, NOT_ON_TIMER, NOT_ON_TIMER, NOT_ON_TIMER, // 16 - 19
NOT_ON_TIMER, NOT_ON_TIMER, NOT_ON_TIMER, NOT_ON_TIMER, // 20 - 23
TIMER1B, NOT_ON_TIMER, NOT_ON_TIMER, // 24 - 26
NOT_ON_TIMER, NOT_ON_TIMER, NOT_ON_TIMER, NOT_ON_TIMER, // 27 - 30
NOT_ON_TIMER, NOT_ON_TIMER, NOT_ON_TIMER, NOT_ON_TIMER, // 31 - 34
}; // << this is missing in the original file

Since I haven't yet tested everything, there may be problems with the pins or other stuff.
Once I have more details, I will post them.

As soon as a have a good pin_mapping.h file I will post it, including the pin mappings to the "Arduino" pins.

220pf caps on the crystal? Surely you mean 22 pf (these are often marked 220, 22 times 10^0 pf; like how 0.1uf caps are 104 (10 times 10^4 pf, which works out to 0.1uf).

DrAzzy:
220pf caps on the crystal? Surely you mean 22 pf (these are often marked 220, 22 times 10^0 pf; like how 0.1uf caps are 104 (10 times 10^4 pf, which works out to 0.1uf).

Just wanted to see if anyone is paying attention.... he he he
Post corrected, thanks Doc.

Let me take the opportunity to thank you and westfw for the guidance that made this endeavour possible.:relaxed:
Cheers.

Here is my new pins_arduino.h for the AT90S8515 with most pins tested with the Blink sketch.
The Arduino pins are shown on the chip pinout diagram in the commented section below.

#ifndef Pins_Arduino_h
#define Pins_Arduino_h

#include <avr/pgmspace.h>

#define NUM_DIGITAL_PINS	32
#define NUM_ANALOG_INPUTS	0

static const uint8_t SS		= 4;
static const uint8_t MOSI	= 5;
static const uint8_t MISO	= 6;
static const uint8_t SCK	= 7;
//static const uint8_t LED_BUILTIN = 34;

// ATMEL AT90S8515 / ARDUINO PINS
// PIN#                        PIN#
//   	      +---V---+
// 0  PB0  1  |       | 40 VCC
// 1  PB1  2  |       | 39 PA0 16
// 2  PB2  3  |       | 38 PA1 17
// 3  PB3  4  |       | 37 PA2 18
// 4  PB4  5  |       | 36 PA3 19
// 5  PB5  6  |       | 35 PA4 20
// 6  PB6  7  |       | 34 PA5 21
// 7  PB7  8  |       | 33 PA6 22
// RESET   9  |       | 32 PA7 23
// 8  PD0  10 |       | 31 ICP
// 9  PD1  11 |       | 30 ALE
// 10 PD2  12 |       | 29 OC1B
// 11 PD3  13 |       | 28 PC7 24
// 12 PD4  14 |       | 27 PC6 25
// 13 PD5  15 |       | 26 PC5 26
// 14 PD6  16 |       | 25 PC4 27
// 15 PD7  17 |       | 24 PC3 28
// XTAL2   18 |       | 23 PC2 29
// XTAL1   19 |       | 22 PC1 30
// GND     20 |       | 21 PC0 31
//            +-------+

#ifdef ARDUINO_MAIN

const uint16_t PROGMEM port_to_mode_PGM[] = {
	(uint16_t) &DDRD,
	(uint16_t) &DDRC,
	(uint16_t) &DDRB,
	(uint16_t) &DDRA,
};

const uint16_t PROGMEM port_to_output_PGM[] = {
	(uint16_t) &PORTD,
	(uint16_t) &PORTC,
	(uint16_t) &PORTB,
	(uint16_t) &PORTA,
};

const uint16_t PROGMEM port_to_input_PGM[] = {
	(uint16_t) &PIND,
	(uint16_t) &PINC,
	(uint16_t) &PINB,
	(uint16_t) &PINA,
};

const uint8_t PROGMEM digital_pin_to_port_PGM[] = {
	PB, PB, PB, PB,
	PB, PB, PB, PB,
	PD, PD, PD, PD,
	PD, PD, PD, PD,
	PC, PC, PC, PC,
	PC, PC, PC, PC,
	PA, PA, PA, PA,
	PA, PA, PA, PA,
};

const uint8_t PROGMEM digital_pin_to_bit_mask_PGM[] = {
	_BV(0), _BV(1), _BV(2), _BV(3),
	_BV(4), _BV(5), _BV(6), _BV(7),
	_BV(0), _BV(1), _BV(2), _BV(3),
	_BV(4), _BV(5), _BV(6), _BV(7),
	_BV(0), _BV(1), _BV(2), _BV(3),
	_BV(4), _BV(5), _BV(6), _BV(7),
	_BV(7), _BV(6), _BV(5), _BV(4),
	_BV(3), _BV(2), _BV(1), _BV(0),
};

const uint8_t PROGMEM digital_pin_to_timer_PGM[] = {
	NOT_ON_TIMER, NOT_ON_TIMER, NOT_ON_TIMER, NOT_ON_TIMER,
	NOT_ON_TIMER, NOT_ON_TIMER, NOT_ON_TIMER, NOT_ON_TIMER,
	NOT_ON_TIMER, NOT_ON_TIMER, NOT_ON_TIMER, NOT_ON_TIMER,
	NOT_ON_TIMER, NOT_ON_TIMER, NOT_ON_TIMER, NOT_ON_TIMER,
	NOT_ON_TIMER, NOT_ON_TIMER, NOT_ON_TIMER, NOT_ON_TIMER,
	NOT_ON_TIMER, NOT_ON_TIMER, NOT_ON_TIMER, NOT_ON_TIMER,
	NOT_ON_TIMER, NOT_ON_TIMER, NOT_ON_TIMER, NOT_ON_TIMER,
	NOT_ON_TIMER, NOT_ON_TIMER, NOT_ON_TIMER, NOT_ON_TIMER,
};

#endif

#endif