• AVR Freaks

Hot!PIC16F628 and Ethernet Controller

Page: 12 > Showing page 1 of 2
Author
naeem1234
Super Member
  • Total Posts : 450
  • Reward points : 0
  • Joined: 2015/02/19 06:39:28
  • Location: 0
  • Status: offline
2018/08/07 00:44:49 (permalink)
0

PIC16F628 and Ethernet Controller

Hello everyone,
 
I wonder if it's possible to use a small PIC as PIC16F628 with ENC28J60 for extending Ethernet connectivity on it?
 
Your help is highly appreciated.
 
 
#1

30 Replies Related Threads

    DarioG
    Allmächtig.
    • Total Posts : 54081
    • Reward points : 0
    • Joined: 2006/02/25 08:58:22
    • Location: Oesterreich
    • Status: offline
    Re: PIC16F628 and Ethernet Controller 2018/08/07 01:07:29 (permalink)
    0
    Very-very-very complicated if not undoable Smile

    GENOVA :D :D ! GODO
    #2
    naeem1234
    Super Member
    • Total Posts : 450
    • Reward points : 0
    • Joined: 2015/02/19 06:39:28
    • Location: 0
    • Status: offline
    Re: PIC16F628 and Ethernet Controller 2018/08/07 01:30:48 (permalink)
    0
    DarioG
    Very-very-very complicated if not undoable Smile




    Just for the sake of doing it.. can you suggest what would be a step 1?
     
    #3
    DarioG
    Allmächtig.
    • Total Posts : 54081
    • Reward points : 0
    • Joined: 2006/02/25 08:58:22
    • Location: Oesterreich
    • Status: offline
    Re: PIC16F628 and Ethernet Controller 2018/08/07 01:33:09 (permalink)
    0
    Ok,
    well first make up the hardware (SPI);
    then I'd focus upon a simple fixed frame, say a "PING request": you will hardcode MAC & IP addresses in Flash, and then fill the ENC registers and go..
     
    Receiving is something you could consider later!

    GENOVA :D :D ! GODO
    #4
    Jerry Messina
    Super Member
    • Total Posts : 373
    • Reward points : 0
    • Joined: 2003/11/07 12:35:12
    • Status: offline
    Re: PIC16F628 and Ethernet Controller 2018/08/07 01:35:49 (permalink)
    +3 (3)
    Step 1 would be get a pic with more memory
     
    #5
    naeem1234
    Super Member
    • Total Posts : 450
    • Reward points : 0
    • Joined: 2015/02/19 06:39:28
    • Location: 0
    • Status: offline
    Re: PIC16F628 and Ethernet Controller 2018/08/07 01:45:41 (permalink)
    0
    Jerry Messina
    Step 1 would be get a pic with more memory
     




    Any idea what min RAM memory would be enough? 
    #6
    katela
    Super Member
    • Total Posts : 1228
    • Reward points : 0
    • Joined: 2013/06/11 05:25:18
    • Location: South Africa
    • Status: online
    Re: PIC16F628 and Ethernet Controller 2018/08/07 04:03:39 (permalink)
    0
    I'm sure you have in mind what you want to send/receive with Ethernet controller. Not just for the sake of doing it otherwise follow DarioG advice (#4). Focus on a PING request. 
    If you want to process some meaningful data, you'll need some RAM.
    How about you explain what you have in mind then you might get advice on RAM size.

    Free online Microcontroller Tutorials and Projects for Hobbyists and students. From beginners to advanced. Website: www.studentcompanion.co.za
    YouTube Tutorials: https://www.youtube.com/StudentCompanionSA
    #7
    naeem1234
    Super Member
    • Total Posts : 450
    • Reward points : 0
    • Joined: 2015/02/19 06:39:28
    • Location: 0
    • Status: offline
    Re: PIC16F628 and Ethernet Controller 2018/08/07 04:40:48 (permalink)
    0
    katela
    I'm sure you have in mind what you want to send/receive with Ethernet controller. Not just for the sake of doing it otherwise follow DarioG advice (#4). Focus on a PING request. 
    If you want to process some meaningful data, you'll need some RAM.
    How about you explain what you have in mind then you might get advice on RAM size.




     
    I just need to prepare a very very simple demo by when I can show a small PIC16F628 could be used with the ENC28J60 to connect to the Internet.. PING would be perfect but wont it need to implement both SEND and RECEIVE functionality?
    Can there be any more simpler thing just for the sake of the demo in which just only SEND or RECEIVE could work?
    #8
    qɥb
    Monolothic Member
    • Total Posts : 3332
    • Reward points : 0
    • Joined: 2017/09/09 05:07:30
    • Location: Jupiter
    • Status: offline
    Re: PIC16F628 and Ethernet Controller 2018/08/07 05:42:49 (permalink)
    +1 (1)
    Send and receive what?
    The Internet is not a serial port, you can't just dump random size bocks of raw data to it.
    If you want to connect to the Internet, then you could be receiving frames up to 1500 bytes long.
    A PIC16F628 simply does not have enough RAM to handle this, as people have been trying to tell you.
     

    This forum is mis-configured so it only works correctly if you access it via https protocol.
    The Microchip website links to it using http protocol. Will they ever catch on?
    PicForum "it just works"
    #9
    malaugh
    Super Member
    • Total Posts : 392
    • Reward points : 0
    • Joined: 2011/03/31 14:04:42
    • Location: San Diego
    • Status: offline
    Re: PIC16F628 and Ethernet Controller 2018/08/07 07:36:35 (permalink)
    +1 (1)
    AS the other posters have said, this CPU is too small to handle ethernet communications with the ENC28J60.  THis chip requires the TCP-IP stack to be hosted on the CPU, Microchip supplies an MLA stack that does the job, but you will need much more memory than the PIC16F628 can provide.
     
    Another option you may want to consider, although there is not guarantee that it will work, is to use a chip with a built in TCP-IP stack like the Wiznet w5500.  This chip has build in buffers for the TCP-IP packets, but it will still be very challenging to use it with such a small amount of RAM.
     
    #10
    naeem1234
    Super Member
    • Total Posts : 450
    • Reward points : 0
    • Joined: 2015/02/19 06:39:28
    • Location: 0
    • Status: offline
    Re: PIC16F628 and Ethernet Controller 2018/08/07 07:43:27 (permalink)
    0
    qɥb
    Send and receive what?
    The Internet is not a serial port, you can't just dump random size bocks of raw data to it.
    If you want to connect to the Internet, then you could be receiving frames up to 1500 bytes long.
    A PIC16F628 simply does not have enough RAM to handle this, as people have been trying to tell you.
     




     
    Let us say my payload data is only 1-byte for PUSH_BUTTON_STATUS. So if it is HIGH i send ASCII 'H' and if LOW i send ASCII 'L' and I only read the button every once in a second.
     
    I am not interested in receiving any data from the internet at the moment.. or from the connected server unless it is required to establish the communication.
     
    I will go high on the selection of the PIC MCU, maybe use PIC18F later, due to RAM requirements as everyone here have pointed out. But since this is my self-learning exercise so I am interested to experience it practically from bottom-up.
     
    One more thing I wanted to know is that.. which of the 2 would require lesser RAM, a Client or a Server if implemented on a PIC MCU?
    #11
    malaugh
    Super Member
    • Total Posts : 392
    • Reward points : 0
    • Joined: 2011/03/31 14:04:42
    • Location: San Diego
    • Status: offline
    Re: PIC16F628 and Ethernet Controller 2018/08/07 08:13:54 (permalink)
    +1 (1)
    Your are missing the main point. 
     
    The ENC28J60 is not a full TCP-IP solution.  To send data through Ethernet, the data needs to go through a TCP-IP stack, then through a PHY, then out through the cable.  The ENC28J60 only provides the PHY function, the TCP-IP stack needs to be hosted on the CPU.   A TCP-IP stack is not a trivial piece of firmware, and the CPU you are planning on using is way to small to host a PCP-IP stack.
    #12
    katela
    Super Member
    • Total Posts : 1228
    • Reward points : 0
    • Joined: 2013/06/11 05:25:18
    • Location: South Africa
    • Status: online
    Re: PIC16F628 and Ethernet Controller 2018/08/07 08:18:37 (permalink)
    0
    naeem1234
     
     
    Let us say my payload data is only 1-byte for PUSH_BUTTON_STATUS. So if it is HIGH i send ASCII 'H' and if LOW i send ASCII 'L' and I only read the button every once in a second.


    It's not about only sending 1 byte data, the way Ethernet work, It's more than 1 byte that will be sent.
    There are some more information that need to be included in each packet:  Ethernet header, which contains destination and source MAC addresses ,payload data including any headers for other protocols (for example, Internet Protocol), some error checking ... 
    You'll need a sizable buffer for all of these.
    Did you read the  PIC16F628 datasheet and see its RAM size?
    Even in terms of Flash memory, The lite version of the stack, TCP/IP Lite stack will require ≥8KB of Flash (UDP only) and ≥16KB of Flash (TCP/IP) which I doubt your PIC will even have. The full stack requirements might be even more demanding.
    post edited by katela - 2018/08/07 08:31:39

    Free online Microcontroller Tutorials and Projects for Hobbyists and students. From beginners to advanced. Website: www.studentcompanion.co.za
    YouTube Tutorials: https://www.youtube.com/StudentCompanionSA
    #13
    malaugh
    Super Member
    • Total Posts : 392
    • Reward points : 0
    • Joined: 2011/03/31 14:04:42
    • Location: San Diego
    • Status: offline
    Re: PIC16F628 and Ethernet Controller 2018/08/07 10:06:01 (permalink)
    +1 (1)
    So your problem is
    1) You need your CPU to host a TCP-IP stack
    2) Your CPU does not have enough ROM or RAM to host a TCP-IP stack
     
    The solution is
     
    1) Pick a different CPU 
    or
    2) Use an ethernet chip that has the TCP-IP stack on board
     
    for 2) look at the Wiznet w5500
     
     
     
     
    post edited by malaugh - 2018/08/07 15:04:15
    #14
    DarioG
    Allmächtig.
    • Total Posts : 54081
    • Reward points : 0
    • Joined: 2006/02/25 08:58:22
    • Location: Oesterreich
    • Status: offline
    Re: PIC16F628 and Ethernet Controller 2018/08/07 10:09:29 (permalink)
    0
    Yep, 1 byte payload inside a short UDP packet - I meant something like that Smile
     
    Not much more, anyway...

    GENOVA :D :D ! GODO
    #15
    katela
    Super Member
    • Total Posts : 1228
    • Reward points : 0
    • Joined: 2013/06/11 05:25:18
    • Location: South Africa
    • Status: online
    Re: PIC16F628 and Ethernet Controller 2018/08/07 10:25:29 (permalink)
    +1 (1)
    But still...

    Free online Microcontroller Tutorials and Projects for Hobbyists and students. From beginners to advanced. Website: www.studentcompanion.co.za
    YouTube Tutorials: https://www.youtube.com/StudentCompanionSA
    #16
    Jim Nickerson
    User 452
    • Total Posts : 5885
    • Reward points : 0
    • Joined: 2003/11/07 12:35:10
    • Location: San Diego, CA
    • Status: online
    Re: PIC16F628 and Ethernet Controller 2018/08/07 10:34:07 (permalink)
    0
    I think maybe the ATWINC1500 might be suitable for this task.
    At this price it is an alternative to the ESP8266...
     

    Attached Image(s)

    #17
    DarioG
    Allmächtig.
    • Total Posts : 54081
    • Reward points : 0
    • Joined: 2006/02/25 08:58:22
    • Location: Oesterreich
    • Status: offline
    Re: PIC16F628 and Ethernet Controller 2018/08/07 10:43:36 (permalink)
    0
    of course, the "all included" modules will make this PIC work with Ethernet. Point is, if the OP wanted to make a "working proof of concept" - with limitations...

    GENOVA :D :D ! GODO
    #18
    naeem1234
    Super Member
    • Total Posts : 450
    • Reward points : 0
    • Joined: 2015/02/19 06:39:28
    • Location: 0
    • Status: offline
    Re: PIC16F628 and Ethernet Controller 2018/08/07 11:07:22 (permalink)
    0
    DarioG
    Yep, 1 byte payload inside a short UDP packet - I meant something like that Smile
     
    Not much more, anyway...




    This looks like a good pointer.. btw should i implement UDP Server or UDP Client on a memory constrained PIC?
    #19
    DarioG
    Allmächtig.
    • Total Posts : 54081
    • Reward points : 0
    • Joined: 2006/02/25 08:58:22
    • Location: Oesterreich
    • Status: offline
    Re: PIC16F628 and Ethernet Controller 2018/08/07 11:11:14 (permalink)
    0
    client, I'd say

    GENOVA :D :D ! GODO
    #20
    Page: 12 > Showing page 1 of 2
    Jump to:
    © 2019 APG vNext Commercial Version 4.5