Programming by USBTinyISP with SPI device connected.

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

I have an Arduino project using an ATTiny841 and a DataFlash SPI flash memory chip.

I have found that the only way I can program the ATTiny841 by USBTinyISP is to remove 3.3V power from the Dataflash chip.

This is even if I pull the chip select pin low externally. When uploading I get the following output and error in Arduino IDE:

Sketch uses 1750 bytes (21%) of program storage space. Maximum is 8192 bytes.
Global variables use 175 bytes (34%) of dynamic memory, leaving 337 bytes for local variables. Maximum is 512 bytes.
C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avrdude -CC:\Users\Perigalacticon\AppData\Local\Arduino15\packages\ATTinyCore\hardware\avr\1.1.4/avrdude.conf -v -pattiny841 -cusbtiny -Uflash:w:C:\Users\PERIGA~1\AppData\Local\Temp\arduino_build_791780/test_attiny841_on__halloween_toy_pcb.ino.hex:i 

avrdude: Version 6.3, compiled on Jan 17 2017 at 12:00:53
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "C:\Users\Perigalacticon\AppData\Local\Arduino15\packages\ATTinyCore\hardware\avr\1.1.4/avrdude.conf"

         Using Port                    : usb
         Using Programmer              : usbtiny
         Setting bit clk period        : 5.0
avrdude: usbdev_open(): Found USBtinyISP, bus:device: bus-0:\\.\libusb0-0001--0x1781-0x0c9f
         AVR Part                      : ATtiny841
         Chip Erase delay              : 15000 us
         PAGEL                         : P00
         BS2                           : P00
         RESET disposition             : possible i/o
         RETRY pulse                   : SCK
         serial program mode           : yes
         parallel program mode         : yes
         Timeout                       : 200
         StabDelay                     : 100
         CmdexeDelay                   : 25
         SyncLoops                     : 32
         ByteDelay                     : 0
         PollIndex                     : 3
         PollValue                     : 0x53
         Memory Detail                 :

                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           eeprom        65     6     4    0 no        512    4      0  4000  4500 0xff 0xff
           flash         65    12    32    0 yes      8192   16    512  4500  4500 0xff 0xff
           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00
           lock           0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           lfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           hfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           efuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00

         Programmer Type : USBtiny
         Description     : USBtiny simple USB programmer, http://www.ladyada.net/make/usbtinyisp/
avrdude: programmer operation not supported

avrdude: Setting SCK period to 5 usec
avrdude: initialization failed, rc=-1
         Double check connections and try again, or use -F to override
         this check.

An error occurred while uploading the sketch
avrdude done.  Thank you.

 

Should I be able to program the ATTiny841 by USBTinyISP with the Dataflash powered on?

 

 

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

I programmed the ATTiny841 with the dataflash connected to it when I put the parts on a breadboard by soic to dip adapters without errors.

 

However when mounted on the PCB, the ATTiny841 will not program, even if powered separately.  I believe now there is a problem with the circuit board.  If anyone has any experience with a similar problem I'd appreciate any advice or suggestions.

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

It looks as if you can buy USBTINYISP from Ebay for £1.59 to £26.50. None have a 3.3V option.
You can buy a Chinese USBASP for £1.23. Comes with jumper for 3.3V or 5V. Others have a solder-bridge.
.
Dataflash chips are all 3.3V. Why would you want to destroy it with a 5V programmer?
Why would anyone want to use USBTINY ?
.
Yes, you can remove the SMD Dataflash and then program the tiny841 with 5V. Then resolder the SMD.
Or program a bootloader into the tiny841 before resoldering the Dataflash.
.
David.

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

Dataflash has 3.3 Vcc but the data pins are 5V.

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

Not as far as I know. I am on a Tablet.
I will check on a PC when my tea has brewed.
.
David.

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

It's an AT45DB161D.  Note #2 on datasheet page 33 :  2. "All inputs are 5 volts tolerant."  And I've used it with 5V it works fine.  Thanks for your suggestion.  I think it's a PCB design issue, still checking it.

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

I got it to work on a new PCB I assembled.  I don't know what the problem is yet, but the new board (from new parts) works correctly.  As I have been doing some rework I've found the solder mask is coming off a little bit in some places so it could be that.  Thanks again.

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

 

My apologies.  The pins are voltage tolerant.   From Table 18-1 in my AT45DB321D datasheet:

 

All Input Voltages (except VCC but including NC pins)
with Respect to Ground ...................................-0.6V to +6.25V
All Output Voltages
with Respect to Ground .............................-0.6V to VCC + 0.6V

and

Table 18-2. DC and AC Operating Range
AT45DB321D (2.5V Version) AT45DB321D
Operating Temperature (Case) -40°C to 85°C -40° C to 85°C
VCC Power Supply 2.5V to 3.6V 2.7V to 3.6V

I have always kept to 3.3V GPIO whenever I used Dataflash.   It looks like I have been over-cautious.

 

So if your AT45 VCC is powered at 3.3V you should be fine.    I would never disconnect the VCC pin.   That will definitely be unwise.

If the /CS pin is inactive,   the AT45 should not interfere with any other devices on the SPI bus e.g. ISP. 

Just use an external pullup resistor on /CS.

 

I can never understand why Atmel publish different operating speeds for modern chips.

Other manufacturers specify maximum clock @ 3.3V with no "extra high max clock" for 5V

Obviously they derate the speeds for 1.8V operation.

 

3.3V operation will always have a lower power consumption than 5V.

20 year old AVR designs had lower clock speeds and inflexible voltage ratings.

 

I bet that modern design and fabrication methods can guarantee full speed at 3.3V

If punters saw the same speed rating for 3.3V as 5V operation,   they would never want to use 5V.

Yes,   input voltage tolerance is an attractive design feature.

 

David.

Last Edited: Sun. Oct 29, 2017 - 08:15 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Actually it's programming but with an error and then not running correctly.

avrdude: writing flash (1750 bytes):

Writing | ################################################## | 100% 2.75s

avrdude: 1750 bytes of flash written
avrdude: verifying flash memory against C:\Users\PERIGA~1\AppData\Local\Temp\arduino_build_223537/test_attiny841_on__halloween_toy_pcb.ino.hex:
avrdude: load data flash data from input file C:\Users\PERIGA~1\AppData\Local\Temp\arduino_build_223537/test_attiny841_on__halloween_toy_pcb.ino.hex:
avrdude: input file C:\Users\PERIGA~1\AppData\Local\Temp\arduino_build_223537/test_attiny841_on__halloween_toy_pcb.ino.hex contains 1750 bytes
avrdude: reading on-chip flash data:

Reading | #################################################An error occurred while uploading the sketch
# | 100% 13.23s

avrdude: verifying ...
avrdude: verification error, first mismatch at byte 0x008a
         0x24 != 0x26
avrdude: verification error; content mismatch

avrdude done.  Thank you.

Is just a sketch that prints "test" every .5 seconds but it's printing about 7 question marks ever 2 seconds.  Baud rate is set correctly.  Connections are correct.  Replaced a few components... time for another board.

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

Have you tried a pull-up on the DataFlash chip select line to ensure it is inactive while the AVR is held in reset during programming? 

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

Thanks Clawson.  I figured out I forgot to "burn the bootloader" which I think sets some fuses and clock speed.

 

Now it works as expected.  not to bad for going on 20 hours w/o sleep eh?