User Tools

Site Tools


digispark:tutorials:programming

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
digispark:tutorials:programming [2015/03/06 19:27]
jmccorison spelling, wording and punctuation corrections in HVSP instructions.
digispark:tutorials:programming [2016/06/09 12:03] (current)
Line 1: Line 1:
 ======Beginners Guide to Extended Programming Attinys with Digispark====== ======Beginners Guide to Extended Programming Attinys with Digispark======
  
-//​**Preface**: ​ As I am not an native english speaker, you are more than welcometo fix any mistakes in grammar or spelling. It will help meimproving my foreign language skills. +//​**Preface**: ​ As I am not an native english speaker, you are more than welcome to fix any mistakes in grammar or spelling. It will help me improving my foreign language skills. 
-This page is meantas an first overview over all digispark related hardware-programming methods. ​Its meant as a kind of landing pagewhere users can link from the forums.//+This page is meant as an first overview over all digispark related hardware-programming methods. ​It'​s ​meant as a kind of landing page where users can link from the forums.//
  
-There are three ways you can store binary program code into an AVR controller: ​ ISP, HVSP, and Self-Programming. ​ When you start playing around with an digisparkyou are using the self-programming feature of the Attiny.+There are three ways you can store binary program code into an AVR controller: ​ ISP, HVSP, and Self-Programming. ​ When you start playing around with digispark you are using the self-programming feature of the Attiny.
 =====Self-Programming the Attiny – or the digispark way of life===== =====Self-Programming the Attiny – or the digispark way of life=====
-To enable that featureyou need to use one of the other two methods mentioned before to get a piece of code on the attiny, which than would allow you to pull additional code into the attinyor changing ​the additional code.  Uploading that initial code is one of the tasks in the digispark-production.+To enable that feature you need to use one of the other two methods mentioned before to get a piece of code on the attiny. This will then allow you to pull additional code into the attiny or change ​the additional code.  Uploading that initial code is one of the tasks in the digispark-production.
  
-The code making this possibleis the [[https://​github.com/​Bluebie/​micronucleus-t85|bootloader micronucleus]],​ written and maintained by the board-member bluebie.+The code making this possible is the [[https://​github.com/​Bluebie/​micronucleus-t85|bootloader micronucleus]], ​which is written and maintained by the board-member bluebie.
  
-This bootloader resides in the first 2k of the 8k memory of the attinyand allows youto use the remaing ​6k for your programs. The big benefit of that piece of smart code is that you need no other hardware tool to program a digispark as you would for the other two methods. ​ It will even go one step ahead, ​and making ​it possible, that you can use the digisparkprogramming other core attinys in two (or lets say one and a half way).+This bootloader resides in the first 2k of the 8k memory of the attiny and allows you to use the remaining ​6k for your programs. The big benefit of that piece of smart code is that you need no other hardware tool to program a digispark as you would for the other two methods. ​ It will even go one step further ​and make it possible ​for you to use the digispark ​for programming other core attinys in two (or lets say one and a half) different ways.
  
-For that purpose micronucleus emulates USB hardwareas the attiny has no on-board USB device. Communication is done with an host component, even called micronucleus, on Windows systems ​its for example ​//​micronucleus.exe//​.+For that purpose micronucleus emulates USB hardware as the attiny has no on-board USB device. Communication is done with host component called micronucleus. On Windows systems ​it'​s ​//​micronucleus.exe//​.
  
-To facilitate this special way programming the digispark, digistump has patched the IDE by adding a custom version of avrdude (a program which is mostly used in the arduino world). ​ Digistump'​s custom version of avrdude is an wrapper, deciding to call either the original avrdude ​(for everythingwhich is not a digisparkor micronucleus in case of the digispark.+To facilitate this special way of programming the digispark, digistump has patched the IDE by adding a custom version of avrdude (a program which is mostly used in the arduino world). ​ Digistump'​s custom version of avrdude is wrapper ​which calls either the original avrdude for everything which is not a digisparkor micronucleus in the case of digispark.
 There are however some drawbacks: There are however some drawbacks:
  
-The emulation of a USB interface affects the use of 2 I/O pins.  ​P3 (analog3) and P4 (analog2) Both are regulated with a Zener diodewhich limits the voltage on those two pins to a max of 3.6V, affecting ​some uses like analogRead() or high levels resulting from digitalWrite(). ​ P3 also has a 1.5K pullup-resistorcreating even more problems for this kind of usage.+The emulation of a USB interface affects the usage of 2 I/O pinsP3 (analog3) and P4 (analog2) Both are regulated with a Zener diode which limits the voltage on those two pins to a max of 3.6V. This affects ​some uses like analogRead() or high levels resulting from digitalWrite(). ​ P3 also has a 1.5K pullup-resistor creating even more problems for this kind of usage.
  
-An advantage of the emulated USB solution is that this way of programming the Attiny frees one more GPIO pin; the pin PB5. This pin is otherwise used as reset, which is needed for programming the chip with an external ISP programmer.+An advantage of the emulated USB solution is that this way of programming the Attiny frees one more GPIO pin; pin PB5. This pin is otherwise used as reset, which is needed for programming the chip with an external ISP programmer.
  
 ====Small Introduction to pin-names==== ====Small Introduction to pin-names====
-//You need to be very careful, when it comes to PIN names on the AVR microcontrollers. There are plenty of names arounddepending ​of  ​functions or locations. Further enumeration depends, if that is done logical or physical.// ​+//You need to be very careful, when it comes to PIN names on the AVR microcontrollers. There are plenty of names around depending ​on functions or locations. Further enumeration depends, if that is done logical or physical.// ​
  
-//There are the pin numbers of the core chip, starting with one at the special marked pin going counter-clockwise around the chip. Than there are the numbers of GPIO-pinsAVR groups ​those to internal ports, where up to 8 pins can be aggregated. ​ Those ports are named with letters (A, B, ..). Unfortunately the attiny85 is missing ​the port A, so the GPIO pins are called PB0 to PB5. And as you see, in the logical enumeration they start with 0and there is no match to the physical pin number. When it now comes down to the digispark itself, those 6 pins are named P0 to P5 on the PCB; however in the schematics enumeration starts with 1.//+//There are the pin numbers of the core chip, starting with one at the special marked pin going counter-clockwise around the chip. Then there are the numbers of GPIO-pins ​which AVR groups to internal ports, where up to 8 pins can be aggregated. ​ Those ports are named with letters (A, B, ..). Unfortunately the attiny85 is missing port A, so the GPIO pins are called PB0 to PB5. And as you see, in the logical enumeration they start with 0 and there is no match to the physical pin number. When it comes down to the digispark itself, those 6 pins are named P0 to P5 on the PCB; however in the schematics enumeration starts with 1.//
    
 //There are a lot of other names, depending of functions for special protocols or chip-functions,​ like SCK, MISO, MOSI. Those additional functions are even not related to corresponding GPIO-pins. On the attiny85 SCK is together with PB2 on physical pin7. On the attiny167, for example, SCK resides with PA5 on physical pin 8. So always pay attention to documentation before making assumptions!//​ //There are a lot of other names, depending of functions for special protocols or chip-functions,​ like SCK, MISO, MOSI. Those additional functions are even not related to corresponding GPIO-pins. On the attiny85 SCK is together with PB2 on physical pin7. On the attiny167, for example, SCK resides with PA5 on physical pin 8. So always pay attention to documentation before making assumptions!//​
digispark/tutorials/programming.txt · Last modified: 2016/06/09 12:03 (external edit)