| Author |
Message |
|
|
Posted: Feb 26, 2012 - 10:17 AM |
|

Joined: Aug 27, 2009
Posts: 42
|
|
Trying out ISP debug on tiny2313,
can't get it to work.
* Hi-current USB-host
* Good cable
* New Dragon
* ISP-freq 125kHz
* Internal RC
* CKDIV=true
* Target voltage, stabilized 5V
Original code wouldn't load (read other post about bug related to code-size), so tried with dummy:
Code:
.include "tn2313def.inc"
reset:
.org 0x0000
rjmp boot
.def temp=r16
.def temp2=r17
.def temp3=r18
.org 0x010
boot:
;wait 1 sec to stabilize HW
ldi temp3, 256 - 1 * (1000000 / 65536 / 3)
bootloop:
inc temp
brne bootloop
inc temp2
brne bootloop
inc temp3
brne bootloop
; ** SETUP STACK **
ldi temp2,low(RAMEND)
out SPL,temp2
loop:
rjmp loop
Ok to program chip.
Ok to entering debug-mode over SPI.
Launching emulation seems ok at first (no errors) - but on pause disassembler shows only FFFF as memory content.
* Why? Am I doing something wrong? Is chip broken? Is the dragon crappy?
* Also, it it required to burn the program before emulation?
regards,
/t |
|
|
| |
|
|
|
|
|
Posted: Feb 26, 2012 - 12:20 PM |
|


Joined: Jul 18, 2005
Posts: 62359
Location: (using avr-gcc in) Finchingfield, Essex, England
|
|
Just try ISP programming it then using ISP to read out the .hex then compare contents.
In fact even before you do that use ISP and see if you can read the chip signature - if you cannot you aren't in contact with the chip. |
_________________
|
| |
|
|
|
|
|
Posted: Feb 26, 2012 - 09:51 PM |
|

Joined: Aug 27, 2009
Posts: 42
|
|
Thanks for help,
Yes, all working fine over SPI,
can write, verify and read signature.
PGM written runs on device. |
|
|
| |
|
|
|
|
|
Posted: Feb 27, 2012 - 03:57 AM |
|


Joined: Mar 28, 2001
Posts: 20392
Location: Sydney, Australia (Gum trees, Koalas and Kangaroos, No Edelweiss)
|
|
There is NO such thing as SPI debugging, only debugWire (DW) debugging with the t2313.
Simply do a "Build and Run" and if all is well (ie no errors and DW already enabled) the code will be downloaded into the chip and the arrow will point to the first instruction to be executed.
Make sure that there is NOT a capacitor on the reset line, ISP will works but DW will NOT. A 10K pullup on the reset line would also be a good idea to have even though the docs say it is not needed. |
_________________ John Samperi
Ampertronics Pty. Ltd.
www.ampertronics.com.au
* Electronic Design * Custom Products * Contract Assembly
|
| |
|
|
|
|
|
Posted: Feb 27, 2012 - 07:45 AM |
|

Joined: Aug 27, 2009
Posts: 42
|
|
|
Quote:
There is NO such thing as SPI debugging, only debugWire (DW) debugging with the t2313.
Yes, correct. DW it is.
Quote:
Simply do a "Build and Run"...
The Studio believe all is well. Switches to DW-mode, no errors on upload, but still FFFF.
Quote:
Make sure that there is NOT a capacitor on the reset line...
Nothing but DW on reset. Tried with pullups, 8k2 and 16k4. No luck.
Suspecting broken ram on the Dragon. Possible to diagnose the lizard?
regards,
/t |
|
|
| |
|
|
|
|
|
Posted: Feb 27, 2012 - 08:17 AM |
|


Joined: Mar 28, 2001
Posts: 20392
Location: Sydney, Australia (Gum trees, Koalas and Kangaroos, No Edelweiss)
|
|
|
Quote:
but still FFFF.
To be sure there is only a few instructions there, the rest is FF,
just tried it in Simulator 2. I guess you are looking at the PROGRAM memory and not, say the EEPROM.
Do you get the yellow arrow at the begining of the program after the "build and run" and the code is downlaoded into the chip? |
_________________ John Samperi
Ampertronics Pty. Ltd.
www.ampertronics.com.au
* Electronic Design * Custom Products * Contract Assembly
|
| |
|
|
|
|
|
Posted: Feb 27, 2012 - 05:39 PM |
|

Joined: Aug 27, 2009
Posts: 42
|
|
Thanks for your involvment,
honestly, I've never got DW to work on any chip I've worked with so I may be doing something wrong. Three different dragons over the years so something may be wrong with my workflow.
To begin with: how is emulation suppose to work?
* I build and run and DW suceess.
* Before hitting "start debugging" i try to light up a led by manually set 1 to DDR/PORTB-pin. success.
* I bring up the disassembler window - all FF.
* When stepping program, no effect on any instructions, loops etc.
* And lastly, physically, where's the emulated program loaded? Onto the mega on the dragon?
Output from disaswin after build&run:
Code:
---- kasta.asm ------------------------------------------------------------------------------------
13: ldi temp,0x0f
+00000010: FFFF ??? Data or unknown opcode
14: out DDRB,temp
+00000011: FFFF ??? Data or unknown opcode
15: ldi temp,0x0f
+00000012: FFFF ??? Data or unknown opcode
16: out PORTB,temp
+00000013: FFFF ??? Data or unknown opcode
19: ldi temp3, 256 - 1 * (1000000 / 65536 / 3)
+00000014: FFFF ??? Data or unknown opcode
@00000015: bootloop
21: inc temp
regards,
/t |
|
|
| |
|
|
|
|
|
Posted: Feb 27, 2012 - 05:47 PM |
|

