What am I doing
I am developing large grids (up to 16 x 16) of controller (usually ATmega1284P) for automated test systems. All channel controller can be accessed via I²C interface by a central controller. Initially I am flashing a bootloader to each controller in the grid and firmware can then be uploaded via I²C interface. This is handled by the central controller.
The firmware for each Channel is identical but a specific I²C slave address has to be written to EEPROM. Otherwise they can not be addressed.
What I did so far
This is working very well. Let me explain the steps that I have taken so far:
In the first generation I flashed the bootloader for each grid controller using SPI manually. Programmed flash, fuse bits and EEPROM (I²C address) using a customized tool that using atprogram.exe in background. This is annoying, time-consuming and a cause of failure of course (skip channel, program two channels with same address etc.).
In the second generation I arranged columns of the grids as JTAG daisy chains and flashed them using atprogram.exe. It reduced the "reconnection-effort" by sqrt(row number). Much better, working fine but not yet what I would call elegant.
What I want to do
For more convenience and an easy-to-explain setup of a virgin system, I want the intial firmware handling still improved. What I am currently aiming at is that the master controller can access the JTAG daisy-chains using multiplexer and replace the programmer (currently: ATMEL-ICE). I have arranged the channels in columns of 8 or 16 - depending on controller type. Electronically the system is working already. Columns can still be flashed manually to stay compatible with existing systems.
Where I need your help
I have understood and can create firmware for a microcontroller which accesses another microcontroller's memories via JTAG. But can you help or explain me how I can implement JTAG access to a specific controller in a daisy-chain? The TAP control etc. meaning: accessing a single controller is described well in ATMEL datasheet. What I cannot properly wrap my mind around is the handling of a daisy chain. I know that TDI/TDO are shift-registers.
Basically I need simple example(s) of how to address specific controllers in a daisy-chain.
If JTAG daisy-chain access works, I do not need bootloader for the channels anymore and can flash the memories directly. Much faster than uploading firmware via I²C. Additionally I can use the other benefit of JTAG and run boundary-scan on-line to do electrical tests (in case of failure). Much more elegant in my opinion!
Thank you in advance