ATTINY404 - Howto program/Software tools

Go To Last Post
32 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi everyone I want to get into microprocessor programming and suchlike I bought 25 * 8bit AVR ATTINY404 - SOIC14 and wish to program them does anyone know of a cheap compatible programmer and what software tools would you recommend to develop for this chip?

 

My first project will be a simple led blinker with a secondary red led to be illuminated when battery gets low hopefully this will be simple enough for me to do.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

What language do you want to use? C, C++, Asm or what?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

I don't mind, ideally c++ but i'm not afraid of assembler..........

 

just reading the faqs in your signature, thank you!

Last Edited: Tue. Mar 10, 2020 - 02:48 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

ID10TError wrote:
Hi everyone I want to get into microprocessor programming

That is what arduino was made for, easy and cheap to learn.

Picking a small AVR is a hard way to learn, you may want to look at MPLAB X and the snap programmer/debugger.

ID10TError wrote:
I don't mind, ideally c++ but i'm not afraid of assembler..........

Another perfect match for Arduino!

 

Jim

 

 

 

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Yeah, I understand that buying an mcu? then deciding you want to design a project around it is kind of the wrong order to do things in....... sorry for that. Am googleing the product you mentioned...... yeah so i also ordered 10 of these  PIC10F200-I/P as a backup incase the avr proved too difficult

Last Edited: Tue. Mar 10, 2020 - 03:12 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 2

As Jim says the "easy in" (VERY easy in) to AVR programming is not bare chips these days but "Arduino". You buy an Arduino and you are controlling nuclear power stations about 10 minutes later. A lot of the "nitty-gritty" detail is done for you so you can concentrate on implementing projects/solutions. You can delve deeper if (or when) you want but it's a real "instant results" system.

 

As you are about to find using your bare 404s it's not just about an IDE or a compiler or a programmer but you are going to have to sort out clocking systems and power supplies (and decoupling and all sorts of other considerations) to actually get the chips to even blink an LED.

 

if you are going "bare metal" the first port of call is, of course, the datasheet:  http://ww1.microchip.com/downloads/en/devicedoc/50002687a.pdf  in that you will learn that the program/debug interface to the chip is"Unified Progra and Debug Interface" (UPDI) so you are going to need some interface electronics between PC and AVR that can operate that interface. The Microchip options are basically Atmel-ICE or Snap!

 

Rather ironically a "3rd party" way to do UPDI is actually to get a separate Arduino and put something into that which will talk "PC" on one side and "UPDI" on the other side facing a chip like a 404 to program it.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ok advice taken, i'll look into Arduino and shelf these until i get really bored

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

>does anyone know of a cheap compatible programmer and what software tools would you recommend to develop for this chip

 

As already mentioned, mplabx is good and a SNAP programmer (~$15) will work fine. The SNAP can handle the avr0/1 along with pic's that can do low voltage programming, and other mcu's they make such as pic32 and sam.

 

>so i also ordered 10 of these  PIC10F200-I/P as a backup incase the avr proved too difficult

 

Not the best choice. Its a simple mcu, but almost too simple. You will be required to use a high voltage programmer such as pickit3. Move over to something that can do low voltage programming and you can use the SNAP.  Something like a PIC16F15313 is a nice 8 pin part that you can get in a dip package. You can also move up to 14/20 pins. You can start simple in any case, and ignore all the peripherals that are not used and will be no different than using a pic10.

 

They make a bunch of 8pin+ pic's that can do low voltage programming. They also make a number of cheap development boards (<$20) that have a programmer built in- avr0/1 boards and pic boards. I have a few attiny416 xplained nano, attiny817 xlpained mini, atmega4809 curiosity nano, a pic curiosity board that can accept 8/14/20 pin pic's into its dip socket, and a few SNAP's.

 

A couple good/cheap choices-

ATTINY817-XMINI - $8.88

ATTINY416-XNANO - $8.88

they have a programmer on-board, so all you need to do is download mplabx and xc8 (or any other avr compiler version). The 817 xmini is probably a little nicer board, but the 416 xnano works better on a solderless breadboard. Get one of each.

 

 

>I don't mind, ideally c++

 

The upside to pic 8bit, is they are nice mcu's with a lot of nice features on the newer ones. The downside is you have a decent free c compiler (xc8), but you will not be doing any c++. The avr0/1 are nice also with the added benefit of a compiler (gcc) that can do c++. Either one can blink led's and do mcu things, and you are not limited to choosing one or the other.

 

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

The Product Page is the place to go for information:

 

https://www.avrfreaks.net/commen...

 

https://www.avrfreaks.net/commen...

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

ID10TError wrote:
ok advice taken, i'll look into Arduino and shelf these until i get really bored

 

I recommend a cheap Arduino nano clone that you can get from Ebay or Aliexpress. They have an atmega328P, which is a generic mid-range AVR very fit for learning all things AVR.

You don't need to use the Arduino IDE or the Arduino libraries to program it; all you need is avrdude and any AVR compiler or assembler.

 

