| Author |
Message |
|
|
Posted: Mar 23, 2012 - 02:00 PM |
|

Joined: Mar 17, 2011
Posts: 97
|
|
Hello Everybody,
I wanted to know that whether we have an AVR ATMEGA's TCP/IP based protocol stack which we can use for sending packets over the internet? I found a couple of Ethernet chips, I just wanted to know that is there a Protocol stack available for atmega or I have to implement it on my own? |
_________________ Thanks and Regards
Mahesh Murty
Senior Fellow
ilabs The Robotics and Embedded Systems Research Lab
Nagpur
India
|
| |
|
|
|
|
|
Posted: Mar 23, 2012 - 03:12 PM |
|


Joined: Mar 20, 2001
Posts: 1517
Location: Switzerland
|
|
Yes, there are IP stacks avialable. Just search the forum to find discussions, references, etc.
Google is your friend: Just search for 'avr tcpip stack site:avrfreaks.net'. |
_________________ Markus
|
| |
|
|
|
|
|
Posted: Mar 23, 2012 - 04:39 PM |
|


Joined: Jul 18, 2005
Posts: 62944
Location: (using avr-gcc in) Finchingfield, Essex, England
|
|
Adding "Adam Dunkels" to any Google search could be a good idea.
Of course it does depend on what "Ethernet chip" you are talking about - something like the Wiznet one does a lot of the TCP/IP "inside". |
_________________
|
| |
|
|
|
|
|
Posted: Mar 23, 2012 - 04:49 PM |
|

Joined: Mar 17, 2011
Posts: 97
|
|
| The Chip I am going to use is the ENC28J60 from microchip. May be that's the only one which is easily available to me. I will try to interface this chip with ATmega 8. Thanks to markus. Your post really helped. |
_________________ Thanks and Regards
Mahesh Murty
Senior Fellow
ilabs The Robotics and Embedded Systems Research Lab
Nagpur
India
|
| |
|
|
|
|
|
Posted: Mar 23, 2012 - 04:51 PM |
|

Joined: Jan 09, 2007
Posts: 1919
Location: Arlington, Texas, U.S.A.
|
|
|
mm2426 wrote:
I just wanted to know that is there a Protocol stack available for atmega ...
Yes.
avr-uip
lwip-avr |
|
|
| |
|
|
|
|
|
Posted: Mar 23, 2012 - 05:23 PM |
|


Joined: Sep 04, 2002
Posts: 21396
Location: Orlando Florida
|
|
| An arduino uno and an arduino ethernet shield might do the job |
_________________ Imagecraft compiler user
|
| |
|
|
|
|
|
Posted: Mar 23, 2012 - 09:29 PM |
|


Joined: Aug 04, 2004
Posts: 1822
Location: Davie, FL
|
|
NUT OS has a TCPIP stack for AVR
Google for ethernut. |
|
|
| |
|
|
|
|
|
Posted: Mar 23, 2012 - 10:14 PM |
|

Joined: Dec 30, 2004
Posts: 9012
Location: Melbourne,Australia
|
|
| Mega8 doesn't give you much to play with in terms of ram and flash. Have a look at www.tuxgraphics.com |
|
|
| |
|
|
|
|
|
Posted: Mar 24, 2012 - 02:58 AM |
|

Joined: Dec 18, 2001
Posts: 4780
|
|
Infinitely easier, indeed easy, to run TCP/IP/ARP/ICMP/PPPoE on a small micro by off-boarding all of these protocols to a module like the WizNet 812MJ (or the newer version). Just a few lines of code to talk to the module via SPI port. Pass the IP address, port number, and so on and send/receive packets. Buffers are on the module.
It's masochistic to put the TCP/IP stack on the microprocessor these days, with the off-boarding modules being $18 or so. |
|
|
| |
|
|
|
|
|
Posted: Mar 24, 2012 - 01:10 PM |
|

