LockedPIC32 Ethernet To Serial

Page: 12 > Showing page 1 of 2
Author
trpa0701
Starting Member
  • Total Posts : 31
  • Reward points : 0
  • Joined: 2010/10/02 07:33:36
  • Location: 0
  • Status: offline
2010/10/02 07:44:34 (permalink)
0

PIC32 Ethernet To Serial

I have the PIC32 Ethernet starter kit and expansion board and was hoping someone might have the code to convert serial to ethernet / ethernet to serial. I looked at the sample code and it doesn't look horrible but I'm assuming someone has already done this and maybe I could save a few days worth of time. I am pretty much just trying to do this (create an ethernet to serial gateway):

http://www.microchip.com/...&dDocName=en549179

Preferably, I would like to have a 6Mbps baud rate as well. Thanks!
#1

35 Replies Related Threads

    bkamen
    Super Member
    • Total Posts : 822
    • Reward points : 0
    • Joined: 2010/01/26 12:39:27
    • Location: Central Illinois, USA
    • Status: offline
    Re:PIC32 Ethernet To Serial 2010/10/02 09:50:01 (permalink)
    0
    Microchip already has this functionality built into their library. Just turn on a few #defines and go.

    How much easier do you need?

    As for the 6Mb/s, looks like the PIC32's will handle that.. So you'll need a serial->ethernet bridge using one of those.

    Crack out the datasheets!
    #2
    trpa0701
    Starting Member
    • Total Posts : 31
    • Reward points : 0
    • Joined: 2010/10/02 07:33:36
    • Location: 0
    • Status: offline
    Re:PIC32 Ethernet To Serial 2010/10/02 10:58:35 (permalink)
    0
    Which library might this be? I guess I'm too new to PIC32 to understand what people mean when they tell me it's "so easy" rather than telling me how to do it...
    #3
    bkamen
    Super Member
    • Total Posts : 822
    • Reward points : 0
    • Joined: 2010/01/26 12:39:27
    • Location: Central Illinois, USA
    • Status: offline
    Re:PIC32 Ethernet To Serial 2010/10/02 11:07:29 (permalink)
    0
    Look here: http://ww1.microchip.com/downloads/en/DeviceDoc/MCHP_App_Lib_v2010_08_04_Installer.zip

    When you download and install it, look here:

    C:\Microchip Solutions\TCPIP Demo App

     In this file: TCPIPConfig.h

    and then scan for this #define: STACK_USE_UART2TCP_BRIDGE

    In the meanwhile, prepare to do a bunch of reading.

    Wasn't that easy? :D

    Cheers,

     -Ben

     
    #4
    trpa0701
    Starting Member
    • Total Posts : 31
    • Reward points : 0
    • Joined: 2010/10/02 07:33:36
    • Location: 0
    • Status: offline
    Re:PIC32 Ethernet To Serial 2010/10/02 11:19:13 (permalink)
    0
    Cool, that helped. Thanks. But in my post, I asked if someone had already done this so that I wouldn't have to "do a bunch of reading." mr green
    #5
    bkamen
    Super Member
    • Total Posts : 822
    • Reward points : 0
    • Joined: 2010/01/26 12:39:27
    • Location: Central Illinois, USA
    • Status: offline
    Re:PIC32 Ethernet To Serial 2010/10/02 11:51:31 (permalink)
    0
    And I'm saying, "Yes" -- someone has. Microchip.

    But you'll still want to do some reading.

    If you want someone to "do it for you" -- you'll find plenty of consultants on here (including me) that would be happy to do the work for you.

    It's how we make a living. :D

    Considering how much of the pain Microchip has removed for you, consider yourself lucky with only having to do some reading and not having to write it from scratch.

    Best Regards,

     -Ben
    #6
    trpa0701
    Starting Member
    • Total Posts : 31
    • Reward points : 0
    • Joined: 2010/10/02 07:33:36
    • Location: 0
    • Status: offline
    Re:PIC32 Ethernet To Serial 2010/10/02 13:52:14 (permalink)
    0
    Ok, well, considering I'm broke, it's not likely I'm going to pay someone to do it for me. However, considering I'm on a forum dedicated to PIC, I would hope SOMEONE would be willing to help me at least figure it out a bit quicker. I don't know what "reading" you're even talking about. There's not much documentation for this. ANYWAYS, I went into HardwareProfile.h and uncommented this:

    #define PIC32_ENET_SK_DM320004        // PIC32MX795F512L Ethernet Starter Kit board with embedded Ethernet controller

    Then, I went into TCPIPCONFIG.h and it now looks like this:

    //#define STACK_USE_UART                    // Application demo using UART for IP address display and stack configuration
    #define STACK_USE_UART2TCP_BRIDGE        // UART to TCP Bridge application example
    //#define STACK_USE_IP_GLEANING
    //#define STACK_USE_ICMP_SERVER            // Ping query and response capability
    //#define STACK_USE_ICMP_CLIENT            // Ping transmission capability
    //#define STACK_USE_HTTP_SERVER            // Old HTTP server
    //#define STACK_USE_HTTP2_SERVER            // New HTTP server with POST, Cookies, Authentication, etc.
    //#define STACK_USE_SSL_SERVER            // SSL server socket support (Requires SW300052)
    //#define STACK_USE_SSL_CLIENT            // SSL client socket support (Requires SW300052)
    //#define STACK_USE_AUTO_IP               // Dynamic link-layer IP address automatic configuration protocol
    //#define STACK_USE_DHCP_CLIENT            // Dynamic Host Configuration Protocol client for obtaining IP address and other parameters
    //#define STACK_USE_DHCP_SERVER            // Single host DHCP server
    //#define STACK_USE_FTP_SERVER            // File Transfer Protocol (old)
    //#define STACK_USE_SMTP_CLIENT            // Simple Mail Transfer Protocol for sending email
    //#define STACK_USE_SNMP_SERVER            // Simple Network Management Protocol v2C Community Agent
    //#define STACK_USE_TFTP_CLIENT            // Trivial File Transfer Protocol client
    //#define STACK_USE_GENERIC_TCP_CLIENT_EXAMPLE    // HTTP Client example in GenericTCPClient.c
    //#define STACK_USE_GENERIC_TCP_SERVER_EXAMPLE    // ToUpper server example in GenericTCPServer.c
    //#define STACK_USE_TELNET_SERVER            // Telnet server
    //#define STACK_USE_ANNOUNCE                // Microchip Embedded Ethernet Device Discoverer server/client
    //#define STACK_USE_DNS                    // Domain Name Service Client for resolving hostname strings to IP addresses
    //#define STACK_USE_DNS_SERVER            // Domain Name Service Server for redirection to the local device
    //#define STACK_USE_NBNS                    // NetBIOS Name Service Server for repsonding to NBNS hostname broadcast queries
    //#define STACK_USE_REBOOT_SERVER            // Module for resetting this PIC remotely.  Primarily useful for a Bootloader.
    //#define STACK_USE_SNTP_CLIENT            // Simple Network Time Protocol for obtaining current date/time from Internet
    //#define STACK_USE_UDP_PERFORMANCE_TEST    // Module for testing UDP TX performance characteristics.  NOTE: Enabling this will cause a huge amount of UDP broadcast packets to flood your network on the discard port.  Use care when enabling this on production networks, especially with VPNs (could tunnel broadcast traffic across a limited bandwidth connection).
    //#define STACK_USE_TCP_PERFORMANCE_TEST    // Module for testing TCP TX performance characteristics
    //#define STACK_USE_DYNAMICDNS_CLIENT        // Dynamic DNS client updater module
    //#define STACK_USE_BERKELEY_API            // Berekely Sockets APIs are available
    //#define STACK_USE_ZEROCONF_LINK_LOCAL    // Zeroconf IPv4 Link-Local Addressing
    //#define STACK_USE_ZEROCONF_MDNS_SD        // Zeroconf mDNS and mDNS service discovery


    I compiled it and it errored out. Which of these (in tcpipconfig.h) need to be commented out and which shouldn't be?

    I already did all of this on a Luminary Micro board with a TI chip and got it to work, it just wasn't as fast as I would like (680Kbps). I'm hoping this will push out speeds closer to 5Mbps... any thoughts on that?
    #7
    Jim Nickerson
    User 452 _
    • Total Posts : 4345
    • Reward points : 0
    • Joined: 2003/11/07 12:35:10
    • Location: San Diego, CA
    • Status: offline
    Re:PIC32 Ethernet To Serial 2010/10/02 16:43:10 (permalink)
    0
    I found using "C:\Microchip Solutions\Microchip\TCPIP Stack\Utilities\TCPIPConfig.exe" is useful to remove functions you do not want and still have the stack compile, until you learn the stack and all the interactions between the functions.
    #8
    bkamen
    Super Member
    • Total Posts : 822
    • Reward points : 0
    • Joined: 2010/01/26 12:39:27
    • Location: Central Illinois, USA
    • Status: offline
    Re:PIC32 Ethernet To Serial 2010/10/02 16:43:24 (permalink)
    0
    You haven't described what you want to do with the bridge... but why does it error our? what is the error it gives you?


    #9
    bkamen
    Super Member
    • Total Posts : 822
    • Reward points : 0
    • Joined: 2010/01/26 12:39:27
    • Location: Central Illinois, USA
    • Status: offline
    Re:PIC32 Ethernet To Serial 2010/10/02 16:48:31 (permalink)
    0
    JANickerson

    I found using "C:\Microchip Solutions\Microchip\TCPIP Stack\Utilities\TCPIPConfig.exe" is useful to remove functions you do not want and still have the stack compile, until you learn the stack and all the interactions between the functions.


    Ha.. I completely forget that tool exists since I'm so used to just tweaking the .H file myself.

    That works too. Do what he said. :D
    #10
    bkamen
    Super Member
    • Total Posts : 822
    • Reward points : 0
    • Joined: 2010/01/26 12:39:27
    • Location: Central Illinois, USA
    • Status: offline
    Re:PIC32 Ethernet To Serial 2010/10/02 16:49:30 (permalink)
    0
    trpa0701
    I already did all of this on a Luminary Micro board with a TI chip and got it to work, it just wasn't as fast as I would like (680Kbps). I'm hoping this will push out speeds closer to 5Mbps... any thoughts on that?


    What was the limit of the TI chip? Were the data routines DMA enabled and IRQ serviced?

     -Ben
    #11
    trpa0701
    Starting Member
    • Total Posts : 31
    • Reward points : 0
    • Joined: 2010/10/02 07:33:36
    • Location: 0
    • Status: offline
    Re:PIC32 Ethernet To Serial 2010/10/02 21:42:55 (permalink)
    0
    Thanks so much! I'll try that tomorrow.
    #12
    trpa0701
    Starting Member
    • Total Posts : 31
    • Reward points : 0
    • Joined: 2010/10/02 07:33:36
    • Location: 0
    • Status: offline
    Re:PIC32 Ethernet To Serial 2010/10/02 21:54:13 (permalink)
    0
    I want to be able to connect an ethernet to a board, get UART data out of it, connect that UART to another IDENTICAL board, which will then take that data, place it back into packets and send them to my computer. I want it to pretty much just act as an ethernet wire. The error was something like... "txtris not recognized" and "rxtris not recognized blah blah first use". I'll give you the exact error tomorrow if you'd like. I found out that if I don't uncomment the line previously described in the HardwareProfile file, it didn't give me the error. And from reading it, it seems like it automatically tries to recognize what board I have. However, I hooked it up to an oscilloscope and still didn't see anything coming out of the UART2. I'll try that other method tomorrow. Also, the limitations that I eventually found from the Luminary Micro board were that it 1) had a 50MHz processor and took too long to take packets off of the ethernet buffer and convert it to 8 bit and send it over UART which 2) maxed out at 3MHz baud rate. I was hoping the pic32 would be much better since it has an 80MHz processor and 20MHz max Baud rate. Thanks for the help.

    -Paul
    #13
    trpa0701
    Starting Member
    • Total Posts : 31
    • Reward points : 0
    • Joined: 2010/10/02 07:33:36
    • Location: 0
    • Status: offline
    Re:PIC32 Ethernet To Serial 2010/10/03 06:26:42 (permalink)
    0
    I tried what you said... went through and unchecked everything within the TCPIP configuration wizard except for serial to ethernet bridge, compiled the program, and ran it, but I'm still getting nothing out of UART2... any suggestions? Thanks!
    #14
    Jim Nickerson
    User 452 _
    • Total Posts : 4345
    • Reward points : 0
    • Joined: 2003/11/07 12:35:10
    • Location: San Diego, CA
    • Status: offline
    Re:PIC32 Ethernet To Serial 2010/10/03 07:27:28 (permalink)
    0
    I am glad to hear the project now compiles.
    If you would now read the UART2TCPBridge.c file ( in the Source Files, TCPIP Stack folder in the Project window ) you will find the information you are asking for, including the port, baud rate and how to make the app a server or client.
    #15
    trpa0701
    Starting Member
    • Total Posts : 31
    • Reward points : 0
    • Joined: 2010/10/02 07:33:36
    • Location: 0
    • Status: offline
    Re:PIC32 Ethernet To Serial 2010/10/03 08:37:18 (permalink)
    0
    Thanks so much. I've been reading over UART2TCPBridge.c but it isn't much help to me (This is really my first project working with anything that has to do with the internet). I have a few questions about the code. What is UART2TCPBRIDGE_PORT used for and why is it defaulted to 9761? Also, should I be a client or server for the application that I'm trying to run? I'm assuming client, but from what I've read on forums, people have an easier time as a server. And if I want to be a server, I just leave '#define USE_REMOTE_TCP_SERVER    "192.168.1.12"' commented out? Otherwise, uncomment it? Sorry, I'm pretty new to this... And thanks again. You rock.
    #16
    terrorgen
    New Member
    • Total Posts : 2
    • Reward points : 0
    • Joined: 2010/10/03 08:49:27
    • Location: 0
    • Status: offline
    Re:PIC32 Ethernet To Serial 2010/10/03 08:52:12 (permalink)
    0
    paul you might need to change the default address hidden down under that TCPIPConfig.h too...
    #17
    Jim Nickerson
    User 452 _
    • Total Posts : 4345
    • Reward points : 0
    • Joined: 2003/11/07 12:35:10
    • Location: San Diego, CA
    • Status: offline
    Re:PIC32 Ethernet To Serial 2010/10/03 09:07:29 (permalink)
    0
    What is the specific end use for this project?
    #18
    mikro
    New Member
    • Total Posts : 20
    • Reward points : 0
    • Joined: 2010/10/03 10:38:57
    • Location: 0
    • Status: offline
    Re:PIC32 Ethernet To Serial 2010/10/03 10:56:53 (permalink)
    0
    trpa0701

    I have the PIC32 Ethernet starter kit and expansion board and was hoping someone might have the code to convert serial to ethernet / ethernet to serial. I looked at the sample code and it doesn't look horrible but I'm assuming someone has already done this and maybe I could save a few days worth of time. I am pretty much just trying to do this (create an ethernet to serial gateway):

    http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=2860&dDocName=en549179

    Preferably, I would like to have a 6Mbps baud rate as well. Thanks!


    Hello all
     
    I have tried to re-configure the new IP into TCPIPConfig.h which is "192.168.x.xx" instead the default one come together with Microchip code and enable-->  "# define STACK_USE_UART2TCP_BRIDGE" and disable --> "#define STACK_USE_HTTP2_SERVER" I expected to "off" port 80 which is running for web application and expect to "open" port 9761 for TCP<-->serial PORT. Complied is done  successfully BUT still have problem with telnet 192.168.x.xx 9761, this means that the port is not opend yet. I do not see also the different when I enable/disable (to operate as server or client) --> #define USE_REMOTE_TCP_SERVER "192.168.2.50" or even change to 192.168.x.x  instead according to TCPIPConfig.h  Can someone advice me please? Thanks
     
    #define STACK_USE_UART2TCP_BRIDGE  // UART to TCP Bridge application example
    //#define STACK_USE_IP_GLEANING
    #define STACK_USE_ICMP_SERVER
    #define STACK_USE_ICMP_CLIENT
    //#define STACK_USE_HTTP_SERVER   // Old HTTP server
    //#define STACK_USE_HTTP2_SERVER   // New HTTP server with POST, Cookies, Authentication, etc.
    //#define STACK_USE_SSL_SERVER   // SSL server socket support (Requires SW300052)
    //#define STACK_USE_SSL_CLIENT   // SSL client socket support (Requires SW300052)
    //#define STACK_USE_DHCP_CLIENT
    //#define STACK_USE_DHCP_SERVER
    //#define STACK_USE_FTP_SERVER
    //#define STACK_USE_SMTP_CLIENT
    //#define STACK_USE_SNMP_SERVER
    //#define STACK_USE_TFTP_CLIENT
    //#define STACK_USE_GENERIC_TCP_CLIENT_EXAMPLE // HTTP Client example in GenericTCPClient.c
    #define STACK_USE_GENERIC_TCP_SERVER_EXAMPLE // ToUpper server example in GenericTCPServer.c
    //#define STACK_USE_TELNET_SERVER   // Telnet server
    #define STACK_USE_ANNOUNCE    // Microchip Embedded Ethernet Device Discoverer server/client
    #define STACK_USE_DNS     // Domain Name Service Client
    #define STACK_USE_NBNS     // NetBIOS Name Service Server
    //#define STACK_USE_REBOOT_SERVER   // Module for resetting this PIC remotely.  Primarily useful for a Bootloader.
    //#define STACK_USE_SNTP_CLIENT   // Simple Network Time Protocol for obtaining current date/time from Internet
    //#define STACK_USE_UDP_PERFORMANCE_TEST // Module for testing UDP TX performance characteristics.  NOTE: Enabling this will cause a huge amount of UDP broadcast packets to flood your network on various ports.  Use care when enabling this on production networks, especially with VPNs (could tunnel broadcast traffic across a limited bandwidth connection).
    //#define STACK_USE_TCP_PERFORMANCE_TEST // Module for testing TCP TX performance characteristics
    //#define STACK_USE_DYNAMICDNS_CLIENT  // Dynamic DNS client module
    #define STACK_USE_BERKELEY_API   // Berekely Sockets APIs are used
    #19
    Jim Nickerson
    User 452 _
    • Total Posts : 4345
    • Reward points : 0
    • Joined: 2003/11/07 12:35:10
    • Location: San Diego, CA
    • Status: offline
    Re:PIC32 Ethernet To Serial 2010/10/03 11:18:57 (permalink)
    0
    mikro Are you working on the same project as trpa0701 ?
    #20
    Page: 12 > Showing page 1 of 2
    Jump to:
    © 2017 APG vNext Commercial Version 4.5