How to disable JTAG interface on ATMEGA1280

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

I'm programming an ATMEGA1280 on a custom PCB via an Arduino Mega 2560 as ISP.

How can I disabled the JTAG interface? I know it's the JTAGEN bit that needs to be set to 1 but I don't know how to do it via the arduino IDE.

 

Thanks for your help!

This topic has a solution.
Last Edited: Wed. Oct 3, 2018 - 06:27 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

How is Arduino programming it? If by bootloader you can't change the fuses. Look at doing the double write to JTD

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

The ArduinoMega2560 is set as ISP and is wired through the ICSP  (MISO,MOSI, ect) to  the atmega1280.

How do I write to the JTD?

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

Do that in software when you write the code,add the following code in setup()

Edit: corrected reg name and remove the RMW

 

MCUCR = (1<<JTD);
MCUCR = (1<<JTD);

Click Link: Get Free Stock: Retire early!

share.robinhood.com/jamesc3274

 

 

 

Last Edited: Wed. Oct 3, 2018 - 06:12 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Do I need to include a library? Because I get : 'MCUCSR' was not declared in this scope

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

Don't use ¦=, it forces an RMW which might jeopardize the 4 cycle requirement

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

Dominic3231 wrote:

Do I need to include a library? Because I get : 'MCUCSR' was not declared in this scope

What does the datasheet say about how to disable JTAG programmatically?

 

Which register has that bit on that model?

 

Many (most?) questions posted here are answered with a datasheet excerpt.

 

 

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

Last Edited: Wed. Oct 3, 2018 - 05:52 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

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

Could you tell me how to set the register please? MCUCSR is not recognized

 

Thank you for explicit answers since i'm new to the programming world :)

Last Edited: Wed. Oct 3, 2018 - 06:14 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Dominic3231 wrote:
Could you tell me how to set the register please?

See post #4, code corrected for M1280

Click Link: Get Free Stock: Retire early!

share.robinhood.com/jamesc3274

 

 

 

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

Dominic3231 wrote:
Could you tell me how to set the register please? MCUCSR is not recognized
theusch wrote:
What does the datasheet say about how to disable JTAG programmatically? Which register has that bit on that model?

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

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

I guess the green means you worked it out but just to be clear...

 

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

If you're programming a custom PCB using ISP programming, you should learn to use AVRDude or one of the equivalents to set the fuses, externally of the Arduino IDE.

 

The IDE will disable JTAG with the "Burn Bootloader" command, but it will also set the fuses causing the chip to boot into the booloader section.