I'm currently working on a project that involves multiple Atmega devices. I'm planning to leave ISP headers on the board, but I don't want to leave 1 set of ISP headers for each chip (I'll have 4-5 of such chips). But instead, I'm thinking of cleverly placing jumpers and headers as to "select" the device being programmed. This way I get to use only 1 set of ISP headers.
My question is which ISP line can I select for muxing. ISP lines consist of the following
VDD GND SCK MISO MOSI Reset
My guess would be if I disconnect SCK line for the 4 devices that I'm not programming, but connect this line user a jumper for the device that I am programming, then I end up with programming this 1 target device. Is this a feasible idea?
-
\$\begingroup\$ This sounds like an application for JTAG. Are all of the MCUs JTAGable? \$\endgroup\$Ignacio Vazquez-Abrams– Ignacio Vazquez-Abrams2015年01月14日 21:23:52 +00:00Commented Jan 14, 2015 at 21:23
1 Answer 1
Ideally you would MUX the whole lot, but i understand if this is not feasible.
I think you are right to use the SCK line, but make sure that the disconnected lines are not floating. Crosstalk on a floating line could cause problems.
The Atmega chips program when reset is LOW. When in Reset, the chip is listening for programming instructions on the SPI port.
Here is how I would tackle it:
- Pull all reset lines low together (so the non-target micros dont drive the MOSI line)
- Add pull up/down to each SCK line at the chip (check polarity)
- MUX the SCK line
- Leave all other lines connected
- Use 100Ohm resistors in all lines
The risk here is that the chip in reset will drive the MOSI line, but i dont think it will. Check this first.
-
\$\begingroup\$ These steps might just work. Your point about MOSI possibly being active when other chips are not held in reset is something that I didn't think about. Can you explain why SCK needs to be pulled and why 100Ohms needs to be there? I've programmed Atmega without needing these resisters. \$\endgroup\$user1906583– user19065832015年01月14日 23:15:57 +00:00Commented Jan 14, 2015 at 23:15
-
\$\begingroup\$ Sure. If SCK is floating, it could be pushed around due to crosstalk from the MISO line. This could cause unwanted programming of one of the micros which you are not programming. (its unlikely, but much easier to remedy at this point) \$\endgroup\$Joel– Joel2015年01月15日 01:24:18 +00:00Commented Jan 15, 2015 at 1:24
-
\$\begingroup\$ The 100Ohms are just there in case one micro sets the MOSI pin high, and another sets it low during normal (or abnormal) operation. If the pins are short together then one misbehaving micro could reset (or kill) another micro. In a word: Protection \$\endgroup\$Joel– Joel2015年01月15日 01:27:41 +00:00Commented Jan 15, 2015 at 1:27