This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

problem to communicate with Hyperterminal

Hello,

I'm a newbie in ARM and in Keil Microvision IDE. I downloaded an example from st site, which allows to communicate via serial port with an hyperterminal.
I compile then download the program in the ARM7. When I am in debugging mode, I can see the program works properly thanks to serial window inside Microvision.
But When I want to use hyperterminal on my PC to communicate with STR7, nothing happens...I take care of using correct settings for serial comm, same settings than in STR7.

Could you help me please?

Parents Reply Children
  • Hello,

    Yes, I assume it's correct because I use a RS232 cable with pin 2 and pin 3 (Rx and Tx) twisted. I used this cable to communicate between 2 PC via hyperterminal and it's OK. I read that I have to use this type of cable to communicate between STR7 and Hyperterminal.

  • I give you my code :

    /******************** (C) COPYRIGHT 2003 STMicroelectronics ********************
    * File Name          : main.c
    * Author             : MCD Application Team
    * Date First Issued  : 16/05/2003
    * Description        : This program demonstrates how to use the UART with the
    *                      STR71x software library.
    ********************************************************************************
    * History:
    * 13/01/06 : V3.1
    * 24/05/05 : V3.0
    * 30/11/04 : V2.0
    * 16/05/03 : Created
    *******************************************************************************
     THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH
     CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
     AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT
     OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT
     OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION
     CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
    *******************************************************************************/
    
    #include "71x_lib.h"
    
    #define UART0_Rx_Pin (0x0001<<8)   /*  TQFP 64: pin N° 63 , TQFP 144 pin N° 143 */
    #define UART0_Tx_Pin (0x0001<<9)   /*  TQFP 64: pin N° 64 , TQFP 144 pin N° 144 */
    
    #define UART1_Rx_Pin (0x0001<<10)  /*  TQFP 64: pin N° 1  , TQFP 144 pin N° 1 */
    #define UART1_Tx_Pin (0x0001<<11)  /*  TQFP 64: pin N° 2  , TQFP 144 pin N° 3 */
    
    #define UART2_Rx_Pin (0x0001<<13)  /*  TQFP 64: pin N° 5  , TQFP 144 pin N° 9 */
    #define UART2_Tx_Pin (0x0001<<14)  /*  TQFP 64: pin N° 6  , TQFP 144 pin N° 10 */
    
    #define UART3_Rx_Pin (0x0001<<1)   /*  TQFP 64: pin N° 52 , TQFP 144 pin N° 123 */
    #define UART3_Tx_Pin (0x0001<<0)   /*  TQFP 64: pin N° 53 , TQFP 144 pin N° 124 */
    
    #define Use_UART0
    /* #define Use_UART1 */
    /* #define Use_UART2 */
    /* #define Use_UART3 */
    
       #ifdef Use_UART0
         #define  UARTX  UART0
         #define  UARTX_Rx_Pin  UART0_Rx_Pin
         #define  UARTX_Tx_Pin  UART0_Tx_Pin
         #define  UARTX_Periph  UART0_Periph
       #endif /* Use_UART0 */
    
       #ifdef Use_UART1
         #define  UARTX  UART1
         #define  UARTX_Rx_Pin  UART1_Rx_Pin
         #define  UARTX_Tx_Pin  UART1_Tx_Pin
         #define  UARTX_Periph  UART1_Periph
       #endif /* Use_UART1 */
    
       #ifdef Use_UART2
         #define  UARTX  UART2
         #define  UARTX_Rx_Pin  UART2_Rx_Pin
         #define  UARTX_Tx_Pin  UART2_Tx_Pin
         #define  UARTX_Periph  UART2_Periph
       #endif /* Use_UART2 */
    
       #ifdef Use_UART3
         #define  UARTX  UART3
         #define  UARTX_Rx_Pin  UART3_Rx_Pin
         #define  UARTX_Tx_Pin  UART3_Tx_Pin
         #define  UARTX_Periph  UART3_Periph
       #endif /* Use_UART3 */
    
    
    u16 i;
    u16 UARTStatus;
    u8 bBuffer[4]={'S','T','R','7'};
    
    int main(void)
    {
      #ifdef DEBUG
      debug();
      #endif
       /* GPIO peripheral configuration -------------------------------------------*/
    
      /*  Configure the GPIO pins */
      GPIO_Config(GPIO0, UARTX_Tx_Pin, GPIO_AF_PP);
      GPIO_Config(GPIO0, UARTX_Rx_Pin, GPIO_IN_TRI_CMOS);
    
      /* UART peripheral configuration -------------------------------------------*/
    
      /*  Configure the UART X */
      /*  Turn UARTX on */
      UART_OnOffConfig(UARTX, ENABLE);
      /*  Disable FIFOs */
      UART_FifoConfig (UARTX, DISABLE);
      /*  Reset the UART_RxFIFO */
      UART_FifoReset  (UARTX , UART_RxFIFO);
      /*  Reset the UART_TxFIFO */
      UART_FifoReset  (UARTX , UART_TxFIFO);
      /*  Disable Loop Back */
      UART_LoopBackConfig(UARTX , DISABLE);
     /* Configure the UARTX as following:
                                 - Baudrate = 9600 Bps
                                 - No parity
                                 - 8 data bits
                                 - 1 stop bit */
      UART_Config(UARTX,9600,UART_NO_PARITY,UART_1_StopBits,UARTM_8D);
     /*  Enable Rx */
      UART_RxConfig(UARTX ,ENABLE);
      while(1)
      {
        for(i=0;i<4;i++)
        {
          UART_ByteSend(UARTX, (u8 *)&bBuffer[i]);
          /*  wait until the data transmission is finished */
          while(!((UART_FlagStatus(UARTX)) & UART_TxEmpty));
        }
    
        for(i=0;i<4;i++)
        {
          /*  wait until data is received */
          while(!(UART_FlagStatus(UARTX) & UART_RxBufFull));
          /*  Get the received data, set the guard time to 0xFF */
          UARTStatus = UART_ByteReceive(UARTX, (u8 *)&bBuffer[i], 0xFF);
        }
       }
    }
    
    /******************* (C) COPYRIGHT 2003 STMicroelectronics *****END OF FILE****/
    

    Thanks a lot

  • "I assume it's correct because I use a RS232 cable with pin 2 and pin 3 (Rx and Tx) twisted."

    That, in itself, is not sufficient.
    Have you checked the pinouts on your STR7 board to confirm that it needs a twisted cable?
    If your STR7 board is wired to need a straight-through cable - well, obviously it won't work!

    "I used this cable to communicate between 2 PC via hyperterminal and it's OK"

    Again, have you checked that the pinouts on your STR7 board are the same as a PC?

    "I read that I have to use this type of cable to communicate between STR7 and Hyperterminal"

    Where did you read that?
    It has absoultely nothing whatsoever to do with the STR7!
    It all depends on how the connector on your board is wired.

  • Antoine:

    If you use a cable that allows connection between two PC's then that is probably a Null-Modem cable. These are use when you want to hook up a PC to a device set up as DTE. And it is probably not what you want.

    I don't know which board you are using but if it is like my Keil MCBSTR9 (based on an ARM 9), then it is probably wired and fitted with a connector so as to be set up as DCE. That said, a straight-thru cable is what you would want to use. I'm guessing that Keil probably tends to build boards in a similar way despite processor....I could be wrong though.

    When you look at the DB-9 connector (on your STR7 board), is it male or female? If it is male, it is probably set up like a PC (DTE). If it is female, it is probably set up like a DCE. If so, use a straight-thru.

    If you want more information on cables and stuff, go to http://www.nullmodem.com.

    Best Regards and Good Luck,

    -=Rich=-

  • Hello,

    Thanks for your answer!

    DB9 connector on my Hitex EvalBoard (same than MCBSTR7 Board) is female. But even if I use a straight-thru cable, nothing works...(I verified ppin to pin connection on my a straight-thru cable ).

    I tried also change db9 port on the evalboard (since there are 2 serial port) but normally UART0 matches to RS232-A port?

    I wonder also if there is a possibility that baudrate is wrong, since it depends on a clock speed (RCCU_FCLK). I mean in target option in microvision, there is a setting for XTAL Clock, where I wrote 16 Mhz.

    Thanks for your help

  • Hello,

    Thanks for your answer.

    Actually I find informations on the pdf file associated with the program form ST microelectronics I had attached before.

    As I said to Richard, I don't understand why it doesn't work, with a twisted cable or a straight-through cable...

    Maybe I have bad settings when I download program in the STR7..

    I'm really lost with this stuff.

    Could you some advices concerning settings in microvision 3, to be sure I do correct things?

    Thanks for your help