Sunday 22 July 2012

Disabling JTAG on PrintrBoard

Disabling JTAG on PrintrBoard - Get 4 more I/O pins

As I discovered while getting the Panelolu working with a Printrboard the JTAG interface is enabled by default. This uses 4 pins on one of the expansion headers:


In order to get access to these pins the JTAG interface needs to be disabled: to do this you have to change the fuses on the AT90USB1286 micro. An ISP is required (I use the Pololu AVR ISP) but others should work fine.

Warning: You can "brick" your micro if you mess up the fuse settings: handle with care and I don't recommend you mess with the clock settings!

Lincomatic describes how to set the fuses in his blog post on uploading a bootloader to the AT90USB1286. He has the following settings

LOW : 0xDE
HIGH: 0x9B
EXT: 0xF0

Using the fuse calculator at engbedded.com, start by selecting the AT90USB1286 and then put the DE,9B and F0 setting in at the bottom of the page. After applying these settings it is simple to deselect the "JTAG Interface Enabled" check box and recalculate the settings. The only one which has changed is the HIGH setting to 0xDB

Using the version of avrdude that comes with arduino 0023 change the fuse setting to disable the JTAG interface:

avrdude -c avrispv2 -p at90usb1286 -U hfuse:w:0xdb:m  -C ..\etc\avrdude.conf -P com40

You will need to change the "-c avrisp2" to match your ISP and the "-P com40" to match the com port it's on.

Now that we have read-write access to those pins the connections for the Panelolu can use 1 less plug and stay on just one expansion header:


The pin allocations are:

With pin numbering of:
TDI = 42
TDO =43
TMS = 44
TCK = 45

The only change to the firmware from that described in my previous post is:

pins.h

      #define LCD_PINS_D4        42
      #define LCD_PINS_D5        43
      #define LCD_PINS_D6        44
      #define LCD_PINS_D7        45
 
So if you have an ISP and want 4 more IO pins this is the way to go. If you are going to buy a Printrboard then ensure you get your supplier to change the fuses to disable the JTAG interface before sending it to you.

6 comments:

  1. Would you advice to disable the divide by 8 fuse as well ?
    it makes the 16MHz xtal seems like an 2 MHz

    ReplyDelete
    Replies
    1. The low fuse setting Lincomatic has on his blog:
      http://blog.lincomatic.com/?p=548
      is 0xDE
      This has the divide by 8 de-selected which seams very sensible. I would be wary of changing this.

      Delete
    2. I just remember something about atmel writing in an old datasheet that this option was to give backwards support for old code on new faster controllers..
      Could be wrong.

      Delete
    3. I should say, that the fuse was all-ready set from printrbot, when I first connected my AVRISP mkII programmer

      Delete
    4. Ahh ok I did not know that. I got my Printrboard from a 3d party seller on ebay in europe. The bootloader sis not work so I re-wrote it all, fuses and bootloader so not sure what the original settings were. Its working fine with the settings described on lincomatic's blog (which has this divide by 8 disabled) at least with marlin firmware. Its also working fine with jtag disabled, once again with marlin.

      I am not a AT90USB 1286 or Printrboard expert so can onyl report on my own findings.

      Delete
    5. Okay :)
      But you helped me a lot ! I had all the pins correct, but didnt think of checking the fuses (JTAG !) before I came across this blog :D

      Delete

Comments are now moderated to reduce spam, please excuse the additional time this will entail.

Note: only a member of this blog may post a comment.