Arduino 1.5.8 and Attiny 1.5.x (minor bug when using an attiny84)

Arduino 1.5.8 and Attiny
There seems to be a minor bug in Attiny 1.5 support (attiny84)

Replace (in pins_arduino.c) in section

if defined( AVR_ATtinyX4 )

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


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

See attached pins_arduino.c

pins_arduino.c (6.65 KB)

Why do you consider a different pin mapping to be a bug?

[quote author=Coding Badly date=1418244977 link=msg=1996309] Why do you consider a different pin mapping to be a bug? [/quote]

My background is high energy and solid state physics and I worked several years as IT Problem Manager in complex large scale environments.

While doing i.e. software tests my expectation that I get same results while compiling the same code with different compiler releases. So from my point of view it is a bug.

Lets have a look on the pins

// ATMEL ATTINY84 / ARDUINO
//
//                           +-\/-+
//                     VCC  1|    |14  GND
//             (D  0)  PB0  2|    |13  AREF (D 10)
//             (D  1)  PB1  3|    |12  PA1  (D  9) 
//                     PB3  4|    |11  PA2  (D  8) 
//  PWM  INT0  (D  2)  PB2  5|    |10  PA3  (D  7) 
//  PWM        (D  3)  PA7  6|    |9   PA4  (D  6) 
//  PWM        (D  4)  PA6  7|    |8   PA5  (D  5)        PWM
//                           +----+

My sample code work well using Arduino 1.0.5 but not while using 1.5.8. After my change it worked either on 1.0.5 and 1.5.8.

Same issue with pwm which also don't work using 1.5.8. So I'll have a look at pins_arduino.c again to solve that issue.

Look at all unexperienced users, they relay on the documentation. They might give up.

I'll never give up.

It is really weired.

But core_pins.h have to be updates as well.

Who else expect myself do testing with attiny 85/84 and 2313/4313.

I just got an idea why my port of trinket boot loader won't work on the 84. Must have a look at my winarv.

Which core are you using?

Latest core available from

https://code.google.com/p/arduino-tiny/downloads/detail?name=arduino-tiny-0150-0020.zip&can=2&q=

There is an updated version available from

http://www.leonardomiliani.com/en/2014/aggiornato-il-core-attiny-per-lide-1-5-8-di-arduino/

Checked core_pins.h in both versions, but they are identical and not correct.

Cause the pin mappping for the '84 don't match the physical layout.

I use the original configuration from highlowtech.org to make the corrections. Attiny85 works like a charm, but I didn't have the time to look at the other tinys.

This is the pin mapping you’ve created…

0 → B0
1 → B1
2 → B2
3 → A3
4 → A4
5 → A5
6 → A6
7 → A7
8 → A2
9 → A1
10 → A0

It makes no sense to me but if that’s what you want so be it.

Your mapping breaks PWM.

I’ll never give up.

A good thing given the PWM problem you’ve introduced.

Look at all unexperienced users, they relay on the documentation.

So the bug is with the documentation?

My sample code work well using Arduino 1.0.5 but not while using 1.5.8.
After my change it worked either on 1.0.5 and 1.5.8.

So the “bug” is that you have different cores installed for the two versions of the IDE?

Neither nore, I solved the pwm issue for my mapping, too.

No problem at all.

Just wondering why we may need different cores "aka" mappings.

But never mind, this was a good exercise for me to get a deeper understanding without reading through all documentation.