Skip to main content
Visitor II
April 23, 2008
Question

UART0 (COM1) modem interface

  • April 23, 2008
  • 1 reply
  • 579 views
Posted on April 23, 2008 at 03:59

UART0 (COM1) modem interface

    This topic has been closed for replies.

    1 reply

    hichamAuthor
    Visitor II
    May 17, 2011
    Posted on May 17, 2011 at 09:52

    Hi everyone,

    The reference manual clearly states on page 253 that UART0 provides a full modem interface. I can clearly see the transmitted data on the oscilloscope on both RX (COM1 Pin 3) and TX (COM1 Pin 2) as well as in their corresponding GPIO pins 3.0 and 3.1. Other than that, I cannot get any signal on any other pin on COM1. Even pin 4 (Data Terminal Ready) which should be high when the UART is enabled is not enabled. As a matter of fact, except RX and TX pins the other pins on the COM1 are not even enabled, as I see on the scope only a ''50Hz noise signal'' similar to the one I get when the scope is powered on but not connected.

    I would like to ask you guys if anyone has already tried to actually use the UART0 to communicate with a modem.

    My application requires detecting the Ring and DCD signal level changes through interrupts and respond accordingly.

    Here is my code, I have made sure that pins were assigned as described by the datasheet

    //For Modem interface 2.0 to 2.3 default input functions

    GPIO_DeInit(GPIO2);

    GPIO_DeInit(GPIO3);

    //UART0_Tx pin GPIO3.1 Alternate ouput 2 function

    GPIO3->DDR |= 0x02;//output direction

    SCU->GPIOOUT[3] |= 0x08; //Alternate ouput 2

    //UART0_Rx pin GPIO3.0 Alternate inputs

    GPIO3->DDR &= ~0x01;//input direction

    SCU->GPIOIN[3] |= 0x01; //Alternate Input

    //Pin 3.2 Alternate ouptut 2 UART0_DTR

    GPIO3->DDR |= 0x04;//output direction

    SCU->GPIOOUT[3] |= 0x30; //Alternate ouput 3

    GPIO3->DR[0x3FC] = 0;

    UART_InitStructure.UART_WordLength = UART_WordLength_8D;

    UART_InitStructure.UART_StopBits = UART_StopBits_1;

    UART_InitStructure.UART_Parity = UART_Parity_No ;

    UART_InitStructure.UART_BaudRate = 9600;

    UART_InitStructure.UART_HardwareFlowControl = ART_HardwareFlowControl_None;

    UART_InitStructure.UART_Mode = UART_Mode_Tx_Rx;

    UART_InitStructure.UART_FIFO = UART_FIFO_Disable;

    //init UART0

    UART_DeInit(UART0);

    UART_Init(UART0, &UART_InitStructure);

    // Enable UART0

    UART_Cmd(UART0, ENABLE);

    transmission and reception work, my application can communicate with the hyperterminal.

    Here is what I observe:

    Pin 3.3 (DTR) is high, while COM1 pin 4(DTR) is not enabled

    Pins 2.0 (CTS) to 2.3 (Ring indicator) are all high even if a modem is not connected to COM1.

    Do you have any explanation?

    Any suggestion is much appreciated

    Thanx