• AVR Freaks

Hot!Harmony Configurator - UART to TCP/IP bridge

Author
aruntkkumar
Starting Member
  • Total Posts : 35
  • Reward points : 0
  • Joined: 2012/11/22 03:54:36
  • Location: Birmingham, UK
  • Status: offline
2019/09/02 01:35:18 (permalink)
0

Harmony Configurator - UART to TCP/IP bridge

I am trying to connect using TCP/IP to PIC32MX795F512L using Harmony Configurator v2.00b. This would be a simple TCP/IP connection to a predefined PORT number. However, I am not even able to connect using any of the TCPIP apps. If anyone could guide me on which API to use to connect, I could then work out the UART to TCPIP bridge.
 
NOTE: The same test board was previously used by another user to configure TCP/IP with wolfSSL encryption. I am basically trying to remove the encryption bit.
post edited by aruntkkumar - 2019/09/02 02:24:05
#1
BillP
Super Member
  • Total Posts : 334
  • Reward points : 0
  • Joined: 2014/09/28 07:53:35
  • Location: CA
  • Status: offline
Re: Harmony Configurator - UART to TCP/IP bridge 2019/09/02 07:24:20 (permalink)
0
Leave the wolfSSL encryption logic in the app.  Just change the listening port number to 80 (http).  When this works, it shows that all of the underlying code in the TCP/IP stack is configured properly.  Then, use the demo code for a TCP link as a guide to do what you want to do.
#2
aruntkkumar
Starting Member
  • Total Posts : 35
  • Reward points : 0
  • Joined: 2012/11/22 03:54:36
  • Location: Birmingham, UK
  • Status: offline
Re: Harmony Configurator - UART to TCP/IP bridge 2019/09/02 07:51:08 (permalink)
0
The port is already at 80. Here is the list of all the TCPIP common ports
 
// First port number for randomized local port number selection
#define TCPIP_UDP_LOCAL_PORT_START_NUMBER (49152)
// Last port number for randomized local port number selection
#define TCPIP_UDP_LOCAL_PORT_END_NUMBER (65535)

// *****************************************************************************
// *****************************************************************************
// TCP dynamic port numbers
// *****************************************************************************
// *****************************************************************************

// First port number for randomized local port number selection
// Use the dynamic port range defined by IANA consists of the 49152-65535 range
// and is meant for the selection of ephemeral ports (RFC 6056).
// Adjust to your needs but stay within the IANA range
#define TCPIP_TCP_LOCAL_PORT_START_NUMBER (49152)

// Last port number for randomized local port number selection
#define TCPIP_TCP_LOCAL_PORT_END_NUMBER (65535)


// *****************************************************************************
// *****************************************************************************
// Stack modules port numbers
// *****************************************************************************
// *****************************************************************************


// ************************************************************
// HTTP server listening TCP port
#define TCPIP_HTTP_SERVER_PORT (80)
#define TCPIP_HTTP_NET_SERVER_PORT (80)

// HTTPS server listening TCP port
#define TCPIP_HTTP_NET_SERVER_SECURE_PORT (443)


// ************************************************************
// Unsecured Telnet server TCP port
#define TCPIP_TELNET_SERVER_PORT (23)

// Secured Telnet server TCP port
#define TCPIP_TELNET_SERVER_SECURE_PORT (992)

// ************************************************************
// DHCP Client transactions UDP local port
#define TCPIP_DHCP_CLIENT_PORT (68)

// DHCP Server UDP remote port
#define TCPIP_DHCP_SERVER_PORT (67)


// DNS server UDP listening port
#define TCPIP_DNS_SERVER_PORT (53)


// ************************************************************
// Dynamic DNS TCP remote port
#define TCPIP_DDNS_SERVER_REMOTE_PORT (80)


// ************************************************************
// NetBIOS Name UDP Service (server) port
#define TCPIP_NBNS_SERVER_PORT (137)

// ************************************************************
// SMTP server remote TCP port
#define TCPIP_SMTP_SERVER_REMOTE_PORT (25)
#define TCPIP_SMTP_SERVER_SECURE_SSL_PORT (465)
#define TCPIP_SMTP_SERVER_SECURE_TLS_PORT (587)

// ************************************************************
// NTP server remote TCP port
#define TCPIP_NTP_SERVER_REMOTE_PORT (123)


// ************************************************************
// Reboot server listening UDP port
#define TCPIP_REBOOT_SERVER_PORT (69)


// ************************************************************
// MCHP Announce service UDP port (server and client)
#define TCPIP_ANNOUNCE_PORT (30303)

// ************************************************************
// Iperf server listening port (TCP and UDP)
#define TCPIP_IPERF_SERVER_PORT (5001)

// Iperf client local TCP port
#define TCPIP_IPERF_TCP_LOCAL_PORT_START_NUMBER (1024)

// ************************************************************
// TFTP Client local UDP port
#define TCPIP_TFTP_CLIENT_PORT (65352)

// TFTP Server remote UDP Port
#define TCPIP_TFTP_SERVER_PORT (69)

// ************************************************************
// FTP ports
#define TCPIP_FTP_COMMAND_PORT (21)

#define TCPIP_FTP_DATA_PORT (20)

#define TCPIP_FTP_DATA_SECURE_PORT (989)
#define TCPIP_FTP_COMMAND_SECURE_PORT (990)

// ************************************************************
// DHCPv6 clients listening UDP port:
#define TCPIP_DHCPV6_CLIENT_PORT (546)

// DHCPv6 servers and relay agents listening UDP port:
#define TCPIP_DHCPV6_SERVER_PORT (547)

// ************************************************************
// NNTP servers port:
#define TCPIP_NNTP_SERVER_SECURE_PORT (563)

// ************************************************************
// LDAP port:
#define TCPIP_LDAP_SERVER_SECURE_PORT (636)

// ************************************************************
// IMAP port:
#define TCPIP_IMAP_SERVER_PORT (143)
#define TCPIP_IMAP_SERVER_SECURE_PORT (993)

 
This was in the tcpip_common_ports.h under tcpip framework. Sorry if I misunderstood as I am still new to TCPIP protocols.
post edited by aruntkkumar - 2019/09/02 07:52:25
#3
BillP
Super Member
  • Total Posts : 334
  • Reward points : 0
  • Joined: 2014/09/28 07:53:35
  • Location: CA
  • Status: offline
Re: Harmony Configurator - UART to TCP/IP bridge 2019/09/02 10:03:00 (permalink)
0
OK, so these are the defines, but you set the port number in MHC, under the TCPIP Stack (many options that need to be set).  That is why you need to use the demos as a guide.
#4
aruntkkumar
Starting Member
  • Total Posts : 35
  • Reward points : 0
  • Joined: 2012/11/22 03:54:36
  • Location: Birmingham, UK
  • Status: offline
Re: Harmony Configurator - UART to TCP/IP bridge 2019/09/03 00:02:10 (permalink)
0
Attached is the complete TCPIP Stack configuration under MHC. Could you please guide me on what to change?

Attached Image(s)

#5
muellernick
Super Member
  • Total Posts : 474
  • Reward points : 0
  • Joined: 2015/01/06 23:58:23
  • Location: Germany
  • Status: offline
Re: Harmony Configurator - UART to TCP/IP bridge 2019/09/03 01:22:51 (permalink)
1 (1)
Forget about all that HTTP stuff. It won't help you.
 
Open a TCP/IP port (you chose the number) as server.
 
First, try to ping your board (verify the IP-address with ipconfig, you should see the IP and MAC).
Open a connection to your board's IP and port with Putty with a raw connection.
Type something and you should receive it on your board.
 
I wouldn't use BSD sockets, Harmony's sockets are simpler.
 
 
HTH,
Nick
 
#6
BillP
Super Member
  • Total Posts : 334
  • Reward points : 0
  • Joined: 2014/09/28 07:53:35
  • Location: CA
  • Status: offline
