Showing posts with label ATTiny84. Show all posts
Showing posts with label ATTiny84. Show all posts

Friday, 14 November 2014

AVRDUDE – Pagel and BS2 error

According to Wiki, the Pagel BS2 signals error that happens when you are programming an ATTiny85 (and apparently the 84 too) is a consequence of some missing configuration in the avrdude.conf file that comes with the Arduino.
Apparently, you need to correct the configuration problems and then everything will be fine. It is.
  1. Go to your Arduino IDE installation folder (something like C:\Program Files (x86)\arduino-1.0.4\hardware\tools\avr\etc.
  2. Before you do anything … make a backup of the file avrdude.conf
  3. Open the avrdude.conf file in a text editor
  4. locate the ATTiny85 section in the file
  5. locate the chip_erase_delay = 4500; line
  6. add the following two lines below this:
      pagel = 0xB3;
      bs2 = 0xB4;
  7. locate the memory=”lock” keyword in the ATTiny85 section
  8. replace this section with the following (copy and paste)
memory "lock"
   size  = 1;
   write = "1 0 1 0  1 1 0 0  1 1 1 x  x x x x",
           "x x x x  x x x x  1 1 i i  i i i i";
   read  = "0 1 0 1  1 0 0 0  0 0 0 0  0 0 0 0",
           "0 0 0 0  0 0 0 0  o o o o  o o o o";
   min_write_delay = 9000;
   max_write_delay = 9000;
;


Do the same for the ATTiny84 section.
You will need to restart the IDE for this to be affected.
After this, you need to
  1. Connect the ATTiny85 to the Arduino using your favourite ICSP
  2. load the sketch into the IDE
  3. Select the ATTiny85 board in the IDE
  4. Select Arduino as ISP in the IDE
  5. Upload your sketch to the ATTiny85.
That should fix the problem.
I have now tested the abovementioned fix and the error message has now gone away. To test this, I loaded the sketch from Tutorial 10, compiled and then uploaded it to the ATTiny85 with the following, successful, result.
image
As you can see, the Pagel and BS2 error messages have gone … YAY! Thank you Wiki Page!
After uploading the sketch to the ATTiny85, I dropped the ATTiny85 chip into the circuit and powered it up, again, success. The circuit does what it’s supposed to do.
All in all, happy camper time.

Thursday, 2 October 2014

Arduino ATTiny84 ISP Shield – PCB – Part 2

Here is the completed Arduino UNO ATTiny84 ICSP (ISP) Shield that I have just completed.

ATTiny84 ICSP Shield 02

While soldering the board, I went through and tested each trace with the multimeter so that I wouldn’t have to go back later and find any dud connectivity. It turns out that there weren’t any shorted or broken traces this time, so it may have been a vein effort, however, I know that when I plug it in and run the circuit, that at least there aren’t any hardware failures.

The Arduino IDE test (using the UNO as an ISP) went without a hitch too, so it seems that all of my errors were caught early on and I ran out of problems … yay!

I am quite pleased with the two ICSP, they work well, have minimum components and an elegant design.

To recap on some of the design elements, below is the connections from the ATTiny84 to the Arduino UNO.

ATTiny84_To_Arduino

You can see that the connections for the ATTiny84 are essentially the same as  theATTiny85, just arranged differently.

I have been thinking about using a tri-coloured LED (common cathode) to replace the three 3mm Red, Green and Blue LED … but that can wait for now, I really don’t need the extra ICSP.

Arduino as ISP for ATTiny84

Following on in the same vein as my previous articles on Arduino as ISP for ATTiny85 IC, this article addresses the ATTin84. I refer you to the previous posts in the thread ATTiny85 thread for more information on plans, designs and etcetera, particularly Arduino as ISP for ATTiny85.

As I have mentioned in previous articles, there are very few differences between the 84 and the 85 in terms of pinouts. The arrangement and number of the pins are probably the most significant differences. The components required are virtually the same (you need a 14 pin DIP rather than an 8 pin … and obviously, you need an ATTiny84 IC).

ATTiny85_To_Arduino

Above is the pinout for the ATTiny85 IC and how it connects to the Arduino UNO. Below is the pinout for the ATTiny84 and how it connects to the Arduino UNO.

ATTiny84_To_Arduino

The differences between the two chips mean that there is some significant difference in the arrangement of the PCB that I designed for the ATTiny85 but the footprint is nearly identical and the ArduinoISP sketch that comes with the Arduino IDE needs no modification at all.

The Blink sketch also does not need modification from the already modified ATTiny85 version of the sketch, however, instead of connecting the LED to pin 5 (PB0), we are now connecting to pin 2 (PB0). Well … I still need to verify that once I’ve finished building the ISP and then breadboarded the ATTiny84 IC in the same test configuration as the previous article. But from my current reading, that should be just Jim Dandy.

Tuesday, 30 September 2014

Arduino ATTiny84 ISP Shield – PCB – Part 1

Following on from my ATTiny84 ICSP Arduino Shield Plan article and in the same vein as the Arduino ATTiny85 ISP Shield articles, I am now in the process of making an Arduino shield for programming the ATTiny84. This is the 16 pin miniature Atmel microprocessor.

ATTiny84_Pinout_thumb1

The above shows the pin configuration of the ATTiny84 that the shield will interface to the Arduino. The relevant pins for ICSP control are Vcc, GND, PB3 (RESET), PA4 (USCK), PA5 (MOSI), and PA6 (MISO).

Once again, the design makes use of the Arduino Pins 7, 8 and 9 for PRG, ERR and HB indicator LED, so while the arrangement of pins is different, the function and interface to the Arduino UNO is the same.

Fritzing-ATTiny84-ICSP_etch_copper_b

The above image is the mirror reverse copper bottom layer converted to a jpeg file. And below is the toner transferred PCB that was created using the above (although, I’ve used the raster PDF version rather than the converted bitmap). Last night I discovered that I got this wrong. The copper trace on the bottom of the PCB should not be reversed. Make sure you print it out correctly. I still get this wrong from time to time.

ATTiny84-ISP-Shield-01_thumb1

I’ve since given the PCB a bit of a scrub with a wet thumb to remove the remaining paper residue and gone over the traces with a medium Staedtler Lumocolor marker to improve the resolution of the traces and pads.

Now all that remains is to etch the board and start populating it in the same manner as the ATTiny85 version.

I also made another 9V to 5V regulated power supply. The only difference that I am making to the new 5V reg is to orient the output +/- on the bottom of the PCB so that I can plug it directly into a solderless breadboard (meaning that I don’t have to chase wires from the reg to the board … more elegant, I think).

9V---5V-Regulator_thumb

Again, scrubbed with wet thumb and then retraced with the marker to give a better resist for the acid bath.

In case you are interested … here is the bitmap copper bottom mirror for transfer toner.

Fritzing-9V-to-5V-Regulator_etch_cop

Well … that’s it for me, tonight.

Tuesday, 29 July 2014

ATTiny84 ICSP Arduino Shield – Plan

A side issue for the ATTiny84 is loading sketches from the Arduino IDE. The approach that I have seen in several guises is using an Arduino Uno to program the ATTiny84. 42 Bots has fairly common design (from what I have seen on the Interweb) - Programming ATTiny84/ATTiny44 With Arduino Uno.

The approach appears to be consistent with several other designs. The main trick is loading the Master Tiny board definitions into the Arduino IDE. I had a bit of a hassle with this as it seems that the IDE has to be completely shut down and restarted to recognise the new hardware.

As it is likely that I’ll want to reproduce this at some stage, I figured that it would be sensible to create a shield for my Arduino that I can drop the ATTiny84 into the DIP socket, transfer the program and then pop the MCU out. I’d then drop the programmed ATTiny84 into my live circuit and continue.

From:

Programming an Attiny84 or Attiny44 with Arduino Uno

I got:

Fritzing ATTiny84 ICSP_bb

as a wiring diagram … and from that it becomes:

Fritzing ATTiny84 ICSP_pcb

There really isn’t much to the board other than it’s pin locations aligning with the sockets in the Arduino Uno. That, and the 10uF capacitor terminating the UNO Reset pin.

I’ll make this up as a PCB so that I can simply attach it to the UNO as a shield and, I’m away.

9V to 5V Voltage Regulator – Plan

I have a couple of plans that involve reworking some of my earlier circuits into a sub-circuit environment and using an ATTiny84 chip as the controller.

The overall view is as follows:

Block Diagram

There will be an ATTiny84 at the core that will take analog input from three Momentary switches to toggle the three load circuits on and off.

The three load circuits are the:

These load circuits will be “controlled” by the ATTiny84 only in so far as the ATTiny84 will be serving power to the load circuits.

To start with, I’m going to be designing and building the 5V Regulated Power circuit to take the input 9V and deliver a smooth 5V to the ATTiny84.

Handily, Fritzing has a nice example circuit to start me off.

Fritzing 9V to 5V Regulator_bb

This simply passes the power from the 9V battery to a LM7805 and the output to a pin block. The circuit uses two 100nF capacitors to smooth the input and output. I have simply replaced the generic LM and input power in the Fritzing example with the LM7805 and a 9V battery.

For the PCB view, in Fritzing, the same changes have been made.

Fritzing 9V to 5V Regulator_pcb

I made some other minor cosmetic changes to the PCB design, such as added labels and rescaled the board (20mm x 20mm).

Paypal Donations

Donations to help me to keep up the lunacy are greatly appreciated, but NOT mandatory.