Joined: Mar 17, 2011
Posts: 97
|
|
| I reffered the ENC28J60's datasheet, & I think that the physical & datalink layers are implemented on the chip, whereas we have to implement IP, & TCP to communicate on the internet. Is this ok? |
_________________ Thanks and Regards
Mahesh Murty
Senior Fellow
ilabs The Robotics and Embedded Systems Research Lab
Nagpur
India
|
| |
|
|
|
|
|
Posted: Mar 24, 2012 - 01:13 PM |
|


Joined: Jul 18, 2005
Posts: 62944
Location: (using avr-gcc in) Finchingfield, Essex, England
|
|
| You are right. uIp, lwIP, NutOS and others are softwarte implementations of TCP/IP you can run on an AVR but Steve's poiint is that if you use WizNet then you don't really need this as everything but your high level application lives inside their chip (but for the difference in cost between something like W5100 and ENC28J60) |
_________________
|
| |
|
|
|
|
|
Posted: Mar 24, 2012 - 01:17 PM |
|

Joined: Mar 17, 2011
Posts: 97
|
|
| Ya that's only the problem. My dealer only has ENC28J60 and its also a cheaper one. The Wiznet one is not availabe. As I am just testing & only a student so will not order more that 5 pieces so I don't think a big dealer would provide me with that chip. |
_________________ Thanks and Regards
Mahesh Murty
Senior Fellow
ilabs The Robotics and Embedded Systems Research Lab
Nagpur
India
|
| |
|
|
|
|
|
Posted: Mar 24, 2012 - 01:58 PM |
|


Joined: Jul 18, 2005
Posts: 62944
Location: (using avr-gcc in) Finchingfield, Essex, England
|
|
| Unless you are a volume producer you don't use the W5100 alone you buy it ready made up in a module such as WIZ812MJ for $18 which connects to the AVR using SPI. |
_________________
|
| |
|
|
|
|
|
Posted: Jul 28, 2012 - 10:44 AM |
|

Joined: Mar 17, 2011
Posts: 97
|
|
| I started reading the datasheet and I came to know that the ENC28J60 requires a SPI Clock of more than or equal to 8MHz. As I am using ATmega8 I can only produce the SPI Clock signals of 8MHz only. I am able to read many registers of this IC but When I program a MAC Address and Read it back from the MAADR6-1 registers in return I get 0 value only. Can anyone help me in this context??? |
_________________ Thanks and Regards
Mahesh Murty
Senior Fellow
ilabs The Robotics and Embedded Systems Research Lab
Nagpur
India
|
| |
|
|
|
|
|
Posted: Jul 28, 2012 - 10:57 AM |
|

Joined: Dec 30, 2004
Posts: 9012
Location: Melbourne,Australia
|
|
| Exactly, what does the datasheet say? Have you been to www.tuxgraphics.com? I think you might find a solution there. |
|
|
| |
|
|
|
|
|
Posted: Jul 28, 2012 - 01:20 PM |
|

Joined: Mar 17, 2011
Posts: 97
|
|
| The datasheet says that the SPI Clock should be atleast 8MHz to read from MAC registers. I am producing the 8MHz of clock but I don't know why I am unable to read from the MAC registers. I even don't know that the configuration which I am writing is being written into the registers or not? |
_________________ Thanks and Regards
Mahesh Murty
Senior Fellow
ilabs The Robotics and Embedded Systems Research Lab
Nagpur
India
|
| |
|
|
|
|
|
Posted: Jul 28, 2012 - 01:23 PM |
|


Joined: Sep 04, 2002
Posts: 21396
Location: Orlando Florida
|
|
| Using internal 8MHz rc oscillator, or 8MHz crystal? Using the 'double speed' bit on the spi? Seems like you need 16MHz AVR clock to get an 8MHz SPI clock the way I read it? |
_________________ Imagecraft compiler user
|
| |
|
|
|
|
|
Posted: Jul 28, 2012 - 01:48 PM |
|