The tiny404 is smaller and more modern, but also more complex, since it's really a xmega-lite. Saving it for later is a good idea.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

I am working with ATtiny202 and MPLAB Snap In-Circuit Debugger/Programmer without any problems. You need just to modify Snap according to ETN #36 MPLAB® SNAP AVR UPDI/PDI/TPI Interface Modification and slow down the communication speed from 0.5 MHz to 0.3 MHz in MPLAB X IDE (with XC8) Snap settings.

Start your first project on start.atmel.com and import it into MPLAB X IDE.
 

Last Edited: Tue. Mar 10, 2020 - 08:24 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Kevil wrote:
and slow down the communication speed from 0.5 MHz to 0.3 MHz

I wonder if this is perhaps related to your cabling...?

 

And just curious - are you using the virtual serial port on the Snap as well?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

i'll look into Arduino and shelf these until i get really bored

Note that Arduino can support the ATtiny404 via the SpenceKonde's "megaTinyCore"

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Yes, I am using virtual serial port on the Snap too wink.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 2

I also recommend the xplained 416 nano, it's a very well priced (< $10) development board and has everything you need to start. It can connect over USB so you don't need to worry about wiring your programmer correctly or powering your device.

 

I started using that board before I build my own development hardware. It was very useful to verify concepts.

Last Edited: Tue. Mar 10, 2020 - 09:34 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks for all the advice, i have ordered an Arduino but am very keen to understand more about 

 

clawson Thanks for the heads up I like the idea of getting an Arduino and programming that to program the Attiny(UPDI)unit. :) And i will take a look at ATTINY817-XMINI and ATTINY416-XNANO

awneil Thanks for the link to the product page.

El Tangas Done! :)

Kevil Thanks for the data so can use snap programer if adhere to addendum

westfw Awesome! Ill still have to get a UPDI unit to begin with but the idea of flashing them to that spec really interests me, I wonder how many changes must be made to IDE/Compiler to get it to function with the different chips from standard

mraardvark Thanks for your input

markxr Thanks for the heads up!

ki0bk  Thanks your input is appreciated! I have ordered an Arduino

 

I should also point out that I have called interrupts on the pc using inline assembly using turbo c++ in the past so i'm not completely new to microprocessor development but all advice appreciated! :)

 

Also i was kind of choosing my platform by the price of the chips/availability in small numbers

Last Edited: Wed. Mar 11, 2020 - 06:35 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

curtvm wrote:
... and a SNAP programmer (~$15) will work fine.
MPLAB Snap Mar'20 | AVR Freaks

curtvm wrote:
They also make a number of cheap development boards (<$20) that have a programmer built in- avr0/1 boards and pic boards.
Development Tools - Curiosity Nano Boards

 

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

So i ordered a snap programmer, but i have a question regarding the  "SNAP AVR UPDI/PDI/TPI Interface Modification" after I do the modification will i still be able to program the older chips?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

As I understand it, you won't be able to debug PIC devices, regardless of their age... 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

But will it still be able to program older PIC devices, what programmer/emulator/debugger do i need for the PIC devices?

 

Last Edited: Wed. Mar 25, 2020 - 05:15 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

ID10TError wrote:
But will it still be able to program older PIC devices

The modification is to remove the pull-down and introduce a pull-up.

UPDI is UART-based, and the UPDI idle state is line 'high'.  This requires the mod.

PIC debug executives rely on a pull-down since the idle-state is line 'low'.  This is natively supported on Snap.

Programming PICs might work, although I may be wrong... worth a try.

Personally I would probably recommend keeping two Snaps, one for PIC and one for AVR.  But that doubles the price :/ 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

I suggest that you make two Adapters for your SNAP

e.g. 8x1 angle-header,  3x2 straight header,  Protoboard, 1k0 pullup resistor.  for AVR PDI, UPDI, ISP, TPI

e.g. 8x1 angle-header,  PIC header,  Protoboard, 4k7 pull-down

 

You probably have some male and female header strip.   Offcuts of Protoboard.  Resistors.   6-way ribbon cable.

 

You can also put a 5x2 header on the AVR Adapter.   Then use regular 10-way ribbon cable for AVR JTAG targets.

 

SNAP is incredibly cheap.   An Adapter is easy to make.    You will never have wrong connections.   Considerably stronger and more reliable than ATMEL-ICE cable or connectors.

 

David.

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

mraardvark wrote:
Personally I would probably recommend keeping two Snaps, one for PIC and one for AVR.
and a third for AVR and Virtual COM with possibly a spare MPLAB Snap as a backup to one's preferred debugger (s**t happens)

mraardvark wrote:
But that doubles the price :/ 
less impact due to the current sales

MPLAB Snap Mar'20 | AVR Freaks

microchipDIRECT zero price shipping Mar'20 | AVR Freaks

 


https://www.avrfreaks.net/forum/mplab-snap?page=1#comment-2744311

 

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

ID10TError wrote:

But will it still be able to program older PIC devices, what programmer/emulator/debugger do i need for the PIC devices?

 

