|
|
View previous topic :: View next topic |
Author |
Message |
carmarmu
Joined: 09 May 2006 Posts: 15 Location: Valencia (Spain)
|
Suggestion For Ethernet Communication |
Posted: Tue May 09, 2006 3:12 pm |
|
|
Hi !
I need help, recommendations…
I need to make a project using an Ethernet communication,full duplex , to transmit data of a AD converter to a PC through an Ethernet connection.
When i say "full duplex",i referred to full duplex Ethernet, that is to say, to be able to send commands from the PC to the PIC so that the transmission begins,stops... If only it´s possible half duplex (only receive commands on PC without flow control) too is valid for me, but i prefer full duplex.
It´s the first time that I´m going to use this type of communication with a PIC, and I need some suggestion, some indication or recommendation about hardware.
I think i must use PIC18F4620 + ENC28J60… is thus? As extra data I say that use CCS Compiler for my developments… is a good compiler for my objectives or it would have to use another one of Microchip to be able to compile some library of TCP/IP (Microchip TCP/IP stack)? ¿CCS Compiles the stack?
It would thank for any type to you of suggestion.
Thank you very much in advance. _________________ **CaRmArMu** Valencia (Spain) |
|
|
asmallri
Joined: 12 Aug 2004 Posts: 1634 Location: Perth, Australia
|
|
Posted: Tue May 09, 2006 6:05 pm |
|
|
It is important to understand that FULL DUPLEX ethernet and half duplex Ethernet both support full duplex communication.
Full Duplex Ethernet refers to the operation of the MAC (Media Access Control) layer. Ethernet originally ran on coax so if a station wanted to transmit it had to wait until the media was free and then start transmitting. The MAC was therefore half duplex because it could only do one at a time. This behaviour was and remains transparent to the application. It sends and receives data "full duplex" to the mac layer and the mac layer handles the half duplex serialization to/from the media.
With the migration to 10BaseT Ethernet and LAN switching, a full duplex MAC layer could be implemented because separate pairs are used to carry the transmit and receive traffic between the NIC and the Switch. The Ethernet standardization body (IEEE802.3) extended the Ethernet specification to support higher speeds (100Mbps, 1Gbps, 10Gbps) and also full duplex MAC. For 10/100 operation the stanard specifies how end stations negotiate the media access method. First the end stations attempt to negotiate a 100Mbps full duplex connection, if this fails they attempt to negotiate a 100M half duplex connection. If this fails they fall back to a 10Mbps half duplex connection. Note there is NO mechanism in the standard to negotiate a 10Mbps FULL duplex connection.
If you want 10Mbps full duplex you must manually configure both ends of the link (the switch and the NIC). The ENC28J60 supports half and full duplex operation. Some might think, well I want the highest performance possible so I must run the ENC28J60 full duplex. What they do not realise is that they will almost certainly not a achieve any increase in performance. There are three main limiting factors when implementing Ethernet with a PIC and the ENC28J60. The ENC28J60s maximum SPI clock speed is 10Mbps. Ignoring any overhead (sending commands to and from the controller) the maximum effective (ignoring kludges) transmission rate is therefore 10Mbps which is split between send and receive. The other problems are tied to the limited memory bandwidth of the PIC and I/O bandwidth into and out of the PIC for running the application. It is unlikley that you would be able to achieve > 6Mbps (split between transmit and receive) with a PIC and an ENC28J60 (even to get this speed requires a custom stack). In other words no performance advantage would be achieved by running at 10Mbps full duplex. By staying at 10Mbps half duplex you will also reduce the number of calls to support that inevitably arise with mismatches between duplex settings.
On my site you can download a reference design and sample application using the PIC18F2620 and the ENC28J60. The code will run unmodified on a PIC18F4620. It also contains sample code written for the CCS compiler. CCS also have an Ethernet development board with a PIC18F4620 and an ENC28J60 controller and I have published sample code and an Ethernet bootloader for this platform.
CCS have ported the Microchip and you can get access to it by sending CCS an email requesting it. I must have been having an off day or two because I had some problem getting my first MCHP/CCS stack program to work even though I supposedly know PICs and networking backwards :-)
I do not use either MCHP or MCHP/CCS stacks for my projects. The sample code listed on my site does not use either stack but the procedure names and calling parameters are very similar. The MCHP/CCS stack is a good starting point for anyone requiring rapid development time, but, as with all hierarchical protocol implementations, it is inefficient in both CPU and program memory. If you require high Ethernet throughput and low latency application response then you will need to code your own.
If your application is a simple one, requiring UDP instead of TCP and the PIC functions as a server (does not ever need to initiate a transfer instead respondings to requests from a client such as a PC) then you should be able to use the sample code as a solid base. You will need to code the UDP section however the ICMP Echo (ping) provides an example of how to handle this.
When choosing a PIC for network applications, choice one with lots of program memory and RAM. My Ethernet based PIC projects generally have two or more PICs, one that just handles the Ethernet controller and network related code, and the others that handles the primary application.
Finally - if this is your first networking project - don't start with the PIC. Use two PCs and develop your network application on them. There are a lot more free tools available on the PC to help. Once you have debugged you network code you can port it to the PIC. _________________ Regards, Andrew
http://www.brushelectronics.com/software
Home of Ethernet, SD card and Encrypted Serial Bootloaders for PICs!! |
|
|
carmarmu
Joined: 09 May 2006 Posts: 15 Location: Valencia (Spain)
|
|
Posted: Thu May 11, 2006 12:31 pm |
|
|
Thanks!!! _________________ **CaRmArMu** Valencia (Spain) |
|
|
Humberto
Joined: 08 Sep 2003 Posts: 1215 Location: Buenos Aires, La Reina del Plata
|
|
Posted: Thu May 11, 2006 2:51 pm |
|
|
You have got the most complete explanation regarding the implementation
of an Ethernet layer using a PIC + ENC28J60 very well exposed by asmallri.
Quote: |
I need some suggestion, some indication or recommendation about hardware. I think i must use PIC18F4620 + ENC28J60… is thus?
|
IMO PIC18F4620 + ENC28J60 it is not the best choice for this application.
(sorry CCS & Microchip)
If this development has a good economic justification, I would take a walk by Rabbit,
they have ready to run Flash based modules.
http://www.rabbitsemiconductor.com/products/AppKits/
Humberto |
|
|
Darren Rook
Joined: 06 Sep 2003 Posts: 287 Location: Milwaukee, WI
|
|
Posted: Thu May 11, 2006 6:28 pm |
|
|
Humberto wrote: | IMO PIC18F4620 + ENC28J60 it is not the best choice for this application.
(sorry CCS & Microchip)
If this development has a good economic justification, I would take a walk by Rabbit,
they have ready to run Flash based modules.
http://www.rabbitsemiconductor.com/products/AppKits/
|
What's so good about the Rabbit solution?
I have pretty much always disliked Rabbit products. _________________ I came, I saw, I compiled. |
|
|
Humberto
Joined: 08 Sep 2003 Posts: 1215 Location: Buenos Aires, La Reina del Plata
|
|
Posted: Fri May 12, 2006 5:43 am |
|
|
Quote: |
What's so good about the Rabbit solution?
|
Code: |
PIC18F4620 RABBIT 3000
Program Memory 64 KB 1 MB
Data Memory 4 KB up to 1 MB
Clock Speed max 40 Mhz 55 Mhz
Serial Ports 1 6
I/O Pins 36 56
TCP/IP stack No Yes
SDLC/HDLC support No Yes
IRDA capabilities No Yes
Real Time Clock No Yes
Cuadrature decoders No 2
|
Humberto |
|
|
kender
Joined: 09 Aug 2004 Posts: 768 Location: Silicon Valley
|
|
Posted: Fri May 12, 2006 5:48 am |
|
|
Humberto wrote: | Quote: | What's so good about the Rabbit solution?
|
Code: |
PIC18F4620 RABBIT 3000
Program Memory 64 KB 1 MB
Data Memory 4 KB up to 1 MB
Clock Speed max 40 Mhz 55 Mhz
Serial Ports 1 6
I/O Pins 36 56
TCP/IP stack No Yes
SDLC/HDLC support No Yes
IRDA capabilities No Yes
Real Time Clock No Yes
Cuadrature decoders No 2
|
|
IMHO, since most of the effort is spent on the firmware development, a microcontroller is only as good as it's C compiler. |
|
|
carmarmu
Joined: 09 May 2006 Posts: 15 Location: Valencia (Spain)
|
|
Posted: Fri May 12, 2006 12:15 pm |
|
|
I have used Rabbit products in some occasion, and recognize that they are good, but I want to do something “more craftsman”, something to program more, to entertain more time to me, and to put me in the hardware more thoroughly.
With Rabbit cards you have almost all fact, and that I don´t like.
If it were in a hurry if Rabbit would use, but as it´s not the case, i prefer to do it in this way.
Humberto wrote: | You have got the most complete explanation regarding the implementation
of an Ethernet layer using a PIC + ENC28J60 very well exposed by asmallri.
Quote: |
I need some suggestion, some indication or recommendation about hardware. I think i must use PIC18F4620 + ENC28J60… is thus?
|
IMO PIC18F4620 + ENC28J60 it is not the best choice for this application.
(sorry CCS & Microchip)
If this development has a good economic justification, I would take a walk by Rabbit,
they have ready to run Flash based modules.
http://www.rabbitsemiconductor.com/products/AppKits/
Humberto |
_________________ **CaRmArMu** Valencia (Spain) |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|