Joined: Dec 30, 2004
Posts: 9012
Location: Melbourne,Australia
|
|
| What revision enc28j60? The erratta outlines the issue. Again, look at tuxgraphics. |
|
|
| |
|
|
|
|
|
Posted: Jul 28, 2012 - 01:57 PM |
|

Joined: Mar 17, 2011
Posts: 97
|
|
| Yes I am running ATmega8 on 16MHz crystal. And my ENC28J60 chip revision is B7. |
_________________ Thanks and Regards
Mahesh Murty
Senior Fellow
ilabs The Robotics and Embedded Systems Research Lab
Nagpur
India
|
| |
|
|
|
|
|
Posted: Jul 30, 2012 - 06:31 AM |
|

Joined: Mar 17, 2011
Posts: 97
|
|
| I even checked the tuxgraphics code they had also accessed the registers in the same way I am doing but still I am unable to read the MAC registers. The only difference I could see is they are using ATmega88 and I am using ATmega8 for doing the job. Is this my problem??? |
_________________ Thanks and Regards
Mahesh Murty
Senior Fellow
ilabs The Robotics and Embedded Systems Research Lab
Nagpur
India
|
| |
|
|
|
|
|
Posted: Jul 30, 2012 - 09:35 AM |
|


Joined: Jul 18, 2005
Posts: 62944
Location: (using avr-gcc in) Finchingfield, Essex, England
|
|
|
Quote:
Is this my problem???
Well certainly mega88 code will need porting for use on the mega8. As the usual transition is actualyl from the old mega8 to the newer mega88 you will find that Atmel have an application note available that explains the differences when moving in that direction - obviously the same information should work both ways. |
_________________
|
| |
|
|
|
|
|
Posted: Jul 30, 2012 - 11:13 AM |
|

Joined: Mar 17, 2011
Posts: 97
|
|
| Actually I did not burn the code as it is, I just copied the functions which were doing the work in my code and then I programmed my code. |
_________________ Thanks and Regards
Mahesh Murty
Senior Fellow
ilabs The Robotics and Embedded Systems Research Lab
Nagpur
India
|
| |
|
|
|
|
|
Posted: Jul 30, 2012 - 11:28 AM |
|


Joined: Jul 18, 2005
Posts: 62944
Location: (using avr-gcc in) Finchingfield, Essex, England
|
|
|
Quote:
I just copied the functions
But that's not necessarily going to work. Just a small trivial example. Suppose the code uses the UARt. On mega88 the data register is called UDR0, on mega8 it is UDR. So for that one you'd just have to change a register name. But there are other. more subtle differences such as control bits that may have moved from one register into another. Therefore for every control register and bit within it that is touched by the code you have to find out where it was on the mega88 and what function it had. Then either find the same register/bit for the mega8 or work out where the functionality of that bit has moved to or whether it's even changed in operation. This process is known as "porting". As I say Atmel have prepared a porting guide for the mega8->mega88 direction but the same information should help you port code for mega88 back to the mega8 too. |
_________________
|
| |
|
|
|
|
|
Posted: Jul 30, 2012 - 11:41 AM |
|

Joined: Mar 17, 2011
Posts: 97
|
|
| Actually I started reading their code, I understood the parts which they were using to communicate with the Ethernet IC and followed the same in my Mega8 code i.e. I used my SPI transfer routine wherever they had used their own transfer routine. |
_________________ Thanks and Regards
Mahesh Murty
Senior Fellow
ilabs The Robotics and Embedded Systems Research Lab
Nagpur
India
|
| |
|
|
|
|
|
Posted: Jul 30, 2012 - 01:21 PM |
|


Joined: Oct 30, 2002
Posts: 5727
Location: The Netherlands
|
|
| A way to test if any communications is possible is to control the two LEDs that the ENC28J60 can control. Each LED can be set to one of 16 modes or so; including steady on or flashing IIRC. |
|
|
| |
|
|
|
|
|
Posted: Aug 03, 2012 - 05:00 PM |
|