* The following should be used in a new thread... or be deleted. Your choice. Moderator. *

Has anyone heard of Renesas Electronics R7F0C30542ESP#AC0, 8bit 78K0 Microcontroller, 10MHz, 16 kB Flash, 16-Pin SSOP

They are going for like 30 cents in a pack of 25. ->  https://au.rs-online.com/web/p/microcontrollers/7753900/

The 78K0 is a pain.   Especially for suitable IDE, tools etc.

 

Note that a 16kB chip is not going to do most practical apps.

If you just want a Blinky,  you can do that with an ATtiny5.

If you don't have 25  suitable trivial projects,   it makes more sense to buy 10 sensible chips @ $0.75 each.    Especially if you are familiar with AVR and AVR tools. 

 

There are Chinese microcontrollers that are cheap.

 

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

>after I do the modification

 

You don't have to actually modify the snap hardware, just put a 1k pullup (or whatever is suitable) on the updi pin of the target avr0/1 mcu. When using for a (low voltage) pic it will be same as always.

 

I have a snap hooked up to a mega4809, and have been programming it for a long time with just a 1k pullup on updi. I would try that before doing any hardware modification.

 

 

Here's a 'real' SNAP modification (that still does not modify the hardware)-

https://photos.app.goo.gl/HA7Egm...

 

The purpose of this creation was to get voltage out (5v or 3v3), since by default they have no target voltage output. The onboard 3v3 regulator may not be able to handle the needed current, so a 3v3 buck regulator was added to do the 3v3 work and the usb can handle the 5v directly (they have a current limit chip for usb set at about 1A it seems). A case is nice to have instead of dragging a bare board around on your desk hitting every other metallic object in sight. The 10pin connector gives the extra 2 pins needed for the target voltage source (no switch, just choose which voltage pin you want), which works good as I had a number of those 10pin sockets and jumper cables.

 

I have been running a few of these for a while- pic32, avr0/1, and works well.

 

You can also just use the 5v/3v3 via's (3v3 current limited by 3v3 regulator, which also powers the debugger mcu)-

https://photos.app.goo.gl/WtZsdZ...

I used that for a while and worked ok, but needed/wanted 400ma+ on 3v3 to power an Omega2 board.

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

So your snapmate contains a pull up resistor and you leave the original pull down resistor in place? Me thinks I just mount a switch to the existing resistor and do it that way (if i can fit one in(why not a little wire or 2?)) (selectively disabling the pull down resistor)? I dunno i'll probably ask in the forums about the snap modification just to be clear i am doing the right thing.......... (before I do it.....)

Last Edited: Wed. Mar 25, 2020 - 05:45 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

The original mod was just adding a 1k pull-up, later it was recommended that the pull down is also removed.

I have just the pull up and it works, but I guess it's more reliable to also remove the pull down, or it wouldn't be recommended (?).

Last Edited: Wed. Mar 25, 2020 - 06:22 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

>So your snapmate contains a pull up resistor and you leave the original pull down resistor in place?

 

No, whatever target is in use gets the pullup. If I have a curiosity board mounted on a breadboard, I add a 1k pullup resistor to the updi pin (on the breadboard). If I had many boards, I guess I would go with plan B and do something better. A simple switch as you suggest would be one of a number of ways to handle it.

 

Maybe I'll experiment with an extra snapmate board I have and add a pic10 to watch the dat/clk pins and either output high with a 1k resistor inline for the pullup duty or let the pin float where the snap 4k7 will pulldown. I'm sure that could also be done with a few parts, but a pic10 alone could do the job and I have some pic10's that are doing nothing (and could be programmed by the snap because they are low voltage programmable, so any software mods could easily be done by the snap it is in). The snap 4k7 could also be removed and another pic10 pin could do the pulldown when needed.

 

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I didn't even think of pulling it up via and on my own pcb(with the tiny 404 on it)(That is what you meant isn't it?)(With a 1k resistor from updi to voltage source for the chip?) So if i did that I could leave the 4k7 in place on the snap? Tell me if i'm talking out my arse........

Just got my snap programmer, i'm liking idea of modifying the client boards instead of the host programmer..... do I have this right?

 

 

Last Edited: Thu. Mar 26, 2020 - 10:34 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

>do I have this right?

 

true;

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

P.S. what does your Snapmate do? Is it just for pull up, pull down differences? Why are the placements for capacitors (as needed) on the board? What purpose are the caps for? Just curios.

 

 

And thanks for all the help, EVERYONE THANKS FOR ALL THE HELP!!!!!!

 

P.S. Again

 

What are components 2uh2 and is that a 3v3 voltage regulator beside it (probably adjacent to it better wording) ? And what is component 10U? (yeah there are two) like I don't understand the name and have not seen them before or cannot remember them at the moment because i'm something worse than drunk, 'U' is a type definition? Of what type of unit? Happily your friend ID10TError. :)

Last Edited: Thu. Mar 26, 2020 - 11:58 AM