Author Topic: Adding 6-pin AVR (ATTiny85) ISP header to PCB  (Read 1034 times)

0 Members and 1 Guest are viewing this topic.

Offline amaningdTopic starter

  • Contributor
  • Posts: 14
  • Country: us
Adding 6-pin AVR (ATTiny85) ISP header to PCB
« on: October 16, 2024, 07:26:00 pm »
Hi all,

It's my first time using microcontrollers -- specifically an ATTiny85 -- in a PCB design. I've been asked to expose an ISP header for programming the ATTiny in circuit rather than place the chip in a DIP socket and remove it whenever it needs to be re-flashed.  I use Sparkfun's Pocket AVR programmer (hey, it's cheap and AVRDUDE tolerates it) which comes with a 6-pin cable I connect to the microcontroller's SPI pins:


In my design, I have some I2C peripherals and pull-up resistors connected to pins 5 and 7, the same pins used for MOSI and SCK by the programmer. I've seen that AVRDUDE has trouble communicating with the ATTiny if those I2C devices are also powered up. How can I incorporate the ISP header without powering those downstream devices? I'm guessing I can't just connect the ISP 5V pin to my PCB's 5V rail.
« Last Edit: October 16, 2024, 07:42:47 pm by amaningd »
 

Offline Doctorandus_P

  • Super Contributor
  • ***
  • Posts: 4010
  • Country: nl
Re: Adding 6-pin AVR (ATTiny85) ISP header to PCB
« Reply #1 on: October 16, 2024, 07:38:59 pm »
I also once thought of using 6 pin headers for programming AVR's but availability is a lot more cumbersome then the 10 pin variant, so I kept with the 10 pin connectors.

AVR's (at least the M8 and M328) are programmed while reset is pulled low, so you could make a circuit that disables the I2C lines for as long as reset is pulled low. A long time ago Atmel made an application note about switching MISO / MOSI / SCK between the application and the programmer with a CD4066 which was activated by the reset line.

Another option is to add some series resistors, so when the programmer (or the uC) puts hard signals on those lines, it "wins" over the I2C signals.
 
The following users thanked this post: neillnz

Offline dataescher

  • Newbie
  • Posts: 7
  • Country: us
    • Dataescher Home Page
Re: Adding 6-pin AVR (ATTiny85) ISP header to PCB
« Reply #2 on: October 17, 2024, 04:02:44 am »
I work designing ISP dongles for ISP programmers for commercial ICT fixtures. In many commercial products, you do need to take care that while you're programming one microcontroller, there is no possibility of turning on other microcontrollers in the circuit. It definitely doesn't help if you use the same reset node between multiple microcontrollers. Many of the products we deliver, we add relays to hold other chips in reset while we are programming one of the microcontrollers on the product. If the reset pins for all microcontrollers include a resistive pull-up resistor to VCC, so that you can safely tie the reset pin down for those microcontrollers to hold them in reset while you program other parts.

In general, after designing an ISP solution, you typically try to avoid any of the microcontrollers on the product from executing code, even the device you're programming. I've found that this could be pretty tricky at times, especially with PIC microcontrollers (PIC12LF1824, for instance) due to the high-voltage requirement for program mode entry and the fact that the reset pin is configurable as an input/output pin -- in which case, it's impossible to prevent those chips from turning on. In that case, you want a way to isolate the programming signals so activity on other chips does not interfere with your ISP operation.
« Last Edit: October 17, 2024, 04:05:02 am by dataescher »
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf