ARM Technical Support Knowledge Articles

SHARING SERIAL PORT WITH USER APPLICATION

Applies to: MON51 Target Monitor

Answer


Information in this article applies to:


QUESTION

I'm using MON51 and the uVision Debugger to download my program and debug it on my target system. Can my program share the serial port with the monitor?

ANSWER

Yes. However, there are a few limitations that you should consider.

  1. Your target program must not change the serial port configuration in any way. This means that your application must not change the settings of any serial port SFRs or any baudrate timer SFRs. If your program does change these registers, the monitor will lose communications with the PC. You can easily do this using a #ifndef directive.
    #ifndef MONITOR
    SCON  = 0x50;      /* SCON: mode 1, 8-bit UART, enable rcvr      */
    TMOD |= 0x20;      /* TMOD: timer 1, mode 2, 8-bit reload        */
    TH1   = 221;       /* TH1:  reload value for 1200 baud @ 16MHz   */
    TR1   = 1;         /* TR1:  timer 1 run                          */
    TI    = 1;         /* TI:   set TI to send first char of UART    */
    #endif
    

    You may wish to create a new target in your project for debugging with the monitor. In this target configuration, you can define MONITOR (in the compiler settings for all compiled modules) and monitor-specific code will be generated.

  2. The uVision Debugger supports a monitor-specific option named Stop Program Execution with Serial Interrupt. This option must be disabled (not checked) if your program uses the serial port. If this option is enabled, the monitor enables the serial port's interrupt and prevents your target program from transmitting characters.
  3. Received data may contain XON and XOFF characters (because of the protocol with the PC). You must filter these characters from the input stream.

All information that you transmit out the serial port will be received and displayed in the serial window in uVision.

SEE ALSO

Article last edited on: 2005-07-09 09:58:01

Rate this article

[Bad]
|
|
[Good]
Disagree? Move your mouse over the bar and click

Did you find this article helpful? Yes No

How can we improve this article?

Link to this article
Copyright © 2011 ARM Limited. All rights reserved. External (Open), Non-Confidential