Building an ENC28J60 Ethernet Dev Board - Parts List Print E-mail
User Rating: / 61
PoorBest 
Written by Ian Horsley   
Sunday, 26 February 2006
Article Index
Parts List
Parts List
Software

The Software

After downloading, open the Microchip TCP/IP Stack in a C complier. I used the Microchip C18 Complier.  For this development hardware the mpnicpg.mcp project  must be used. The 'nic' means that the stack is setup for use with an ethernet controller and not a connection via slip and the 'pg' indicates that the webpages will be stored in the program memory rather that in an external eeprom.

There are 4 changes that need to be made for the stack to work with the hardware.

  1. In complier.h the clock frequency of the oscilator used by the pic needs to be changed to 24Mhz.
    #define CLOCK_FREQ              (24000000)      // Hz
  2. In the hardware definitions in enc28j60.c the MCP_RESET pin must be changed to RD3
    #define MCP_RESET_TRIS (TRISD_RD3)
    #define MCP_RESET_IO (LATD3)
  3. The linker script should be changed to 18f4620 and in 'Configure', 'Select Device' the 18f4620 selected
  4. In the 'Configure', 'Configuration Bits' the Oscillator should be set to 'HS' for the 24Mhz crystal in the circuit.

Next program the PIC with your favourite PIC programmer and drop it into the circuit. This circuit also supports "In Circuit Serial Programming", ICSP. If you want to use ICSP to program the PIC, connect your programmer up to the Vdd, Vss, PGC, PGD and MCLR pins of the PIC. I found I could only program the PIC with the ethernet cable disconnected. 

You will need a DHCP server on your network for this standard software setup to aquire an IP address. Once the PIC has booted up and has got an IP address from the DHCP server it sends a broadcast packet to UDP port 30303 to announce its IP address. The program MCHPDetect (included with the stack) will recieve and display these announcements, if you are on the same subnet as the PIC.

Hope you find this article useful and I haven't put in too many errors. If you have any questions feel free to ask them in the comments section.

Ian Horsley

Useful Links

Microchip TCP/IP Stack (with ENC)

AN833 - Microchip TCP/IP Stack Application Note

AN833 - Microchip TCP/IP Stack Source Code

Microchip TCP/IP Software Tools

PIC 18F4620, 18LF4620

Microchip ENC28J60 datasheets

Hex Files

basic_dhcp_18F4620_24Mhz_ledD0.hex

Discussion 

Discuss this article on the forums. (89 posts)



Last Updated ( Monday, 13 March 2006 )