Breakpoints issues using JTAG debugger under AS7

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

Dear all,

 

A piece of code has been tested successfully on a STK600 equipped with the atmega2560 board provided with this kit.

 

  • The program was both downloaded to the STK600's mcu and debugged using a JTAG debugger (AVR One).
  • The clock settings of the STK600 were programmed to operate the mcu at 16MHz using the on-board oscillator.
  • During this phase, it was possible to stop the execution everywhere in the program as expected with the JTAG debugger.

 

Now, a small prototype board has been equipped with an atmega16AU running at 16MHz.

  • Its JTAG port (PF4-7), which  is only dedicated to the debugger, is directly connected to a 10-pin header according to the Atmel's standard pinout.
  • The same code is downloaded to this target with the same project settings (device, optimization etc) using the same  AVR One.

 

If the program runs as before, the debugger however can not stop now the execution as before,  for some breakpoints located in interruptions for instance or elsewhere where the code should be less sensitive to optimizations.

 

Many tests have been carried out without any success :

  • Checked hardware;
  • Replaced Avr One with Avr Dragon;
  • "Clean/rebuild solution";
  • Deleting all AS7 files;
  • Removed all breakpoints;
  • Changed optimizations of compiler;
  • Created a new project in a new directory...

 

At this point any suggestions to restore my breakpoints are welcome.

 

Thanks a lot.

 

 

### Configuration ###

- Windows 10 Pro version1909 18363.628

- Atmel Studio 7 Version: 7.0.2397 -

 

 

This topic has a solution.

GGB

Last Edited: Tue. Feb 11, 2020 - 08:37 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ggb wrote:

Now, a small prototype board has been equipped with an atmega16AU running at 16MHz.

  • Its JTAG port (PF4-7), which  is only dedicated to the debugger, is directly connected to a 10-pin header according to the Atmel's standard pinout.

Welcome to AVRFreaks!

 

Can you confirm / clarify what AVR you are actually using, as an M16 does not have a port F???

the Jtag port on an M16 is PORTC.

Also post your fuse settings as jtag can be disabled by the fuses.

 

Jim

 

Click Link: Get Free Stock: Retire early! PM for strategy

share.robinhood.com/jamesc3274
get $5 free gold/silver https://www.onegold.com/join/713...

 

 

 

 

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

Thank you Jim for your reply

 

Can you confirm / clarify what AVR you are actually using, as an M16 does not have a port F???

I am using the mega2560AU 100-pin which has its jtag pins on PORTF.

 

Also post your fuse settings as jtag can be disabled by the fuses.

The "jtag programming" is effective since the program can be downloaded to the mcu through this port.

 

BODLEVEL = DISABLED
OCDEN = [X]
JTAGEN = [X]
SPIEN = [X]
WDTON = [ ]
EESAVE = [X]
BOOTSZ = 4096W_1F000
BOOTRST = [ ]
CKDIV8 = [ ]
CKOUT = [ ]
SUT_CKSEL = EXTXOSC_8MHZ_XX_16KCK_65MS

EXTENDED = 0xFF (valid)
HIGH = 0x11 (valid)
LOW = 0xFF (valid)

 

 

 

GGB

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

Thank you Jim for your reply

 

Can you confirm / clarify what AVR you are actually using, as an M16 does not have a port F???

I am using the mega2560AU 100-pin which has its jtag pins on PORTF.

 

Also post your fuse settings as jtag can be disabled by the fuses.

The "jtag programming" is effective since the program can be downloaded to the mcu through this port.

 

BODLEVEL = DISABLED
OCDEN = [X]
JTAGEN = [X]
SPIEN = [X]
WDTON = [ ]
EESAVE = [X]
BOOTSZ = 4096W_1F000
BOOTRST = [ ]
CKDIV8 = [ ]
CKOUT = [ ]
SUT_CKSEL = EXTXOSC_8MHZ_XX_16KCK_65MS

EXTENDED = 0xFF (valid)
HIGH = 0x11 (valid)
LOW = 0xFF (valid)

 

 

 

GGB

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

 

ggb wrote:
A piece of code has been tested successfully on a STK600 equipped with the atmega2560 board provided with this kit.

Ok so this worked!

ggb wrote:
Now, a small prototype board has been equipped with an atmega16AU running at 16MHz.

This does not!

ggb wrote:
I am using the mega2560AU 100-pin which has its jtag pins on PORTF.

So the second line above was added to confuse the Freaks?  And now the first line above is not true? 

 

I'm lost, please restate the issue, tell what you did, tell what you expected to happen, tell what is happening.

And with which of the two configurations above this applies too.

 

Jim

 

 

Click Link: Get Free Stock: Retire early! PM for strategy

share.robinhood.com/jamesc3274
get $5 free gold/silver https://www.onegold.com/join/713...

 

 

 

 

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

ggb wrote:

Now, a small prototype board has been equipped with an atmega16AU running at 16MHz.

 

This does not!

 

ggb wrote:

I am using the mega2560AU 100-pin which has its jtag pins on PORTF.

 

So the second line above was added to confuse the Freaks?  And now the first line above is not true? 

 

I am sorry ! Of course, the mcu used is the * ATmega2560-16AU 100-pin *, the rest of the message holds true.

 

GGB.

 

GGB

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

Ok, generally Jtag debugging is very easy, just hit the debug and break button, program loads and stops at main().

I've not used an AVR one debugger, but have used the dragon many times.  Does it stop at main()?

 

Break points are added by clicking on line(s) where BP are wanted, and click continue button (not run button)

