JTAG muxed ADC channels on AVR?

I'm using ATmega169P in an application and just came across a need for an additional two ADC channels (0-3 are in use). Unfortunately on this part, ADC4-7 are muxed with JTAG pins. I've had no luck getting the micro to read those channels

Is it necessary to disable the JTAG interface via fuse settings in order to use these upper ADCs? That's a real drag for me... means I have to dig out my AVR-ISP to program it over SPI, and I won't be able to do any further debugging :(

[Obviously I am not expecting to use the JTAG interface simultaneously with having those pins work as ADCs. I just don't want to lock off the JTAG just yet...]

thanks.

Reply to
larwe
Loading thread data ...

Yes, for sure. Or use external MUX off ADC0-3.

Reply to
linnix

Yes, you have to disable JTAG via fuses. That's typical problem with AVR JTAG pins.

Vladimir Vassilevsky DSP and Mixed Signal Design Consultant

formatting link

Reply to
Vladimir Vassilevsky

Bugger. That answer is concise, accurate, and a complete pain in my rump.

Thanks.

Reply to
larwe

hmmm, an idea. Have to decide if that is less trouble than reworking it. (It's a prototype only and it needs to be rebuilt from scratch anyway, but we were hoping to do a little more testing with the existing hardware before the next phase).

Reply to
larwe

You can switch to ISP over SPI.

Looks like your code is fairly complete, so you may not really need full JTAG debugging.

h
Reply to
hamilton

That's exactly what I'm going to do. It just makes everything a bit irksome because I can't see what the actual ADC values are. Oh, and having to find my AVR-ISP :)

Reply to
larwe

Hmm... reminds me of that joke about an answer that must have been given by a mathematician because it's so wonderfully short, extremely correct, .... and completely useless.

Reply to
Hans-Bernhard Bröker

n=20

,=20

Reminds me of that joke about an answer that must have been given by a=20 manager: somebody else's design problem from now on must become my=20 personal problem.

VLV

Reply to
Vladimir Vassilevsky

You can disable the JTAG interface under program control even if the fuses have it enabled. So depending on your application it may be appropriate to have JTAG disabled when needed by the program and enabled when you need it for programming/debugging.

kevin

Reply to
kevin93

Hmm, I'm not short, when correct extremely so, and completely useless (according to the wife)... and of course a mathematician by training. I take offense that mathematical answers can be the butt of jokes. Many modern theorems are extremely long. The are correct or not, so 'extremely' is superfluous. Further, the answer can't be useless if it is an answer to the question unless the question itself was set up that way.

:-) Peter

Reply to
Peter Dickerson

I didn't know that! Thanks for the info.

Reply to
larwe

You can disable the JTAG pins in software. Obviously you cannot then debug via JTAG from that point, but it means you can still use the JTAG pins fro programming the device.

Try this snippet I got off the web.

void disable_JTAG(void) { unsigned char sreg;

sreg = SREG; cli(); MCUCR |= ( 1

Reply to
Anton Erasmus

Yes, for the first time. If you have the software running with jtag disabled, you still have to erase/reprogram it with SPI.

Reply to
linnix

yep the 4 cycles is important, remember doing multiple variations of code and compiler setting before I gave up and wrote it in asm to make it work

-Lasse

Reply to
langwadt

Obviously, you can use the pin change interrupt on another pin to enable/disable the JTAG as needed. If the pin is also enables a buffer, you don't have to remove the JTAGICE Mk II.

--
Best Regards
Ulf Samuelsson
These are my own personal opinions, which may
or may not be shared by my employer Atmel Nordic AB
Reply to
Ulf Samuelsson

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.