Joined: Mar 17, 2011
Posts: 97
|
|
| I didn't tried writing to the PHY registers but I was not able to read data from the MAC registers. According to the tuxgraphics code, I think I am writing to those registers in the correct way. |
_________________ Thanks and Regards
Mahesh Murty
Senior Fellow
ilabs The Robotics and Embedded Systems Research Lab
Nagpur
India
|
| |
|
|
|
|
|
Posted: Aug 03, 2012 - 05:23 PM |
|


Joined: Feb 19, 2001
Posts: 26115
Location: Wisconsin USA
|
|
|
Quote:
I started reading the datasheet and I came to know that the ENC28J60 requires a SPI Clock of more than or equal to 8MHz. As I am using ATmega8 I can only produce the SPI Clock signals of 8MHz only.
Trying to be polite, that sounds like it is totally wrong. It would be >>very<< unusual for an SPI slave device to have a high minimum SPI clock rate.
Where exactly in the datasheet did you come to know about this piece of information? When I open a datasheet I find...
Code:
TABLE 16-6: SPI INTERFACE AC CHARACTERISTICS
FSCK Clock Frequency [Min]DC [Max]20 [Units]MHz
So you are trying to prototype an interface to a new to you peripheral device that is an SPI slave. And probably using some kind of breadboard/lashup setup. And you >>start<< with an SPI clock rate of many MHz?!? And you are using an AVR model without debug capabilites?
Have you examined your transactions with a 'scope to check the signal integrity? And if it looks clean, used a logic analyzer (or the 'scope) to see what the deciphered packets look like? |
|
|
| |
|
|
|
|
|
Posted: Aug 03, 2012 - 05:41 PM |
|


Joined: Oct 30, 2002
Posts: 5727
Location: The Netherlands
|
|
| It's an erratum of this chip. MAC (one part of multiple parts in this chip) registers can not be reliably read at speeds lower than 8MHz. Probably some synchronization across clock domain issues in the design. |
|
|
| |
|
|
|
|
|
Posted: Aug 04, 2012 - 05:38 AM |
|

Joined: Dec 18, 2001
Posts: 4780
|
|
| The WizNet 812MJ is far superior to the Microchip module. |
|
|
| |
|
|
|
|
|
Posted: Aug 04, 2012 - 09:49 AM |
|


Joined: Oct 30, 2002
Posts: 5727
Location: The Netherlands
|
|
| But they are unobtainium for the OP. |
|
|
| |
|
|
|
|
|
Posted: Aug 05, 2012 - 07:05 AM |
|

Joined: Mar 17, 2011
Posts: 97
|
|
| Actually it is specified in the eratta of ENC28J60 that clock speeds less than 8MHz will not allow you to read MAC and PHY Registers, and I am not using a breadboard setup I had created a board on which I have the two chips ATmega8 and the Ethernet one. I do not have a logic analyzer with me, for debugging. |
_________________ Thanks and Regards
Mahesh Murty
Senior Fellow
ilabs The Robotics and Embedded Systems Research Lab
Nagpur
India
|
| |
|
|
|
|
|
Posted: Nov 13, 2012 - 11:13 AM |
|

Joined: Nov 13, 2012
Posts: 1
|
|
Hello Everyone,
M about to start work on same project of ENC28J60 interface with ATMEGA128...havent yet bought the things so woud like your suggestions to choose betwwen Wiznet & ENC28J60...
Reply awaited..
S.Sharma |
|
|
| |
|
|
|
|
|
Posted: Nov 13, 2012 - 11:24 AM |
|


Joined: Jul 18, 2005
Posts: 62944
Location: (using avr-gcc in) Finchingfield, Essex, England
|
|
|
Quote:
betwwen Wiznet & ENC28J60
Well the Wiznet solutions contain almost a complete TCP/IP stack within the firmware of their chip so the AVR part of the software is very small and simple and you program it at the highest level. With the ENC28J60 you have to implement the entire TCP/IP in AVR software which is more complex and uses more flash space. On the other hand the ENC28J60 is a much cheaper chip. |
_________________
|
| |
|
|
|
|
|