Can you add a BP in main() and break there?

 

Jim

edit: can you single step, or run to cursor and stop?

 

 

 

Click Link: Get Free Stock: Retire early! PM for strategy

share.robinhood.com/jamesc3274
get $5 free gold/silver https://www.onegold.com/join/713...

 

 

 

 

Last Edited: Mon. Feb 10, 2020 - 07:51 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Ok, generally Jtag debugging is very easy, just hit the debug and break button, program loads and stops at main().

I've not used an AVR one debugger, but have used the dragon many times.  Does it stop at main()?

The behavior is the same whatever the debugger Dragon/One. Two type of breakpoints are never hit depending of their locations :

 

  • Breakpoints can be added everywhere in the code but those in the interrupts (pin change or rxd) never stop the execution.
  • Breakpoints in the command-line interface functions (parser etc) can not stop the program.
  • The effective execution of these functions (command-line or interrupts) are traced using a terminal.

 

Can you add a BP in main() and break there?

 

edit: can you single step, or run to cursor and stop?

Only BPs in main seem to be able to break the execution, all stepping commands work for these BPs.

 

I guess the problem comes from the device's settings since exactly the same debugging session works fine with the mega2560 mounted on the STK600.

 

GGB

 

GGB

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

Perhaps those with more experience with AS7 will have more ideas.

You say BP's work on the stk600 but not on your custom board, is there any circuity on the jtag pins of the custom board, that is not on the stk600?

Any functions using any pins of PORTF in the program? 

Jim

 

Click Link: Get Free Stock: Retire early! PM for strategy

share.robinhood.com/jamesc3274
get $5 free gold/silver https://www.onegold.com/join/713...

 

 

 

 

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

Is the breakpoint you set marked as 'will never be hit' , or do you never break on it?
.
Can you halt the program and see that it is actually running (has been running)?
.

:: Morten

 

(yes, I work for Atmel, yes, I do this in my spare time, now stop sending PMs)

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

You say BP's work on the stk600 but not on your custom board, is there any circuity on the jtag pins of the custom board, that is not on the stk600?

On the custom board, there is no devices on the jtag port, the lines are directly routed to the 10-pin header, with same pinout as the STK600. Unfortunately,  the STK600's circuitry is no available to see any differences.

 

Any functions using any pins of PORTF in the program? 

No, Jtag pins are dedicated for this purpose, while the four remaining pins of this port are used by the ADC.

 

GGB

GGB

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

Atmel-8154-8-bit-ATmega16A_Datasheet

[page 214]

[JTAG : TMS, TCK, TDI, TDO]

The IEEE std. 1149.1 also specifies an optional TAP signal; TRST – Test ReSeT – which is not provided.

When the JTAGEN fuse is unprogrammed, these four TAP pins are normal port pins and the TAP controller is in reset. When programmed and the JTD bit in MCUCSR is cleared, the TAP input signals are internally pulled high and the JTAG is enabled for Boundary-scan and programming. In this case, the TAP output pin (TDO) is left floating in states where the JTAG TAP controller is not shifting data, and must therefore be connected to a pull-up resistor or other hardware having pull-ups (for instance the TDI-input of the next device in the scan chain). The device is shipped with this fuse programmed.

For the On-chip Debug system, in addition to the JTAG interface pins, the RESET pin is monitored by the debugger to be able to detect external reset sources. The debugger can also pull the RESET pin low to reset the whole system, assuming only open collectors on the reset line are used in the application.

...

via ATmega16A - 8-bit AVR Microcontrollers 

JTAG | AVR ONE!

 

"Dare to be naïve." - Buckminster Fuller

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

Is the breakpoint you set marked as 'will never be hit' , or do you never break on it?

Never break on it.

 

But things have changed since the last message : I can debug the session and break on interrupts or any other functions.

 

Despite this great news, it is a bit confusing since * I have no modified anything * , just shutdown power as I did many times during the tests before.

Can you halt the program and see that it is actually running (has been running)?

Now, when the program is manually halted, the  cursor is randomly located in front of a line in the source code, as expected.

 

But few minutes ago before this "automatic repair", when the execution was paused, the display wasn't one I used before, it looked like memory or assembler contents with weird indications like "memory out-of-" something, unfortunately I haven't any copy of this screen.

GGB

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

What is your compiler optimization level?  For debug it should be set to -Og or something like that.

Your seeing disassembler output as it has lost the C code for this segment.  Or has lost which *.c file this point relates too.

 

Click Link: Get Free Stock: Retire early! PM for strategy

share.robinhood.com/jamesc3274
get $5 free gold/silver https://www.onegold.com/join/713...

 

 

 

 

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

Thank you for this information but I am not sure about what are you trying to show me. You are reporting a pull-up requirement on the TDO pin, but this point seems not apply for atmega2560 since, at my knowledge, its datasheet doesn't mentioned such requirement (p.290-291). Anyway, the JTAG operates because it can program (write) and verify (read) the code, doesn't it ?

GGB

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

You too were confused by the OP statement about using an M16, he is not!

Jim

 

Click Link: Get Free Stock: Retire early! PM for strategy

share.robinhood.com/jamesc3274
get $5 free gold/silver https://www.onegold.com/join/713...

 

 

 

 

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

the reset signal may be necessary

 

"Dare to be naïve." - Buckminster Fuller

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

Dear all,

Thank you for the feedback. The debugger is running now even if I don't know why. So it's time for me to close this discussion.

GGB

GGB