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

Serial to Ethernet conveter

Here my application is whatever data Received through serial(UART1) and Transmit via Ethernet

For this application we used LPC1768 micro controller and taken reference software code is EasyWeb.uvproj.

EasyWeb source code modified local port as TELNET, even though data transmit via Ethernet is very slow and every one second one data can able to transmit.

We need as soon as received data from serial, it should transmit very fast via Ethernet.

For this communication am using Hyper Terminal Windows

Please any one help me how to over come this problem.

Regards,
Ashok

Parents
  • No, am not implement any different TCP/IP stack. I following same function DoNetworkStuff();

    I made zero of RETRY_TIMEOUT, FIN_TIMEOUT & MAX_RETRYS in tcp.h file.

    Socket library also same as DoNetworkStuff();

    When i receive complete word like "hello" through serial, its able to transmit only one character 'h' only via ethernet. we want to achieve complete string transmit via ethernet

    please guide me which statement need to change in my code as per my application.

    int main(void)
    {
    
    //InitOsc();              // Keil: No oscillator initialization necessary at this time.
    //InitPorts();                       // Keil: No port initialization necessary at this time.
    
      SysTick_Config(SystemCoreClock/100);               /* Generate interrupt every 10 ms */
      LPC_GPIO1->FIODIR   |= 1 << 28;                    /* P1.28 defined as Output (LED) */
      LPC_PINCON->PINSEL1 |=  (1<<18);                   /* P0.25 is AD0.2 */
      LPC_SC->PCONP       |=  (1<<12);                   /* Enable power to ADC block */
      LPC_ADC->ADCR        =  (1<< 2) |                  /* select AD0.2 pin */
                              (4<< 8) |                  /* ADC clock is 25MHz/5 */
                              (1<<21);                   /* enable ADC */
      SER_Init();
      TCPLowLevelInit();
      TELNETStatus = 0;
      TCPLocalPort = 23;//TCP_TELENET
      ui_uartcirbufend = 0;
      ui_uartcirbufstart = 0;
    while (1)                                      // repeat forever
      {
    
        if (!( SocketStatus & SOCK_ACTIVE ))
                TCPPassiveOpen();
        if (( SocketStatus & SOCK_ACTIVE ))
              DoNetworkStuff();
        if((LPC_UART1->LSR & 0x01))
        {
          uc_uartrxbuffer[ 0 ] = LPC_UART1->RBR;
          uc_uartrxbuffer[ 1 ] = '\0';
          Telnet_data_tx();
        }
      }
    }
    
    void Telnet_data_tx( void )
    {
    
     if (SocketStatus & SOCK_CONNECTED)             // check if somebody has connected to our TCP
     {
          if (SocketStatus & SOCK_DATA_AVAILABLE)      // check if remote TCP sent data
               TCPReleaseRxBuffer();                      // and throw it away
        if (SocketStatus & SOCK_TX_BUF_RELEASED)     // check if buffer is free for TX
        {
            TCPTxDataCount = 2;//MAX_TCP_TX_DATA_SIZE;   // bytes to xfer
            memcpy(TCP_TX_BUF, uc_uartrxbuffer, TCPTxDataCount);
            TCPTransmitTxBuffer();
    
         }
      }
    }
    
    Note: ALL API are same as in DoNetworkStuff();
    

Reply
  • No, am not implement any different TCP/IP stack. I following same function DoNetworkStuff();

    I made zero of RETRY_TIMEOUT, FIN_TIMEOUT & MAX_RETRYS in tcp.h file.

    Socket library also same as DoNetworkStuff();

    When i receive complete word like "hello" through serial, its able to transmit only one character 'h' only via ethernet. we want to achieve complete string transmit via ethernet

    please guide me which statement need to change in my code as per my application.

    int main(void)
    {
    
    //InitOsc();              // Keil: No oscillator initialization necessary at this time.
    //InitPorts();                       // Keil: No port initialization necessary at this time.
    
      SysTick_Config(SystemCoreClock/100);               /* Generate interrupt every 10 ms */
      LPC_GPIO1->FIODIR   |= 1 << 28;                    /* P1.28 defined as Output (LED) */
      LPC_PINCON->PINSEL1 |=  (1<<18);                   /* P0.25 is AD0.2 */
      LPC_SC->PCONP       |=  (1<<12);                   /* Enable power to ADC block */
      LPC_ADC->ADCR        =  (1<< 2) |                  /* select AD0.2 pin */
                              (4<< 8) |                  /* ADC clock is 25MHz/5 */
                              (1<<21);                   /* enable ADC */
      SER_Init();
      TCPLowLevelInit();
      TELNETStatus = 0;
      TCPLocalPort = 23;//TCP_TELENET
      ui_uartcirbufend = 0;
      ui_uartcirbufstart = 0;
    while (1)                                      // repeat forever
      {
    
        if (!( SocketStatus & SOCK_ACTIVE ))
                TCPPassiveOpen();
        if (( SocketStatus & SOCK_ACTIVE ))
              DoNetworkStuff();
        if((LPC_UART1->LSR & 0x01))
        {
          uc_uartrxbuffer[ 0 ] = LPC_UART1->RBR;
          uc_uartrxbuffer[ 1 ] = '\0';
          Telnet_data_tx();
        }
      }
    }
    
    void Telnet_data_tx( void )
    {
    
     if (SocketStatus & SOCK_CONNECTED)             // check if somebody has connected to our TCP
     {
          if (SocketStatus & SOCK_DATA_AVAILABLE)      // check if remote TCP sent data
               TCPReleaseRxBuffer();                      // and throw it away
        if (SocketStatus & SOCK_TX_BUF_RELEASED)     // check if buffer is free for TX
        {
            TCPTxDataCount = 2;//MAX_TCP_TX_DATA_SIZE;   // bytes to xfer
            memcpy(TCP_TX_BUF, uc_uartrxbuffer, TCPTxDataCount);
            TCPTransmitTxBuffer();
    
         }
      }
    }
    
    Note: ALL API are same as in DoNetworkStuff();
    

Children