Joined: Aug 27, 2009
Posts: 42
|
|
Wait a minute,
Program AVR / connect / Program has an option I've never poked with:
( ) Use Current Simulator/Emulator FLASH memory.
( ) Input hex file: [....\avr\kasta\kasta.hex]
Should I change to upper? Is this related to emulation in any way?
Also, no capacitive load on reset;
there's a 100uF on VCC, the other side of the pullup. Is that a problem?
Additional details:
AVR Studio:4.19/730
Dragon FW: updated
AvrBuild.bat
@ECHO OFF
"C:\Program\Atmel\AVR Tools\AvrAssembler2\avrasm2.exe" -S "D:\mydocs\avr\kasta\labels.tmp" -fI -W+ie -C V2 -o "D:\mydocs\avr\kasta\kasta.hex" -d "D:\mydocs\avr\kasta\kasta.obj" -e "D:\mydocs\avr\kasta\kasta.eep" -m "D:\mydocs\avr\kasta\kasta.map" "D:\mydocs\avr\kasta\kasta.asm" |
|
|
| |
|
|
|
|
|
Posted: Feb 27, 2012 - 08:34 PM |
|


Joined: Mar 28, 2001
Posts: 20392
Location: Sydney, Australia (Gum trees, Koalas and Kangaroos, No Edelweiss)
|
|
|
Quote:
Before hitting "start debugging"
You don't need to do that when you do "build and run", you have ALREADY started a debug session, the RUN part.
Quote:
I bring up the disassembler window
WHY are you looking at the disassembler AT ALL?
Quote:
Program AVR / connect / Program has an option I've never poked with:
Why are messing around with the programming dialogue when you are DEBUGGING?
If you have selected the Dragon as the debug tool in your project then the code gets programmed AUTOMATICALLY into the CHIP.
There should be a video around showing you how to use the Dragon for debug, maybe you need to look at that.
So let's start from the beginning:
Connect the Dragon to your board, make sure the Dragon is already connected to the USB, power up your target.
Do a "build and run", if there are no bugs in the assembly then the code will be programmed AUTOMATICALLY into the CHIP.
You now get a yellow arrow pointing to the 1st instruction in your SOURCE file.
You can now do single step, or run the code from there. |
_________________ John Samperi
Ampertronics Pty. Ltd.
www.ampertronics.com.au
* Electronic Design * Custom Products * Contract Assembly
|
| |
|
|
|
|
|
Posted: Feb 28, 2012 - 08:41 AM |
|

Joined: Aug 27, 2009
Posts: 42
|
|
I'd sure wish...
Everything seems to build and run fine, no compile or communication error, yellow arrow. All is dandy.
But: Every instruction is ignored. I can manually tilt the i/o-pins in the right-side pane of AVR-studio, but all loops etc are just ignored.
Poking with the programming/run from flash did seem odd but a last attempt. I've watched youtube and simple it seems, hard it is...
I'll post a video on my application soon. Thanks.
//T |
|
|
| |
|
|
|
|
|
Posted: Feb 28, 2012 - 08:26 PM |
|


Joined: Mar 28, 2001
Posts: 20392
Location: Sydney, Australia (Gum trees, Koalas and Kangaroos, No Edelweiss)
|
|
|
Quote:
and run fine,
It should NOT run unless you tell it to run with F5.
Quote:
yellow arrow.
Can you post a screen shot of this?
Quote:
Every instruction is ignored.
Are you SURE that you have the Dragon selected as your debugger? It should show at the bottom of the screen if it is.
Are you using F11 for single step? |
_________________ John Samperi
Ampertronics Pty. Ltd.
www.ampertronics.com.au
* Electronic Design * Custom Products * Contract Assembly
|
| |
|
|
|
|
|
Posted: Feb 28, 2012 - 10:46 PM |
|

Joined: Aug 27, 2009
Posts: 42
|
|
Thanks,
Unfortunately I just smoked the dragon I belive.
Bad relations have a tendency to end...
To be sure, I'd be thankful if anyone could measure the ohm on the DRAGON ISP, between Ground and isp-reset (pin5). 10 ohms over here...
All cables (ISP & USB) detached.
regards,
/t |
|
|
| |
|
|
|
|
|
Posted: Feb 28, 2012 - 11:05 PM |
|


Joined: Mar 28, 2001
Posts: 20392
Location: Sydney, Australia (Gum trees, Koalas and Kangaroos, No Edelweiss)
|
|
|
Quote:
10 ohms over here...
Have you tried reversing the meter's probes? In one direction you WILL measure low resistance as you are turning on the internal protection diodes. |
_________________ John Samperi
Ampertronics Pty. Ltd.
www.ampertronics.com.au
* Electronic Design * Custom Products * Contract Assembly
|
| |
|
|
|
|
|
Posted: Feb 29, 2012 - 09:52 PM |
|

Joined: Aug 27, 2009
Posts: 42
|
|
Thanks, 10 ohms both ways - . Thankful for any confirmation if this is way out of mark.
regards,
/t |
|
|
| |
|
|
|
|
|
Posted: Feb 29, 2012 - 10:01 PM |
|


Joined: Mar 28, 2001
Posts: 20392
Location: Sydney, Australia (Gum trees, Koalas and Kangaroos, No Edelweiss)
|
|
| I read 10 ohms one way, high resistance the other way with an ANALOGUE meter. |
_________________ John Samperi
Ampertronics Pty. Ltd.
www.ampertronics.com.au
* Electronic Design * Custom Products * Contract Assembly
|
| |
|
|
|
|
|
Posted: Feb 29, 2012 - 10:19 PM |
|

Joined: Aug 27, 2009
Posts: 42
|
|
|
|
|
|
|