Manually toggle SIM pin in debugger

Topics for the Eclipse Environment
Post Reply
markadamdonkers
Posts: 8
Joined: Sat Sep 26, 2009 11:57 am

Manually toggle SIM pin in debugger

Post by markadamdonkers »

I am trying to validate my hardware interface to a MOD5270 board. How do I manually toggle a GPIO pin from within the debugger?
For example, I want to stop the debugger, place a scope on a GPIO pin, toggle it on, check the level, toggle it off, check the level.

Thanks,
Mark
Ridgeglider
Posts: 513
Joined: Sat Apr 26, 2008 7:14 am

Re: Manually toggle SIM pin in debugger

Post by Ridgeglider »

Not sure you can manually do it, but it would be easy to add code and a breakpoint prior to download. If you only want the code to run during debug sessions you could add some code like:

#ifdef _DEBUG
TogglePin();
#endif

if you don't always want it to run during debug, add a variable that you can set or clear before hand (possibly from within the debugger:

bool ToggleCodeShouldRun FALSE;

#ifndef _DEBUG
if (ToggleCodeShouldRun) {
TogglePin();
}
#endif

Finally, if you set a breakpoint just after the #ifdef, you'll be able to single step thru it.

The _DEBUG macro should already be defined. See the AppWizard-generated code for adding network debug:

#ifdef _DEBUG
InitializeNetworkGDB_and_Wait();
#endif
markadamdonkers
Posts: 8
Joined: Sat Sep 26, 2009 11:57 am

Re: Manually toggle SIM pin in debugger

Post by markadamdonkers »

Thanks for the reply. To verify my hardware, I did exactly as you mentioned. I created an infinite loop and toggled all the pins I wanted to verify... quick and dirty.

I was hoping for a method in the debugger to do this. Other IDE tools that I've used (e.g CodeWarrior) allows direct access to all processor peripheral registers, and even defines what the functions of each bitfield in the register. Very handy.

Hopefully, someone will reply with a way to do this.

Thanks again.
Ridgeglider
Posts: 513
Joined: Sat Apr 26, 2008 7:14 am

Re: Manually toggle SIM pin in debugger

Post by Ridgeglider »

At any breakpoint you could certainly write a new value to any of the gpio output data registers to set or clear a pin. I think this would be fine if the pin was previously congigured as gpio. If not, you'd probably have to configure it that way, set or clear as you desire, then reconfigure back to the original alternate function. If you are unfamiliar with the registers, see: http://www.netburner.com/downloads/mod5 ... ppNote.zip
Post Reply