Re: Harmony Configurator - UART to TCP/IP bridge 2019/09/03 08:26:45 (permalink)
0
I think the TCP options you show are OK.  I use the external heap and only check the ICMPv4 server box, but I doubt that will affect your link.  You also need to use MHC to configure the Internal MAC driver, External PHY, and the Presentation Layer.  Then you need to add the application level code to open the server port (see Nick's comment above) and monitor for connections.  This code needs to execute in the superloop.
#7
aruntkkumar
Starting Member
  • Total Posts : 35
  • Reward points : 0
  • Joined: 2012/11/22 03:54:36
  • Location: Birmingham, UK
  • Status: offline
Re: Harmony Configurator - UART to TCP/IP bridge 2019/10/09 07:46:56 (permalink)
0
I have tried every bit of combination and still couldn't make it work. Any bit of help is much appreciated.
 
Here is the TCP Server data function
 
 
void APP_TCP_Server_data( void )
{
    SYS_STATUS tcpipStat;
    const char *netName, *netBiosName;
    static IPV4_ADDR dwLastIP[2] = { {-1}, {-1} };
    IPV4_ADDR ipAddr;
    int i, nNets;
    TCPIP_NET_HANDLE netH;
    
    int ret=0,error,idx;
    volatile BYTE* TXHeadPtrShadow;
    volatile BYTE* TXTailPtrShadow;
    
    static int maxRead;
    static int wMaxGet;
    BYTE SerialBuffer[32];
    
    volatile DWORD mSEC;
    
    //get a copy of the head and tail TX UART1 ptrs
        
    TXHeadPtrShadow = (BYTE*)appData.UART1TXHeadPtr;
    IEC0bits.U1TXIE = 0;
    TXTailPtrShadow = (BYTE*)appData.UART1TXTailPtr;

    if(TXHeadPtrShadow != TXTailPtrShadow)
    {
        IEC0bits.U1TXIE =1;
    }

    //SYS_CMD_READY_TO_READ();
    switch(appData.TCP_Server2_state)
    {
        
        case APP_TCPIP_WAIT_INIT:
            
            tcpipStat = TCPIP_STACK_Status(sysObj.tcpip);
            if(tcpipStat < 0)
            {
                appData.TCP_Server2_state = APP_TCPIP_ERROR;
            }
            else if(tcpipStat == SYS_STATUS_READY)
            {
                // now that the stack is ready we can check the
                // available interfaces
                nNets = TCPIP_STACK_NumberOfNetworksGet();
                for(i = 0; i < nNets; i++)
                {

                    netH = TCPIP_STACK_IndexToNet(i);
                    netName = TCPIP_STACK_NetNameGet(netH);
                    netBiosName = TCPIP_STACK_NetBIOSName(netH);

            #if defined(TCPIP_STACK_USE_NBNS)
                  // SYS_CONSOLE_PRINT(" Interface %s on host %s - NBNS enabled\r\n", netName, netBiosName);
            #else
                 // SYS_CONSOLE_PRINT(" Interface %s on host %s - NBNS disabled\r\n", netName, netBiosName);
            #endif // defined(TCPIP_STACK_USE_NBNS)
                }
                appData.TCP_Server2_state = APP_TCPIP_WAIT_FOR_IP;

            }
            break;
            
        
        case APP_TCPIP_WAIT_FOR_IP:
            
            nNets = TCPIP_STACK_NumberOfNetworksGet();

            for (i = 0; i < nNets; i++)
            {
                netH = TCPIP_STACK_IndexToNet(i);
                ipAddr.Val = TCPIP_STACK_NetAddress(netH);
                if(dwLastIP[i].Val != ipAddr.Val)
                {
                    dwLastIP[i].Val = ipAddr.Val;
                    Nop();

                    if (ipAddr.v[0] != 0 && ipAddr.v[0] != 169) // Wait for a Valid IP
                    {
                        appData.TCP_Server2_state = APP_TCPIP_OPENING_SERVER;
                    }
                }
            }
            break;
        
        case APP_TCPIP_OPENING_SERVER:
        {
            appData.socket2 = TCPIP_TCP_ServerOpen(IP_ADDRESS_TYPE_IPV4, appData.networkRecord.portData, 0);
            if (appData.socket2 == INVALID_SOCKET){
            
                #ifdef DEBUG_ON
                printf("ERROR: setting up socket1\n\r");
                #endif
                return;
            }
            #ifdef DEBUG_ON
            printf("Waiting for client connection data server...\n\r");
            #endif
            appData.TCP_Server2_state = APP_TCPIP_WAIT_FOR_CONNECTION;
            break;
        }
        
        case APP_TCPIP_WAIT_FOR_CONNECTION:
        {
            
            if (TCPIP_TCP_IsConnected(appData.socket2))
            {
                #ifdef DEBUG_ON
                printf("Got client connection data server!\n\r");
                #endif
                 appData.TCP_Server2_state = APP_TCPIP_SSL_ACCEPT;
                 appData.DataServerTimeoutTick = SYS_TMR_TickCountGet();
                 
            }
        }
        break;
        
        case APP_TCPIP_SSL_ACCEPT:

            #ifdef DEBUG_ON
            printf("SSL accept success data server\n\r");
            #endif
            appData.TCP_Server2_state = APP_TCPIP_SERVING_CONNECTION;
            IEC0bits.U1RXIE = 0;
            //IEC0bits.U1TXIE = 0;
            appData.UART1RXHeadPtr = appData.uart1RXbuffer;
            appData.UART1RXTailPtr = appData.uart1RXbuffer;
            
            IEC0bits.U1RXIE = 1;
            appData.RS232RX_message_RDY = false;
            
        break;
            
        case APP_TCPIP_SERVING_CONNECTION:
            
        {
            if (!TCPIP_TCP_IsConnected(appData.socket2))
            {
                appData.TCP_Server2_state = APP_TCPIP_CLOSING_CONNECTION;
              // SYS_CONSOLE_MESSAGE("Connection was closed\r\n");
                break;
            }
            
            appData.DataServerActive = 1;
            
            if(appData.RS232RX_message_RDY)
            {
                   appData.RS232RX_message_RDY=0;
           }
            
            
           if(1) {
                             if(TXHeadPtrShadow==TXTailPtrShadow)
                             {
                                 maxRead = 32;
                                 
                             }
                             if(TXHeadPtrShadow>TXTailPtrShadow)
                             {
                                 
                                 maxRead = (&appData.uart1TXbuffer[0]+sizeof(appData.uart1TXbuffer) - TXHeadPtrShadow) + (TXTailPtrShadow - &appData.uart1TXbuffer[0]);
                                 

                                 if(maxRead >= 32)
                                 {
                                     maxRead = 32;
                                 }
                                 else{
                                     maxRead = 0; // dont read any data from buffer
                                     return;
                                 }
                             }

                             if(TXHeadPtrShadow<TXTailPtrShadow)
                             {
                                 maxRead = TXTailPtrShadow - TXHeadPtrShadow;                              

                                 if(maxRead >= 32)
                                 {
                                     maxRead = 32;
                                 }
                                 else{
                                     maxRead = 0; // dont read any data from buffer
                                     return;
                                 }
                             }
                     }
                     else
                     {
                         maxRead = 32;
                     }

                        #ifdef DEBUG_ON
                        printf("<< ");
                        #endif

                         for(i=0; i<wMaxGet; i++)
                           {
                                appData.messageUART1tx[i] = SerialBuffer[i];
                                #ifdef DEBUG_ON
                                printf("%.2x",SerialBuffer[i]);
                               #endif
                               
                           }
                        #ifdef DEBUG_ON
                        printf("\r\n");
                        #endif

                           
                           appData.state = APP_STATE_START_RAW_DATA_LED_TIMEOUT;
                           appData.RS232TX_message_RDY = 1;
                           appData.RS232TX_message_SIZE = wMaxGet;
                                 
           break;
        }

  
        case APP_TCPIP_CLOSING_CONNECTION:
        {
            #ifdef DEBUG_ON
            printf("Shutting down SSL connection data server... \n\r");
            #endif
            
            TCPIP_TCP_Close(appData.socket2);
            
            appData.DataServerActive = 0;
            appData.pkt_tout_active = 0;
            appData.pktTimeOutUART1RX = false;
            PLIB_PORTS_PinClear(PORTS_ID_0, APP_LED2_PORT, APP_LED2_PIN);
            
            appData.socket2 = INVALID_SOCKET;
            appData.TCP_Server2_state = APP_TCPIP_OPENING_SERVER;

        }
        break;
        
        default:
            break;
        }
    

    
    }

 
I am not even sure on how to even connect as I can ping the device, but not connect to it.
#8
rainad
Moderator
  • Total Posts : 1224
  • Reward points : 0
  • Joined: 2009/05/01 13:39:25
  • Location: 0
  • Status: offline
Re: Harmony Configurator - UART to TCP/IP bridge 2019/10/09 10:03:07 (permalink)
0
I suggest you start with the code from an out of the box demos, that come with the Harmony distribution.
No encryption, bridging or anything else. Keep it simple until you have it up and running.
For example, please use the tcpip_tcp_server. That demo opens a TCP server socket and listens on port 9760.
First make sure that you can ping the board - a serial console would be very helpful, since you have a UART on your board.
If the board gets/has a valid IP address and you can ping it, then try to connect to that socket on port 9760 using some tool from your PC (Hercules, packet sender, etc.).
Let us know if this works and then you'll be able to move forward.
 
 
#9
aruntkkumar
Starting Member
  • Total Posts : 35
  • Reward points : 0
  • Joined: 2012/11/22 03:54:36
  • Location: Birmingham, UK
  • Status: offline
Re: Harmony Configurator - UART to TCP/IP bridge 2019/10/10 05:13:17 (permalink)
0
I tried the tcpip_tcp_client out of the box project under harmony v2_06 app. The default TCPIP address from 'system_config.h' is shown as below:
 
#define TCPIP_NETWORK_DEFAULT_IP_ADDRESS_IDX0 "192.168.100.115"

 
However, when I tried to ping the address I am getting the error message "PING: Transmit failed: General Failure". Not sure what to do. 
#10
NKurzman
A Guy on the Net
  • Total Posts : 17847
  • Reward points : 0
  • Joined: 2008/01/16 19:33:48
  • Location: 0
  • Status: offline
Re: Harmony Configurator - UART to TCP/IP bridge 2019/10/10 05:33:30 (permalink)
0
Is DHCP on? If so then it will use the address your network provides.
If not you must give it an address that is compatible with you network.
#11
aruntkkumar
Starting Member
  • Total Posts : 35
  • Reward points : 0
  • Joined: 2012/11/22 03:54:36
  • Location: Birmingham, UK
  • Status: offline
Re: Harmony Configurator - UART to TCP/IP bridge 2019/10/10 06:19:11 (permalink)
0
I changed it to IP address that was used previously, but still did not work. Given below is the complete system_config.h code under pic32mx_eth_sk2
 
// DOM-IGNORE-END

#ifndef _SYSTEM_CONFIG_H
#define _SYSTEM_CONFIG_H

// *****************************************************************************
// *****************************************************************************
// Section: Included Files
// *****************************************************************************
// *****************************************************************************
/* This section Includes other configuration headers necessary to completely
    define this configuration.
*/
#include "bsp.h"


// DOM-IGNORE-BEGIN
#ifdef __cplusplus // Provide C++ Compatibility

extern "C" {

#endif
// DOM-IGNORE-END

// *****************************************************************************
// *****************************************************************************
// Section: System Service Configuration
// *****************************************************************************
// *****************************************************************************
// *****************************************************************************
/* Common System Service Configuration Options
*/
#define SYS_VERSION_STR "2.05"
#define SYS_VERSION 20500

// *****************************************************************************
/* Clock System Service Configuration Options
*/
#define SYS_CLK_FREQ 80000000ul
#define SYS_CLK_BUS_PERIPHERAL_1 80000000ul
#define SYS_CLK_UPLL_BEFORE_DIV2_FREQ 48000000ul
#define SYS_CLK_CONFIG_PRIMARY_XTAL 8000000ul
#define SYS_CLK_CONFIG_SECONDARY_XTAL 32768ul
   
/*** Ports System Service Configuration ***/
#define SYS_PORT_AD1PCFG ~0xffdf
#define SYS_PORT_CNPUE 0x98000
#define SYS_PORT_CNEN 0x0
#define SYS_PORT_A_TRIS 0xFFFF
#define SYS_PORT_A_LAT 0x0000
#define SYS_PORT_A_ODC 0x0000

#define SYS_PORT_B_TRIS 0x0000
#define SYS_PORT_B_LAT 0x0000
#define SYS_PORT_B_ODC 0x0000

#define SYS_PORT_C_TRIS 0xFFFF
#define SYS_PORT_C_LAT 0x0000
#define SYS_PORT_C_ODC 0x0000

#define SYS_PORT_D_TRIS 0xFFF8
#define SYS_PORT_D_LAT 0x0000
#define SYS_PORT_D_ODC 0x0000

#define SYS_PORT_E_TRIS 0xFFFF
#define SYS_PORT_E_LAT 0x0000
#define SYS_PORT_E_ODC 0x0000

#define SYS_PORT_F_TRIS 0xFFFF
#define SYS_PORT_F_LAT 0x0000
#define SYS_PORT_F_ODC 0x0000

#define SYS_PORT_G_TRIS 0xFFFF
#define SYS_PORT_G_LAT 0x0000
#define SYS_PORT_G_ODC 0x0000


/*** Command Processor System Service Configuration ***/
#define SYS_CMD_ENABLE
#define SYS_CMD_DEVICE_MAX_INSTANCES SYS_CONSOLE_DEVICE_MAX_INSTANCES
#define SYS_CMD_PRINT_BUFFER_SIZE 512
#define SYS_CMD_BUFFER_DMA_READY
#define SYS_CMD_REMAP_SYS_CONSOLE_MESSAGE
#define SYS_CMD_REMAP_SYS_DEBUG_MESSAGE

/*** Console System Service Configuration ***/

#define SYS_CONSOLE_OVERRIDE_STDIO
#define SYS_CONSOLE_DEVICE_MAX_INSTANCES 2
#define SYS_CONSOLE_INSTANCES_NUMBER 1
#define SYS_CONSOLE_USB_CDC_INSTANCE USB_DEVICE_CDC_INDEX_0
#define SYS_CONSOLE_USB_CDC_COMM_BAUD_RATE 921600
#define SYS_CONSOLE_USB_CDC_RD_QUEUE_DEPTH 1
#define SYS_CONSOLE_USB_CDC_WR_QUEUE_DEPTH 32
#define SYS_CONSOLE_USB_CDC_READ_BUFFER_SIZE 64
#define SYS_CONSOLE_BUFFER_DMA_READY



/*** Debug System Service Configuration ***/
#define SYS_DEBUG_ENABLE
#define DEBUG_PRINT_BUFFER_SIZE 512
#define SYS_DEBUG_BUFFER_DMA_READY
#define SYS_DEBUG_USE_CONSOLE

/*** Interrupt System Service Configuration ***/
#define SYS_INT true
// *****************************************************************************
/* Random System Service Configuration Options
*/

#define SYS_RANDOM_CRYPTO_SEED_SIZE 32

/*** Timer System Service Configuration ***/
#define SYS_TMR_POWER_STATE SYS_MODULE_POWER_RUN_FULL
#define SYS_TMR_DRIVER_INDEX DRV_TMR_INDEX_0
#define SYS_TMR_MAX_CLIENT_OBJECTS 5
#define SYS_TMR_FREQUENCY 1000
#define SYS_TMR_FREQUENCY_TOLERANCE 10
#define SYS_TMR_UNIT_RESOLUTION 10000
#define SYS_TMR_CLIENT_TOLERANCE 10
#define SYS_TMR_INTERRUPT_NOTIFICATION false

// *****************************************************************************
// *****************************************************************************
// Section: Driver Configuration
// *****************************************************************************
// *****************************************************************************

/*** MIIM Driver Configuration ***/
#define DRV_MIIM_ETH_MODULE_ID ETH_ID_0
#define DRV_MIIM_INSTANCES_NUMBER 1
#define DRV_MIIM_INSTANCE_OPERATIONS 4
#define DRV_MIIM_INSTANCE_CLIENTS 2
#define DRV_MIIM_CLIENT_OP_PROTECTION false
#define DRV_MIIM_COMMANDS false
#define DRV_MIIM_DRIVER_OBJECT DRV_MIIM_OBJECT_BASE_Default
#define DRV_MIIM_DRIVER_INDEX DRV_MIIM_INDEX_0
/*** Timer Driver Configuration ***/
#define DRV_TMR_INTERRUPT_MODE true
#define DRV_TMR_INSTANCES_NUMBER 1
#define DRV_TMR_CLIENTS_NUMBER 1

/*** Timer Driver 0 Configuration ***/
#define DRV_TMR_PERIPHERAL_ID_IDX0 TMR_ID_1
#define DRV_TMR_INTERRUPT_SOURCE_IDX0 INT_SOURCE_TIMER_1
#define DRV_TMR_INTERRUPT_VECTOR_IDX0 INT_VECTOR_T1
#define DRV_TMR_ISR_VECTOR_IDX0 _TIMER_1_VECTOR
#define DRV_TMR_INTERRUPT_PRIORITY_IDX0 INT_PRIORITY_LEVEL1
#define DRV_TMR_INTERRUPT_SUB_PRIORITY_IDX0 INT_SUBPRIORITY_LEVEL0
#define DRV_TMR_CLOCK_SOURCE_IDX0 DRV_TMR_CLKSOURCE_INTERNAL
#define DRV_TMR_PRESCALE_IDX0 TMR_PRESCALE_VALUE_256
#define DRV_TMR_OPERATION_MODE_IDX0 DRV_TMR_OPERATION_MODE_16_BIT
#define DRV_TMR_ASYNC_WRITE_ENABLE_IDX0 false
#define DRV_TMR_POWER_STATE_IDX0 SYS_MODULE_POWER_RUN_FULL

 
// *****************************************************************************
// *****************************************************************************
// Section: Middleware & Other Library Configuration
// *****************************************************************************
// *****************************************************************************
/*** Crypto Library Configuration ***/

#define WC_NO_HARDEN
#define MICROCHIP_MPLAB_HARMONY
#define HAVE_MCAPI
#if defined(__PIC32C__)
#define MICROCHIP_PIC32C
#else
#define MICROCHIP_PIC32
#endif
#define NO_CERTS
#define NO_PWDBASED
#define NO_OLD_TLS
#define NO_SHA
#define NO_AES
#define NO_ASN
#define NO_RSA



// *****************************************************************************
// *****************************************************************************
// Section: TCPIP Stack Configuration
// *****************************************************************************
// *****************************************************************************
#define TCPIP_STACK_USE_IPV4
#define TCPIP_STACK_USE_TCP
#define TCPIP_STACK_USE_UDP

#define TCPIP_STACK_TICK_RATE 5
#define TCPIP_STACK_SECURE_PORT_ENTRIES 10

#define TCPIP_STACK_ALIAS_INTERFACE_SUPPORT false

#define TCPIP_PACKET_LOG_ENABLE 0

/* TCP/IP stack event notification */
#define TCPIP_STACK_USE_EVENT_NOTIFICATION
#define TCPIP_STACK_USER_NOTIFICATION false
#define TCPIP_STACK_DOWN_OPERATION true
#define TCPIP_STACK_IF_UP_DOWN_OPERATION true
#define TCPIP_STACK_MAC_DOWN_OPERATION true
#define TCPIP_STACK_INTERFACE_CHANGE_SIGNALING false
#define TCPIP_STACK_CONFIGURATION_SAVE_RESTORE true
/*** TCPIP Heap Configuration ***/

#define TCPIP_STACK_USE_INTERNAL_HEAP
#define TCPIP_STACK_DRAM_SIZE 39250
#define TCPIP_STACK_DRAM_RUN_LIMIT 2048

#define TCPIP_STACK_MALLOC_FUNC malloc

#define TCPIP_STACK_CALLOC_FUNC calloc

#define TCPIP_STACK_FREE_FUNC free



#define TCPIP_STACK_HEAP_USE_FLAGS TCPIP_STACK_HEAP_FLAG_ALLOC_UNCACHED

#define TCPIP_STACK_HEAP_USAGE_CONFIG TCPIP_STACK_HEAP_USE_DEFAULT

#define TCPIP_STACK_SUPPORTED_HEAPS 1

/*** ARP Configuration ***/
#define TCPIP_ARP_CACHE_ENTRIES 5
#define TCPIP_ARP_CACHE_DELETE_OLD true
#define TCPIP_ARP_CACHE_SOLVED_ENTRY_TMO 1200
#define TCPIP_ARP_CACHE_PENDING_ENTRY_TMO 60
#define TCPIP_ARP_CACHE_PENDING_RETRY_TMO 2
#define TCPIP_ARP_CACHE_PERMANENT_QUOTA 50
#define TCPIP_ARP_CACHE_PURGE_THRESHOLD 75
#define TCPIP_ARP_CACHE_PURGE_QUANTA 1
#define TCPIP_ARP_CACHE_ENTRY_RETRIES 3
#define TCPIP_ARP_GRATUITOUS_PROBE_COUNT 1
#define TCPIP_ARP_TASK_PROCESS_RATE 2
#define TCPIP_ARP_PRIMARY_CACHE_ONLY true

/*** DHCP Configuration ***/
#define TCPIP_STACK_USE_DHCP_CLIENT
#define TCPIP_DHCP_TIMEOUT 2
#define TCPIP_DHCP_TASK_TICK_RATE 5
#define TCPIP_DHCP_HOST_NAME_SIZE 20
#define TCPIP_DHCP_CLIENT_CONNECT_PORT 68
#define TCPIP_DHCP_SERVER_LISTEN_PORT 67
#define TCPIP_DHCP_CLIENT_ENABLED true


/*** DNS Client Configuration ***/
#define TCPIP_STACK_USE_DNS
#define TCPIP_DNS_CLIENT_SERVER_TMO 60
#define TCPIP_DNS_CLIENT_TASK_PROCESS_RATE 200
#define TCPIP_DNS_CLIENT_CACHE_ENTRIES 5
#define TCPIP_DNS_CLIENT_CACHE_ENTRY_TMO 0
#define TCPIP_DNS_CLIENT_CACHE_PER_IPV4_ADDRESS 5
#define TCPIP_DNS_CLIENT_CACHE_PER_IPV6_ADDRESS 1
#define TCPIP_DNS_CLIENT_ADDRESS_TYPE IP_ADDRESS_TYPE_IPV4
#define TCPIP_DNS_CLIENT_CACHE_DEFAULT_TTL_VAL 1200
#define TCPIP_DNS_CLIENT_CACHE_UNSOLVED_ENTRY_TMO 10
#define TCPIP_DNS_CLIENT_LOOKUP_RETRY_TMO 5
#define TCPIP_DNS_CLIENT_MAX_HOSTNAME_LEN 32
#define TCPIP_DNS_CLIENT_MAX_SELECT_INTERFACES 4
#define TCPIP_DNS_CLIENT_DELETE_OLD_ENTRIES true
#define TCPIP_DNS_CLIENT_USER_NOTIFICATION false




/*** ICMPv4 Server Configuration ***/
#define TCPIP_STACK_USE_ICMP_SERVER



/*** NBNS Configuration ***/
#define TCPIP_STACK_USE_NBNS
#define TCPIP_NBNS_TASK_TICK_RATE 110







/*** TCP Configuration ***/
#define TCPIP_TCP_MAX_SEG_SIZE_TX 1460
#define TCPIP_TCP_SOCKET_DEFAULT_TX_SIZE 512
#define TCPIP_TCP_SOCKET_DEFAULT_RX_SIZE 512
#define TCPIP_TCP_DYNAMIC_OPTIONS true
#define TCPIP_TCP_START_TIMEOUT_VAL 1000
#define TCPIP_TCP_DELAYED_ACK_TIMEOUT 100
#define TCPIP_TCP_FIN_WAIT_2_TIMEOUT 5000
#define TCPIP_TCP_KEEP_ALIVE_TIMEOUT 10000
#define TCPIP_TCP_CLOSE_WAIT_TIMEOUT 0
#define TCPIP_TCP_MAX_RETRIES 5
#define TCPIP_TCP_MAX_UNACKED_KEEP_ALIVES 6
#define TCPIP_TCP_MAX_SYN_RETRIES 3
#define TCPIP_TCP_AUTO_TRANSMIT_TIMEOUT_VAL 40
#define TCPIP_TCP_WINDOW_UPDATE_TIMEOUT_VAL 200
#define TCPIP_TCP_MAX_SOCKETS 10
#define TCPIP_TCP_TASK_TICK_RATE 5
#define TCPIP_TCP_MSL_TIMEOUT 0
#define TCPIP_TCP_QUIET_TIME 0
#define TCPIP_TCP_COMMANDS false

/*** announce Configuration ***/
#define TCPIP_STACK_USE_ANNOUNCE
#define TCPIP_ANNOUNCE_MAX_PAYLOAD 512
#define TCPIP_ANNOUNCE_TASK_RATE 333
#define TCPIP_ANNOUNCE_NETWORK_DIRECTED_BCAST false

/*** TCPIP MAC Configuration ***/
#define TCPIP_EMAC_TX_DESCRIPTORS 8
#define TCPIP_EMAC_RX_DESCRIPTORS 6
#define TCPIP_EMAC_RX_DEDICATED_BUFFERS 4
#define TCPIP_EMAC_RX_INIT_BUFFERS 0
#define TCPIP_EMAC_RX_LOW_THRESHOLD 1
#define TCPIP_EMAC_RX_LOW_FILL 2
#define TCPIP_EMAC_MAX_FRAME 1536
#define TCPIP_EMAC_LINK_MTU 1500
#define TCPIP_EMAC_RX_BUFF_SIZE 1536
#define TCPIP_EMAC_RX_FRAGMENTS 1

#define TCPIP_EMAC_RX_FILTERS \
                                                    TCPIP_MAC_RX_FILTER_TYPE_BCAST_ACCEPT |\
                                                    TCPIP_MAC_RX_FILTER_TYPE_MCAST_ACCEPT |\
                                                    TCPIP_MAC_RX_FILTER_TYPE_UCAST_ACCEPT |\
                                                    TCPIP_MAC_RX_FILTER_TYPE_RUNT_REJECT |\
                                                    TCPIP_MAC_RX_FILTER_TYPE_CRC_ERROR_REJECT |\
                                                    0
#define TCPIP_EMAC_ETH_OPEN_FLAGS \
                                                    TCPIP_ETH_OPEN_AUTO |\
                                                    TCPIP_ETH_OPEN_FDUPLEX |\
                                                    TCPIP_ETH_OPEN_HDUPLEX |\
                                                    TCPIP_ETH_OPEN_100 |\
                                                    TCPIP_ETH_OPEN_10 |\
                                                    TCPIP_ETH_OPEN_MDIX_AUTO |\
                                                    0

#define TCPIP_EMAC_MODULE_ID ETH_ID_0
#define TCPIP_EMAC_INTERRUPT_MODE true
#define DRV_ETHMAC_INSTANCES_NUMBER 1
#define DRV_ETHMAC_CLIENTS_NUMBER 1
#define DRV_ETHMAC_INDEX 1
#define DRV_ETHMAC_PERIPHERAL_ID 1
#define DRV_ETHMAC_INTERRUPT_VECTOR INT_VECTOR_ETHERNET
#define DRV_ETHMAC_INTERRUPT_SOURCE INT_SOURCE_ETH_1
#define DRV_ETHMAC_POWER_STATE SYS_MODULE_POWER_RUN_FULL

#define DRV_ETHMAC_INTERRUPT_MODE true


#define TCPIP_EMAC_PHY_CONFIG_FLAGS \
                                                    DRV_ETHPHY_CFG_AUTO | \
                                                    0

#define TCPIP_EMAC_PHY_LINK_INIT_DELAY 500
#define TCPIP_EMAC_PHY_ADDRESS 0
#define DRV_ETHPHY_INSTANCES_NUMBER 1
#define DRV_ETHPHY_CLIENTS_NUMBER 1
#define DRV_ETHPHY_INDEX 1
#define DRV_ETHPHY_PERIPHERAL_ID 1
#define DRV_ETHPHY_NEG_INIT_TMO 1
#define DRV_ETHPHY_NEG_DONE_TMO 2000
#define DRV_ETHPHY_RESET_CLR_TMO 500
#define DRV_ETHPHY_USE_DRV_MIIM true
#define TCPIP_EMAC_AUTO_FLOW_CONTROL_ENABLE true
#define TCPIP_EMAC_FLOW_CONTROL_PAUSE_BYTES 3072
#define TCPIP_EMAC_FLOW_CONTROL_FULL_WMARK 2
#define TCPIP_EMAC_FLOW_CONTROL_EMPTY_WMARK 0



/*** UDP Configuration ***/
#define TCPIP_UDP_MAX_SOCKETS 10
#define TCPIP_UDP_SOCKET_DEFAULT_TX_SIZE 512
#define TCPIP_UDP_SOCKET_DEFAULT_TX_QUEUE_LIMIT 3
#define TCPIP_UDP_SOCKET_DEFAULT_RX_QUEUE_LIMIT 3
#define TCPIP_UDP_USE_POOL_BUFFERS false
#define TCPIP_UDP_USE_TX_CHECKSUM true
#define TCPIP_UDP_USE_RX_CHECKSUM true
#define TCPIP_UDP_COMMANDS false

#define TCPIP_STACK_USE_ZEROCONF_LINK_LOCAL
#define TCPIP_ZC_LL_PROBE_WAIT 1
#define TCPIP_ZC_LL_PROBE_MIN 1
#define TCPIP_ZC_LL_PROBE_MAX 2
#define TCPIP_ZC_LL_PROBE_NUM 3
#define TCPIP_ZC_LL_ANNOUNCE_WAIT 2
#define TCPIP_ZC_LL_ANNOUNCE_NUM 2
#define TCPIP_ZC_LL_ANNOUNCE_INTERVAL 2
#define TCPIP_ZC_LL_MAX_CONFLICTS 10
#define TCPIP_ZC_LL_RATE_LIMIT_INTERVAL 60
#define TCPIP_ZC_LL_DEFEND_INTERVAL 10
#define TCPIP_ZC_LL_IPV4_LLBASE 0xa9fe0100
#define TCPIP_ZC_LL_IPV4_LLBASE_MASK 0x0000FFFF
#define TCPIP_ZC_LL_TASK_TICK_RATE 333
/*** tcpip_cmd Configuration ***/
#define TCPIP_STACK_COMMAND_ENABLE
#define TCPIP_STACK_COMMANDS_ICMP_ECHO_REQUESTS 4
#define TCPIP_STACK_COMMANDS_ICMP_ECHO_REQUEST_DELAY 1000
#define TCPIP_STACK_COMMANDS_ICMP_ECHO_TIMEOUT 5000
#define TCPIP_STACK_COMMANDS_WIFI_ENABLE false
#define TCPIP_STACK_COMMANDS_ICMP_ECHO_REQUEST_BUFF_SIZE 2000
#define TCPIP_STACK_COMMANDS_ICMP_ECHO_REQUEST_DATA_SIZE 100


/*** IPv4 Configuration ***/

/*** Network Configuration Index 0 ***/
#define TCPIP_NETWORK_DEFAULT_INTERFACE_NAME_IDX0 "PIC32INT"
#define TCPIP_IF_PIC32INT
#define TCPIP_NETWORK_DEFAULT_HOST_NAME_IDX0 "MCHPBOARD_E"
#define TCPIP_NETWORK_DEFAULT_MAC_ADDR_IDX0 0
#define TCPIP_NETWORK_DEFAULT_IP_ADDRESS_IDX0 "192.168.150.222"//"192.168.100.115"
#define TCPIP_NETWORK_DEFAULT_IP_MASK_IDX0 "255.255.255.0"
#define TCPIP_NETWORK_DEFAULT_GATEWAY_IDX0 "192.168.150.1"//"192.168.100.1"
#define TCPIP_NETWORK_DEFAULT_DNS_IDX0 "192.168.150.1"//"192.168.100.1"
#define TCPIP_NETWORK_DEFAULT_SECOND_DNS_IDX0 "0.0.0.0"
#define TCPIP_NETWORK_DEFAULT_POWER_MODE_IDX0 "full"
#define TCPIP_NETWORK_DEFAULT_INTERFACE_FLAGS_IDX0 \
             TCPIP_NETWORK_CONFIG_DHCP_CLIENT_ON |\
             TCPIP_NETWORK_CONFIG_DNS_CLIENT_ON |\
             TCPIP_NETWORK_CONFIG_IP_STATIC
#define TCPIP_NETWORK_DEFAULT_MAC_DRIVER_IDX0 DRV_ETHMAC_PIC32MACObject
#define TCPIP_NETWORK_DEFAULT_IPV6_ADDRESS_IDX0 0
#define TCPIP_NETWORK_DEFAULT_IPV6_PREFIX_LENGTH_IDX0 0
#define TCPIP_NETWORK_DEFAULT_IPV6_GATEWAY_IDX0 0
/*** USB Driver Configuration ***/


/* Enables Device Support */
#define DRV_USBFS_DEVICE_SUPPORT true

/* Disable Host Support */
#define DRV_USBFS_HOST_SUPPORT false

/* Maximum USB driver instances */
#define DRV_USBFS_INSTANCES_NUMBER 1

/* Interrupt mode enabled */
#define DRV_USBFS_INTERRUPT_MODE true


/* Number of Endpoints used */
#define DRV_USBFS_ENDPOINTS_NUMBER 3




/*** USB Device Stack Configuration ***/










/* The USB Device Layer will not initialize the USB Driver */
#define USB_DEVICE_DRIVER_INITIALIZE_EXPLICIT

/* Maximum device layer instances */
#define USB_DEVICE_INSTANCES_NUMBER 1

/* EP0 size in bytes */
#define USB_DEVICE_EP0_BUFFER_SIZE 64










/* Maximum instances of CDC function driver */
#define USB_DEVICE_CDC_INSTANCES_NUMBER 1










/* CDC Transfer Queue Size for both read and
   write. Applicable to all instances of the
   function driver */
#define USB_DEVICE_CDC_QUEUE_DEPTH_COMBINED 6



// *****************************************************************************
/* BSP Configuration Options
*/
#define BSP_OSC_FREQUENCY 8000000


// *****************************************************************************
// *****************************************************************************
// Section: Application Configuration
// *****************************************************************************
// *****************************************************************************
/*** Application Defined Pins ***/

/*** Functions for BSP_LED_1 pin ***/
#define BSP_LED_1Toggle() PLIB_PORTS_PinToggle(PORTS_ID_0, PORT_CHANNEL_D, PORTS_BIT_POS_0)
#define BSP_LED_1On() PLIB_PORTS_PinSet(PORTS_ID_0, PORT_CHANNEL_D, PORTS_BIT_POS_0)
#define BSP_LED_1Off() PLIB_PORTS_PinClear(PORTS_ID_0, PORT_CHANNEL_D, PORTS_BIT_POS_0)
#define BSP_LED_1StateGet() PLIB_PORTS_PinGetLatched(PORTS_ID_0, PORT_CHANNEL_D, PORTS_BIT_POS_0)

/*** Functions for BSP_LED_2 pin ***/
#define BSP_LED_2Toggle() PLIB_PORTS_PinToggle(PORTS_ID_0, PORT_CHANNEL_D, PORTS_BIT_POS_1)
#define BSP_LED_2On() PLIB_PORTS_PinSet(PORTS_ID_0, PORT_CHANNEL_D, PORTS_BIT_POS_1)
#define BSP_LED_2Off() PLIB_PORTS_PinClear(PORTS_ID_0, PORT_CHANNEL_D, PORTS_BIT_POS_1)
#define BSP_LED_2StateGet() PLIB_PORTS_PinGetLatched(PORTS_ID_0, PORT_CHANNEL_D, PORTS_BIT_POS_1)

/*** Functions for BSP_LED_3 pin ***/
#define BSP_LED_3Toggle() PLIB_PORTS_PinToggle(PORTS_ID_0, PORT_CHANNEL_D, PORTS_BIT_POS_2)
#define BSP_LED_3On() PLIB_PORTS_PinSet(PORTS_ID_0, PORT_CHANNEL_D, PORTS_BIT_POS_2)
#define BSP_LED_3Off() PLIB_PORTS_PinClear(PORTS_ID_0, PORT_CHANNEL_D, PORTS_BIT_POS_2)
#define BSP_LED_3StateGet() PLIB_PORTS_PinGetLatched(PORTS_ID_0, PORT_CHANNEL_D, PORTS_BIT_POS_2)

/*** Functions for BSP_SWITCH_3 pin ***/
#define BSP_SWITCH_3StateGet() PLIB_PORTS_PinGet(PORTS_ID_0, PORT_CHANNEL_D, PORTS_BIT_POS_13)

/*** Functions for BSP_SWITCH_1 pin ***/
#define BSP_SWITCH_1StateGet() PLIB_PORTS_PinGet(PORTS_ID_0, PORT_CHANNEL_D, PORTS_BIT_POS_6)

/*** Functions for BSP_SWITCH_2 pin ***/
#define BSP_SWITCH_2StateGet() PLIB_PORTS_PinGet(PORTS_ID_0, PORT_CHANNEL_D, PORTS_BIT_POS_7)


/*** Application Instance 0 Configuration ***/

//DOM-IGNORE-BEGIN
#ifdef __cplusplus
}
#endif
//DOM-IGNORE-END

#endif // _SYSTEM_CONFIG_H
/*******************************************************************************
 End of File
*/

#12
aruntkkumar
Starting Member
  • Total Posts : 35
  • Reward points : 0
  • Joined: 2012/11/22 03:54:36
  • Location: Birmingham, UK
  • Status: offline
Re: Harmony Configurator - UART to TCP/IP bridge 2019/10/11 06:50:58 (permalink)
0
I could use the Microchip Libraries for Applications v2013-06-15 TCPIP-Demo App to access the webpage where you can toggle the LEDs. The dynamic IP address starts with 169.154.XXX.XXX. However, I could not change the IP address to anything else. I was trying to make it as 192.168.XXX.XXX, from under TCPIP Config --> TCPIP ETH795.h; but not able to do so. Any suggestions?
#13
Jim Nickerson
User 452
  • Total Posts : 6265
  • Reward points : 0
  • Joined: 2003/11/07 12:35:10
  • Location: San Diego, CA
  • Status: offline
Re: Harmony Configurator - UART to TCP/IP bridge 2019/10/11 07:43:26 (permalink)
0

DHCPDisable(0);
AppConfig.MyIPAddr.v[0] = 192;
AppConfig.MyIPAddr.v[1] = 168;
AppConfig.MyIPAddr.v[2] = 0;
AppConfig.MyIPAddr.v[3] = 45;

#14
BillP
Super Member
  • Total Posts : 334
  • Reward points : 0
  • Joined: 2014/09/28 07:53:35
  • Location: CA
  • Status: offline
Re: Harmony Configurator - UART to TCP/IP bridge 2019/10/11 13:44:17 (permalink)
0
In one of your posts you claimed to be able to ping the board, just not connect to it.  In the source code you posted with that comment, you are missing any communications after the connection.  You need calls to ARRAY_PUT, ARRAY_GET etc.  When I looked at your code, you may have made a connection, but there was no send/receive communications, so how do you know the connection worked or failed?  I think you are making this too complicated.  TCP/IP communications are easier than USART links (IMHO).
#15
Jump to:
© 2019 APG vNext Commercial Version 4.5