Atmega32u4 adc dc level problem

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

Dear Experts,

Hi,

 

For an ADC based project, I have to get ADC samples from multiple  ADC  channels of an atmega32u4 uC.

 

Channels ADC2,ADC3,ADC4 and ADC5  are multiplexed with TCK,TMI,TDO,TDI pins of uC.

 

I get valid samples from other channels but for this 4 channels I get samples with DC level on them.

 

Could you please tell me how I disable JTAG operation and make my ADC channels give me samples without DC level?

 

Best Regards

 

Mehrdad,

 

This topic has a solution.
Last Edited: Sun. Oct 25, 2015 - 02:16 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

mehrdad_58 wrote:

Could you please tell me how I disable JTAG operation

 

Look at Table 28-4 on page 348 of the ATmega32U4 Datasheet.

Bit 6 of the High Fuse Byte is JTAGEN (JTAG enable bit) which

comes from the factory as Programmed (set to 0) which enables JTAG.

Unprogram  JTAGEN (set to 1) to disable JTAG.

 

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

Thanks Chuck

But suppose I would like to do it by using avrdude command under linux.

Could you please tell me how?

 

I found something like this from other forums.

 

avrdude -U hfuse:w:0xD9:m

 

Do you approve it?

 

 

BR

Mehrdad,

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

I don't have a lot of experience with avrdude,

so hopefully someone else will jump in to help you.

 

How are you programming the ATmega32U4?

 

As I understand it, you need to use an external hardware programmer

to change the fuses.

 

 

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

It says (in the datasheet. Please forgive me) to disable jtag, write MCUCSR=0x80; twice.

 

Imagecraft compiler user

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

I use avr-gcc under linux and aspusb to program the board.

 

When I add MCUCSR=0x80; instruction , it does not compile.

 

It seems I need to add some #include files.

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

With GCC you usually need to add io.h as the first include file. From Studio file

 

#include <avr/io.h>

#include <ctype.h>
#include <stdint.h>
#include <stdio.h>

etc.

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

This reply has been marked as the solution. 
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks Experts,

 

By using avrdude command line option the problem totally removed and I could disable JTAG port of my atmega32u4 uC.

 

I mean this:

 

avrdude -U hfuse:w:0xD9:m