SPI programming with an FTDI cable?

Discussion in 'Embedded Systems and Microcontrollers' started by Druzyek, Jan 19, 2014.

  1. Druzyek

    Thread Starter New Member

    May 19, 2013
    21
    0
    I would like to program an AT89LP6440. It has an SPI interface described here: http://www.atmel.com/Images/doc3593.pdf Is it possible to program the chip with only an FTDI cable?

    Someone recommended I look into avrdude but I have not found support. It seems that it might be possible with a different driver since the cable has 4 data lines which is what SPI needs.

    If it is the simple matter of converting the data sent out over the FTDI cable into SPI with clock signals, I can do this easily with a microcontroller. Building anything more complicated than that might be beyond my abilities.
     
  2. takao21203

    Distinguished Member

    Apr 28, 2012
    3,577
    463
    Google it.

    Get an Atmel device programmer.
     
  3. Druzyek

    Thread Starter New Member

    May 19, 2013
    21
    0
    Care to add something more helpful? No amount of googling has turned anything useful up. I posted hoping to use the hardware I have instead of buying a programmer.
     
  4. takao21203

    Distinguished Member

    Apr 28, 2012
    3,577
    463
    Normally an USBASP Flash writer is used for Atmel chips.

    Arduino also can be loaded with a firmware to flash other Atmel chips. I don't know which particular chips are supported.

    For this USBASP Flash writer, you get a list of supported devices:
    http://www.ebay.com/itm/USBASP-USB-...-S52-For-MEGA-TINY-CAN-Series-2-/180830002684

    2. I googled FTDI cable programming for you and I found this:

    http://learn.adafruit.com/ftdi-friend/ftdi-friend-vs-avr-programmer

    Basically, your question is answered, as the difference between FLASH writer and FTDI cable is explained.
     
  5. Druzyek

    Thread Starter New Member

    May 19, 2013
    21
    0
    takao21203, You don't seem to understand what I am asking. I have an FTDI cable and I know what it is. I know a programmer is usually used to program this kind of chip but I don't want to buy one. I'd like to use the FTDI cable I already have.

    Is it as simple as converting the data that goes out over UART into SPI with a microcontroller?
     
  6. takao21203

    Distinguished Member

    Apr 28, 2012
    3,577
    463
    maybe not but I think I do understand it somehow. I clicked one link on the page I linked, and it describes programming a blank chip with an FTDI cable

    http://learn.adafruit.com/ftdi-friend/programming-blank-avrs

    Isn't that what you want to do? From the webpage, it seems to be possible. Maybe I did not give a good answer on the first try, but since the intention to help is there, maybe we are moving towards a solution.

    edit: One reason why you need a microcontroller is the USB framework. It is as slow as 1mSec to toggle control lines. But these are used by serial programmer softwares. If you still want to go further and really use a USB to RS232 chip, the programming process will be very slow.

    With a microcontroller, given you know the protocol, you can program any other microcontroller.
     
    Last edited: Jan 19, 2014
  7. Druzyek

    Thread Starter New Member

    May 19, 2013
    21
    0
    Those chips are AVRs. The chip I have is an 8051, which is completely different. I don't think this will work. Thanks for trying.
     
  8. takao21203

    Distinguished Member

    Apr 28, 2012
    3,577
    463
    Have you compared the programming spec with one of the AVR chips?

    The only problem might be to support it in the software. If you have the source code, you'd need to understand it + make changes.

    When you have a particular reason to use 8051, you already know it's not compatible?

    The effort to code a programmer is mostly not worth it- with experiece it takes you 1 to 3 days, even much longer if you don't have much experience.

    It would be helpful to take a photo from the hardware you have or at least to list it.

    GAL programmers also can flash some 8051 controllers.

    Most people these days buy an evalution board for the controller in question, or a programmer module.

    If you want to adapt an avrdude somehow or build your own programmer, be prepared this takes a lot of effort.

    I don't see a reason why not if you can get the source code which is flashing the firmware with the avrdude into a controller.

    It might be it needs further work to use the hex files for 8051.
    http://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&t=132316

    And with just an USB to serial cable it will take minutes to flash a chip.
     
  9. Druzyek

    Thread Starter New Member

    May 19, 2013
    21
    0
    No, I don't have an AVR programmer so I don't think that would help me.

    The source for the programming software? That is made by Atmel so I do not have the source.

    If the programmer only has to convert bytes from serial into bytes for SPI it should not be hard. What do do Atmel programmers usually do? If the PC sends configuration information to the programmer and the programmer generates anything from there it will be hard.

    I see that now. I don't think using avrdude with just the cable is a good idea.
     
  10. takao21203

    Distinguished Member

    Apr 28, 2012
    3,577
    463
    Well I actually have a GAL programmer. It can program a lot of chips.

    What you need to do is to implement the specification from the 8051 controller manual into a flow char and then into a C source code.

    You have the RS232 signals on one side, and the SPI interface on the other side, and the firmware on the microcontroller inbetween.

    To buy a FLASH writer for the 8051 chip would be the least effort but if you want, program the firmware for a FLASH writer yourself.

    It is not difficult just for one chip, but in order to support an array of controllers, it would take some effort.

    It is certainly doable. Also on the PC side you have a hex file, and somehow you need to convert it into a serial data stream. So you need a small application to do this. Visual Studio is good for this. Since VC2008 you have a class for the serial port, i think it is some kind of stream object in the end. I used it once some years ago.
     
  11. tshuck

    Well-Known Member

    Oct 18, 2012
    3,531
    675
    It looks like this should be possible.

    This may be useful...
     
  12. Druzyek

    Thread Starter New Member

    May 19, 2013
    21
    0
    tshuck, thanks for the link. I ended up bitbanging the data over serial. It works pretty well but it is slow. Here is the source for anyone else who wants to program an AT89LP6440 with an FTDI cable: https://github.com/druzyek/AT89Loader/
     
  13. atferrari

    AAC Fanatic!

    Jan 6, 2004
    2,648
    764

    What is slow in this context, Druzyek?
     
  14. Druzyek

    Thread Starter New Member

    May 19, 2013
    21
    0
    I can program about 100 bytes of firmware per second. This is probably due to the USB interface. As I understand it, the USB standard sends packets of 64 bytes of information. A whole packet is probably wasted when each pin is toggled or read. The problem is that the MISO pin of the chip has to be read every clock transition. Hmm, ignoring the input while writing would surely speed things up. I could also try the SPI library tshuck linked to. I was going off this instead: http://hackaday.com/2009/09/22/introduction-to-ftdi-bitbang-mode/
     
  15. atferrari

    AAC Fanatic!

    Jan 6, 2004
    2,648
    764
    I see. Slow for sure.
     
Loading...