No Debug step, walk and run buttons are disabled
I can’t seem to get the debug program to work the step, walk and run buttons are disabled. Also I received a key ring with my SX Tech Tool Kit Plus, I seem to remember a paper that came with it that I can not locate, explaining something about the programmable clock could you provide me with that paper? Dose the key ring require its own power in addition to the power that is attached to the SX Tech Board? Do I need to use the key ring to get the Debug to work? Where can I find an up-to-date example of using the debug?
Comments
You don’t need to use the Key Ring at all to program unless the device you’re programming runs at less than 5V. If that is the case and you do use it then yes, you do need a power supply connected to the Key Ring. Do you have a Crystal or Resonator installed in the circuit you’re trying to DEBUG? The DEBUG operation won’t work if you do. I hope this helps. Take care.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
;REVISIONS:
; 06/09/98 Original release.
; 09/17/04 Updated to support SASM.
;
;CONNECTIONS:
; None.
;
;DETAILS:
; Program the SX chip using the Run -> Debug (or CTRL+D) option. Then
; click the Step button to step through each instruction (taking note
; of the changes on screen) or use the Poll button to run full speed
; with updates to the display every loop iteration. The Watch window
; shows the values of registers IncReg, DecReg and NotReg in decimal.
; NOTE: You must disconnect any crystal or resonator from the SX chip
; in order to properly debug since the SX-Key will need to provide the
; clock signal.
;=======================================================================
;
DEVICE DIRECTIVES
DEVICE SX28,OSCHS2,TURBO
IFDEF __SASM ;SASM Directives
DEVICE STACKX,OPTIONX
IRC_CAL IRC_SLOW
ELSE ;Parallax Assember Directives
DEVICE STACKX_OPTIONX
ENDIF
RESET Main
;
VARIABLES
IncReg EQU 8 ;The register to increment
DecReg EQU 9 ;The register to decrement
NotReg EQU 10 ;The register to invert
;
DEBUG SETTINGS
FREQ 50_000_000
;Create watch window to display values of registers in unsigned decimal.
WATCH IncReg,8,UDEC
WATCH DecReg,8,UDEC
WATCH NotReg,8,UDEC
;
MAIN PROGRAM
Main
;Increment IncReg, decrement DecReg and invert NotReg in a loop.
inc IncReg ;Increment IncReg
dec DecReg ;Decrement DecReg
not NotReg ;Invert NotReg
break ;Break to update display
jmp Main ;loop
Isn't a PROGRAM Directive required?
PROGRAM Label {NOSTARTUP}
The PROGRAM directive sets the execution start point (at a label) for the SX/B program. Note that the PROGRAM directive must appear after the (optional) INTERRUPT hander, and in the first code page ($000 - $199).
When the NOSTARTUP option is used the SX/B compiler will not insert the normal start-up code that pre-initializes all RAM addresses to zero; in this case the programmer is responsible for appropriate initialization, except the FSR which is cleared (see BANK, below).
Note to Warner: RAM addresses are not cleared automatically so the values of your registers will be random when you start the program. And you might want to change your WATCH type for notReg to UBIN so that you can see the bits flip.
... that you are using the SX-Key and not the SX-Blitz
... that you don't have any clock source connected to the SX
... that have the latest IDE (v3.2.3) and have restarted it
I simply copied your program from the post and pasted it into the editor, save it, then ran it in Debug mode -- worked fine.
What steps are you taking to get into debug mode? Are you using the "program" option followed by "Debug again", or using the "Debug" option. The first won't work, and the second will. Folks are sometimes confused about the whole "program" versus" debug" versus "debug again" thing.
Thanks,
PeterM
What you should do is connect the SXKEY to another SX chip and see if it can first program the chip and then also go into DEBUG mode.
BTW, I'm new to this whole SX-Key thing. I can't figure out to to store and run a program after I disconnect the power from the SX-Key and chip. I'm learning about this whole process from the fine book, "Beginning Assembly for the SX Microcontroller." I can go through the examples just fine. However, I have to load and run the program from the program every time to run it. I can also ground the reset pin and that will restart the program. However, when I disconnect the power and then reconnect it, the program doesn't run again automatically on power on. Is there something I need to do? I don't have an external clock. I'm using the clock on the SX-Key.
If the SX is already programmed when you re-enter the SX IDE, try clicking on the clock icon (or Run | Clock from the menu) and setting the desired clock frequency. If you previously programmed the SX for DEBUG, click the black spider under a red circular arrow icon (Run | Debug (reenter) from the menu).
I hope this helps.
- Sparks
I think my basic problem was not specifying the internal oscillator and not having an external oscillator up. It doesn't seem like the oscillator in the SX-Key is providing cycles automatically on power reset. Though, I could be wrong.
For everyone else, I'm using the device directive OSC4MHZ and then IRC_CAL IRC_4MHZ to run off the internal clock.
I read through the FAQ and found this. If you're using a breadboard like me and not the SX Tech board, then it's easy to move some wires around, especially with the physical attachment and detachment of the SX Key. So, maybe you plugged the MCLR pin back in wronge on the OSC1 or OSC2. I'm thinking of buying the tech board or the PDB specifically to avoid the wiring coming out. Since I'm a novice, it's easy for me to suspect the code or the physical hardware itself. So far it has turned out to be my user error in every case.
The Debugger starts in running mode
Q: On my SX 28, when I choose Debug, the debug window comes up RUNNING and the options for Poll-
ing, Run, Stop etc. are gray and I cannot single-step through my program.
A: One reason might be that you have previously programmed the SX selecting “Run – Program” and
then selected “Run – Debug (reenter)”.
The reason is that there is a difference between “Program” and “Debug”. When you choose “Program”, the
only code sent to the SX is the code you wrote. When you select “Debug” instead, not only is your code
sent, but a little piece of special code is also appended. This additional code is required to enable the SX-
Key to properly control and communicate with the chip while debugging.
The option “Run – Debug (reenter)” is meant to continue a previous debugging session, assuming that no
changes have been made to the code in the meantime. Therefore, the code is not sent into the SX device
again, saving the time required to do this. The IDE expects that the required debugging code is available
in the chip, though. When this is not the case (because the chip was not programmed for debugging), the
debugger can’t communicate with, or control the chip. Therefore, it indicates “RUNNING” only, and does
not allow any other options.
Another reason for the debugger starting in running mode is that a resonator, crystal, or an external clock
source is connected to the OSC1 and OSC2 pins in parallel to the SX-Key. Although the chip can usually
be programmed in this configuration, debugging is not possible. Remove or disconnect the external
clocking device to allow for debugging.
Another cause for the debugger to display the “RUNNING” status is when the MCLR* pin is pulled low by
some reason. In this case, the SX is definitely not running but held in reset state. It seems as if the De-
bugger reports “RUNNING” whenever it cannot communicate with the SX.
Anyway, my main point is that you may want to check your power.