Author Topic: ATtiny FTDI question  (Read 13817 times)

0 Members and 1 Guest are viewing this topic.

Offline blackjamesTopic starter

  • Regular Contributor
  • *
  • Posts: 78
ATtiny FTDI question
« on: August 31, 2012, 10:19:55 pm »
hey guys, does antone know if i can program a ATtiny45 or 85 via my usb to ftdi converter from sparkfun using arduino software?
 

Offline Psi

  • Super Contributor
  • ***
  • Posts: 9930
  • Country: nz
Re: ATtiny FTDI question
« Reply #1 on: August 31, 2012, 11:59:21 pm »
USB to FTDI is just a way to generate a serial port from a USB port.

So connecting a USB to FTDI cable to a microcontroller only gives you access to the TX RX serial port (UART) from the PC.
   
ATmega/ATtiny, and in-fact most micros, cannot be programmed from their UART when they are brand new and contain no code.
So what people do, and this is what arduinos do, is flash a small program to the micro which accepts UART commands and reprograms itself!  This is whats called a 'boot loader'.

So, first you need to flash a bootloader to the micro using the proper programming pins
(MISO MOSI SCK RESET). Once the bootloader is working it will allow reprogramming over the usb serial port from then on.

NOTE: im not an arduino expert, so i dunno about its compatibility with the ATtiny 45/85
« Last Edit: September 01, 2012, 12:02:45 am by Psi »
Greek letter 'Psi' (not Pounds per Square Inch)
 

Offline NiHaoMike

  • Super Contributor
  • ***
  • Posts: 9008
  • Country: us
  • "Don't turn it on - Take it apart!"
    • Facebook Page
Re: ATtiny FTDI question
« Reply #2 on: September 01, 2012, 05:15:09 am »
There's a trick to bootload a blank Atmel using a serial port and a few resistors and diodes to drop the voltage.
Cryptocurrency has taught me to love math and at the same time be baffled by it.

Cryptocurrency lesson 0: Altcoins and Bitcoin are not the same thing.
 

Offline blackjamesTopic starter

  • Regular Contributor
  • *
  • Posts: 78
Re: ATtiny FTDI question
« Reply #3 on: September 01, 2012, 08:04:00 am »
i tried using an arduino board to program it, but i cant get it to work
 

Offline amyk

  • Super Contributor
  • ***
  • Posts: 8264
Re: ATtiny FTDI question
« Reply #4 on: September 01, 2012, 08:54:10 am »
There's a trick to bootload a blank Atmel using a serial port and a few resistors and diodes to drop the voltage.
Pretty standard direct serial/parallel programmer.

avrdude supports various configurations of these.

Note that the ATTiny series use a slightly different serial protocol from the ATMegas due to their low pin count.
 

Offline jeremy

  • Super Contributor
  • ***
  • Posts: 1079
  • Country: au
Re: ATtiny FTDI question
« Reply #5 on: September 09, 2012, 10:09:33 am »
You can program a tiny with an arduino: http://arduino.cc/en/Tutorial/ArduinoISP
 

Offline firewalker

  • Super Contributor
  • ***
  • Posts: 2450
  • Country: gr
Re: ATtiny FTDI question
« Reply #6 on: September 09, 2012, 12:17:34 pm »
FYI You can use an FTDI (FT232rl) chips in bit-bang mode to program an AVR chip via ISP.

http://tuxgraphics.org/electronics/200705/article07052.shtml

Quote
Since this programmer contains already a microcontroller we must find a way to initially program it. For this we need a programmer ... the thing that we are about to build...

A common solution is to sell microcontrollers with a pre-loaded boot loaded. The problem here is that those special microcontrollers are then specific to one vendor. They are not off the shelf microcontrollers.

For the usb interface we use a FT232rl chip. This chip has an interesting mode called "bit-bang" mode. I have written a source code library called ftdibb (only 2 files .c and .h, available from http://tuxgraphics.org/~guido/) which implements this bitbang mode on top of the libUSB library. LibUSB (http://libusb.sourceforge.net) uses the /proc file system to send and receive custom usb messages to any usb device on the usb bus. A slight drawback is that this requires root permissions under Linux it is a slow process as we will send very short messages. Initially (when there is no firmware on loaded in the microcontroller) we have absolutely no storage place and no logic in the programmer. We must send all the commands directly from the PC, bit by bit. USB is fast when you send long chunks of data but it is very slow when you send only 1 bit at a time.

This is however acceptable because:

    The initial firmware needs to be loaded only once.
    It saves us from having to get first a different programmer to load the initial firmware into this programmer
    There is no customer lock-in with special AVR chips. Any of the shelf atmega8/atmega88 will work.


In other words the avrusb500v2 consists really of two programmers: One slow internal for the initial loading of the firmware and the actual avrusb500v2 programmer which is a very fast and stk500 V2 based programmer for every day use.

I called the bitbang programmer for the initial loading "bbpg". I have modified the uisp programmer software for this purpose. You need to download uisp-20050207.tar.gz and then apply the uisp-20050207-usb-bbpg-patch.txt patch (cd uisp-20050207;patch -p1 < uisp-20050207-usb-bbpg-patch.txt ) or you can take the already patched sources (uisp-20050207-usb-bbpg.tar.gz, download at the end). Libusb needs to be installed before you compile the bbpg programmer. The avrusb500v2-X.Y.tar.gz package contains also a patched and pre-compiled binary. If you want to save some compile time then try this one first. You must name this version of uisp "uisp_bbpg". This is what the makefiles and scripts expect.

The CD which is sold from http://shop.tuxgraphics.org together with the parts for this programmer can also be used for the initial loading of the firmware. It has the additional advantage that you can do this from the CD without root permissions.

Alexander.
Become a realist, stay a dreamer.

 

Offline sirus20x6

  • Contributor
  • Posts: 11
Re: ATtiny FTDI question
« Reply #7 on: September 23, 2012, 02:13:32 am »
I like to use my buspirate to program avr chips. somewhere I made a post about it on dangerousprototypes forum in the buspirate section.
 

Offline iugamarian

  • Newbie
  • Posts: 3
  • Country: ro
Re: ATtiny FTDI question
« Reply #8 on: August 20, 2015, 08:02:31 pm »
For anyone interested here is a patched uisp_bbpg that allows ftdi communication by bit banging for programming avrusb500 and avrusb500v2:

https://github.com/iugamarian/uisp-bbpg

Works on many platforms - Raspberry Pi, 64 bit computers.
 

Offline bingo600

  • Super Contributor
  • ***
  • Posts: 1987
  • Country: dk
Re: ATtiny FTDI question
« Reply #9 on: August 20, 2015, 08:13:05 pm »
AFAIK

Avrdude actually supports "Bitbanging" via a FTDI adapter , and i mean (Not using the MPSSE)
Ohh it might only be for the older programming modes.


I'd seriously consider an usbasp (2$)
http://www.ebay.com/itm/201035834899


/Bingo
« Last Edit: August 20, 2015, 08:18:59 pm by bingo600 »
 

Offline iugamarian

  • Newbie
  • Posts: 3
  • Country: ro
Re: ATtiny FTDI question
« Reply #10 on: August 20, 2015, 08:20:33 pm »
Interesting, maybe in:

http://tuxgraphics.org/common/src2/article07052/avrusb500-upd.html

avrdude commands can be used in the makefile to program the programmer.

I do not like usbasp  - needs (old) driver and now that Windows 10 came up... and Linux changing...
« Last Edit: August 20, 2015, 08:25:41 pm by iugamarian »
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf