Keil Logo

ARM: Act on ULINK_IN (ULINKplus VTREG) changes

Information in this knowledgebase article applies to:

  • MDK 5.25 and later
  • ULINKplus


Can the debugger act on changes on the digital input pins of the ULINKplus debug adapter?


Yes. The ULINK_IN VTREG can be read in debug functions to control certain actions that are assigned to the digital input pins of the ULINKplus. In the following example the program execution gets stopped, when the signal on input pin 0 goes high.

To do this, add a function like StopOnUlinkIn() in a debugger ini file:

FUNC StopOnUlinkIn( void )
  while( 1 )
    if( ULINK_IN & ( 1 << 0 ) )
      _break_ = 1 ;
      break ;
  return( 0 )  ;

A Toolbox button can also be created to make the activation of the function more comfortable. So add also the following to the ini file:

DEFINE BUTTON "StopOnUlinkIn", "StopOnUlinkIn()"

After the debug session has started, click the button to start the function that monitors the ULINK_IN VTREG. When the bit 0 goes high, it stets the _break_ variable. This causes the debugger to stop the target execution. The function also returns then. To use it again, press the button again.

Some things need to be considered when using this approach:

  • The target is stopped asynchronously. That means, the target executes on for a while between the signal change and when it is actually halted.
  • Do not execute the function during the debug startup phase, because the loop inside the function will block the debugger startup.
  • If the function runs when the debug session ends, it needs to be stopped by pressing the ESC in the Command Window.
  • As the signal is only polled, too short pulses might not get detected.


Last Reviewed: Thursday, November 8, 2018

Did this article provide the answer you needed?
Not Sure
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.