Jump to content
reaper7

[Energia Library] EtherEncLib for ENC28J60

Recommended Posts

This is a very simple enc28j60 library created by Renato Aloi for atmega

modifed by me for MSP430G2553 and MSP430F5529

 

Please, check my latest master fork from Renato Aloi newMods branch

or download directly v0.4.2:

EtherEncLib-0.4.2.zip   fix CS, fix examples, disable debug from tcpstack

EtherEncLib-0.4.zip     only harware SPI version (MSP430G2553 and MSP430F5529 tested)

EtherEncLib_v03.zip - hard/soft spi version

EtherEncLib_v2.zip - hardware spi version

EtherEncLib_v01.zip - softspi version

 

v03: selectable hardware/software spi

  • all definitions moved to EtherEncLib.h
  • lines 17,18 -> select between hard/soft spi
  • lines 21,23-25 -> SPI pins definition for MSP430
  • lines 28,30-32,34 -> SPI pins definition for Stellaris & Tiva(?)

 

v02: hardware spi version

  • enctypes.h file contains CS pins definition (lines 247, 250)

 

v01: init version

  • At this moment, after my quick mod, spi communication work on softspi (shiftOut/shiftIn) and replace strange arduino access via registers like SPDR etc...
  • So...shiftOut/shiftIn are not so fast :(
  • enctypes.h file contains pins definition (lines 247-259)

 

description from EtherEncLib.cpp file:

 

Description ::
HTTP 1.0/1.1 GET Listener for web browsing integration.
 
What DO you get ::
- ARP and ICMP treatment
- HTTP GET action over TCP-IP
- Very responsive engine, and very fast!
- HTTPd engine with "One Way" implementation
- One way flow = SYS..ACK..PUSH..FIN
- Possible to send various PUSH statments trhough print() function
- SYS..ACK..PUSH1..PUSH2..PUSH3..PUSHn..FIN
- Avoid the limit imposed by others ENC28J60 libraries
- Other libs sends all data in one TCP PUSH packet, need large buffer
- EtherEncLib.h sends data in little chunks, NO need large buffer
- available(), print() and close() functions makes easy
coding and "thinking outside the box"
- getParams() extracts the command line parameters ex:
will result: ?param1=0.231&param2=0.34
- Timered loops to avoid get stucked waiting a client response
 
 
What do you NOT get ::
- This is a very limited implementation of TCP-IP protocol
- Do not expect implementations like FTP, SMTP, etc
- Only one aspect of TCP/HTTP service was implemented
- On HTTP protocol, only GET form method was implemented
- POST method is NOT implemented
- POST method is ready to go, having already commented spots to code
- Faulty handle for diferent Source ports
- The system will only handle one source port incomming connection
- Other request arriving from other ports will be handled only at end of current request
- Only FIN+ACK arriving from other ports will be handled
- UDP NOT implemented

 

post-30271-0-76998200-1392840611_thumb.jpg

post-30271-0-49015600-1392916589_thumb.jpg

post-30271-0-14196800-1398588287_thumb.jpg

Share this post


Link to post
Share on other sites

Hello everyone, thanks for this library. I have a question about library. I want to show temperature value (with an internal sensor MSP430g2553) and control the LED on web server. Temperature variable dynamically change,continuously. In example (HelloWorldActivate.ino) at library, web server creates HTML, so temperature value does not change continuously, without refresh the page. Hence, I want to use PHP instead of HTML. But I didn't do that. How to use PHP on this web server? Thanks a lot again :)

Share this post


Link to post
Share on other sites

Hello, thanks for this library and sharing to everyone.I have a question about library. I want to show temperature value (with an internal sensor MSP430g2553) and control the LED on web server. Temperature variable dynamically change,continuously. In example (HelloWorldActivate.ino) at library, web server creates HTML, so temperature value does not change continuously, without refresh the page. Hence, I want to use PHP instead of HTML. But I didn't do that. How to use PHP on this web server? Thanks a lot again :)

You can't do PHP on mcu, there is no OS, and this is a very limited resource platform. It would require lot of horsepower to implement php JIT or VM. Also, don't forget that msp430 not only are not power beast, but they also lack ram. So processing and handling lot of resource inside a VM or a JIT would run off ram. Normally, we don't make webserver from mcu, except maybe for a small status page. The goal of ethernet on mcu is to communicate between mcu and receive command from outside (like computer & phone), or send data to a server. For that, we normally do raw TCP/IP or UDP to send command/data.

 

HTTP is like i said, mostly useful to make a status page, with the possibility to send some command. For this, we don't need php. You just need html + javascript to do what you want. And if its too ugly, you can make your page load image & css from internet (in html, the content of the page don't have to be on the same page has the server).

 

If you really need php, then grab a raspberry pi or something like that. Raspberry pi is cheaper than beagle bone. For simple php, you could take the model A+ (25$).

 

Some advanced chip like the W5500 allow more than simple HTTP and raw UDP & TCP/IP, but those chip has driver ready for linux also, because to fully use power of such chip(like FTP & other), we normally use a RTOS on a beefy mcu, or a full blown OS.

Share this post


Link to post
Share on other sites

 

Thank you so much for your response @@asgard20032. I am new in coding MCUs :) I understand that, I can not use PHP because MCU hasn't got OS. I must use MSP430g2553 for my project so I can't use Raspberry and Beaglebone.Maybe I misunderstood that part, because my English isn't very good so I ask again to make sure. Is there a way change the temperature variable momentarily on web page using HTML? If it is not possible, I already control MSP430 ports and show the temperature value (not instantly, just constant value e.g. 23 degree and not changing) on my web server and I will finish and deliver up my project. Thank you for all your help :) 

 

Share this post


Link to post
Share on other sites

Like i said, you need some javasript in to update the value. Javascript is in the html, the mcu don't execute javascript, it just send it to the client. Its the job of the client to execute the javascript part, so you can do it on msp430.

Share this post


Link to post
Share on other sites

Yes even if you had PHP it would not allow dynamic updates. Like other have said you can write some JavaScript to poll the temp and humidity status via http.

 

Another way to address this would be to push data to a service like data.sparkfun.com and use a site like imp.guru to render the web page.

 

At the moment there is a bug for live updates on those sites but it is being resolved. Here MQTT is used.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...