Difference between revisions of "Ethernet Module"
Jump to navigation
Jump to search
Line 1: | Line 1: | ||
==Introduction== | ==Introduction== | ||
− | *This project aims to develop an Ethernet Module, to be used in conjunction with a 8/16 bits embedded system such as [http://opencircuits.com/DsPIC30F_5011_Development_Board | + | *This project aims to develop an Ethernet Module, to be used in conjunction with a 8/16 bits embedded system such as the [http://opencircuits.com/DsPIC30F_5011_Development_Board dsPic33F development board]. |
*The entire Ethernet Module consists of: | *The entire Ethernet Module consists of: | ||
#Hardware: a LAN card based on [http://www.davicom.com.tw/eng/index.htm Davicom] DM9000A chip | #Hardware: a LAN card based on [http://www.davicom.com.tw/eng/index.htm Davicom] DM9000A chip | ||
Line 13: | Line 13: | ||
*[http://www.davicom.com.tw/big5/download/ApplicationNote/DM9000A%20Application%20Notes%20Ver%201_20_101906.pdf Application Note] | *[http://www.davicom.com.tw/big5/download/ApplicationNote/DM9000A%20Application%20Notes%20Ver%201_20_101906.pdf Application Note] | ||
*[http://www.davicom.com.tw/eng/download/Driver/driver_9000.htm DM9000A Official Drivers] | *[http://www.davicom.com.tw/eng/download/Driver/driver_9000.htm DM9000A Official Drivers] | ||
+ | ====dsPic33F Development Board==== | ||
+ | *[http://opencircuits.com/DsPIC30F_5011_Development_Board dsPic33F Development Board] | ||
====uIP==== | ====uIP==== | ||
*[http://www.sics.se/~adam/uip/index.php/Main_Page uIP Description] | *[http://www.sics.se/~adam/uip/index.php/Main_Page uIP Description] | ||
Line 21: | Line 23: | ||
*[http://savannah.nongnu.org/projects/lwip/ lwIP Description] | *[http://savannah.nongnu.org/projects/lwip/ lwIP Description] | ||
*[http://www.nongnu.org/lwip/ Documentation] | *[http://www.nongnu.org/lwip/ Documentation] | ||
− | |||
====HTML==== | ====HTML==== | ||
*[http://www.w3schools.com/default.asp W3 Schools]: Learning how to write HTML and JavaScript | *[http://www.w3schools.com/default.asp W3 Schools]: Learning how to write HTML and JavaScript | ||
Line 61: | Line 62: | ||
==Software Driver== | ==Software Driver== | ||
− | *Download [http://chungyan5.no-ip.org/vc/tags/1.09. | + | *Download [http://chungyan5.no-ip.org/vc/tags/1.09.05/demo_posix/dspic/drivers/dm9000a.c?root=freertos_posix&view=markup here] |
*Base on [http://www.freertos.org/ FreeRTOS] and [http://opencircuits.com/DsPIC30F_5011_Development_Board dsPIC33 platform] | *Base on [http://www.freertos.org/ FreeRTOS] and [http://opencircuits.com/DsPIC30F_5011_Development_Board dsPIC33 platform] | ||
*Using POSIX-like API: | *Using POSIX-like API: | ||
Line 121: | Line 122: | ||
//you can print your ip addr to your console/lcd to see if you get a valid ip address | //you can print your ip addr to your console/lcd to see if you get a valid ip address | ||
} | } | ||
− | *An example of using DHCP Client in the | + | *An example of using DHCP Client in the dsPic33F development board can be found [http://chungyan5.no-ip.org/vc/tags/1.09.05/demo_posix/common/app_http.c?root=freertos_posix&view=markup here]. |
===Web Server=== | ===Web Server=== |
Revision as of 01:03, 16 August 2007
Contents
Introduction
- This project aims to develop an Ethernet Module, to be used in conjunction with a 8/16 bits embedded system such as the dsPic33F development board.
- The entire Ethernet Module consists of:
Useful Links
DM9000A
- DM9000A Description
- DM9000A Datasheet
- Application Circuit
- Layout Guidelines
- Application Note
- DM9000A Official Drivers
dsPic33F Development Board
uIP
lwIP
HTML
- W3 Schools: Learning how to write HTML and JavaScript
- Nvu: Open source HTML Editor
SNMP
Hardware
Component List
Special Item | Description | Quantity |
---|---|---|
DM9000AEP | Ethernet Controller | 1 |
HR911102A | RJ45 Connector with Integrated Magnetics for 10/100 Base-TX | 1 |
93LC46B-I/SN | 1K Serial EEPROM | 1 (Optional) |
25MHz Crystal | Crystal | 1 |
22pF | For Crystal Use | 2 |
220uF | For RXVDD25/TXVDD25 | 1 |
49.9ohm | For RX+/RX-/TX+/TX- | 4 |
6.8kohm | For BGRES/BGGND | 1 |
510ohm | For LEDs | 2 |
Circuit and PCB
in gEDA format and its gEDA sym and footprints
Software Driver
- Download here
- Base on FreeRTOS and dsPIC33 platform
- Using POSIX-like API:
- int dmfe_open(int flags): initialize the Ethernet controller for 10MHz Half-Duplex
- int dmfe_close(): turn off the PHY layer
- int dmfe_read(void): copy a packet to the default buffer
- int dmfe_write(unsigned char device, unsigned char *buf, int count): copy count bytes of the data from buf and transmit
- void dmfe_interrupt(void): process the transmit interrupt from DM9000A
TCP/IP Stack
- uIP and lwIP are light weight TCP/IP Stack designed for 8-bit/16-bit embedded systems.
uIP
- Develped by Adam Dunkels of the Networked Embedded Systems group at the Swedish Institute of Computer Science.
- uIP is under the BSD-style license
lwIP
- lwIP is a small independent implementation of uIP.
- It is more powerful than uIP but requires more memory.
- lwIP is under the Modified BSD License
Ethernet Application
DHCP Client
- Enable UDP in "uip-config.h"
#define UIP_CONF_UDP 1
- Make sure your uip buffer size is large enough (DHCP messages from some server can be more than 500 bytes). In my setting, I use 1536 in "uip-config.h"
#define UIP_CONF_BUFFER_SIZE 1536
- Change PT_WAIT_UNTIL(...) to PT_YIELD_UNTIL(...) in line 259 and 276 in dhcpc.c [This is a known bug in dhcpc.c]
- In your main loop, initialize your MAC address and DHCP if UIP_FIXEDADDR is 0 in "uip-opt.h", for example:
int main(void) { uip_ipaddr_t ipaddr; struct timer periodic_timer, arp_timer; struct uip_eth_addr mac = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06}; timer_set(&periodic_timer, CLOCK_SECOND / 2); timer_set(&arp_timer, CLOCK_SECOND * 10); tapdev_init(); uip_init(); uip_setethaddr(mac); dhcpc_init(&mac, 6); while(1){ //normal codes goes here } }
- Implement dhcpc_configured(). This function will be called after DHCP client has obtained an IP address. Basically, you have to at least set your IP address, subnet mask and default gateway, for example,
void dhcpc_configured(const struct dhcpc_state *s) { uip_sethostaddr(s->ipaddr); uip_setnetmask(s->netmask); uip_setdraddr(s->default_router); //you can print your ip addr to your console/lcd to see if you get a valid ip address }
- An example of using DHCP Client in the dsPic33F development board can be found here.
Web Server
- To be added.
SNMP Agent
- Simple Network Management Protocol (SNMP) is a standard protocol to access variables to remote device via the Internet.
- It belongs to the Application Layer, as in HTTP.
- If a device is SNMP compatible, any SNMP compatible host system can monitor and control that device.
Components in a SNMP System
- Network Management Station (NMS)
- This is a client, initiating SNMP communication.
- This can be a PC with an NMS software, polling data from the SNMP agents periodically.
- SNMP Agents
- These are servers, responding to one or multiple NMS requests.
- Management Information Base (MIB)
- A special collection of variables managed by the SNMP agents.
- MIB has a tree-like structure.
- An Object Identifier (OID) is given for each node.
- Data are stored at the end-nodes.
- Private variables may be constructed under the "enterprise" sub-tree.
- The OID (41.6.1.4.X) for "enterprise" can be obtained from Internet Assigned Number Authority (IANA).
Abstract Syntax Notation
- Each MIB variable contains several attributes, such as data type, access type and object identifier.
- Abstract Syntax Notation version 1 (ASN.1) is a language to define these attributes in SNMP.