Jump to content
Sign in to follow this
Followers 2

# [Energia Library] EtherEncLib for ENC28J60

By reaper7, February 19, 2014 in MSP Energia Libraries

- LM4F120H5QR
- MSP430G
- enc28j60
- MSP430G2553

- Prev
- 1
- 2
- 3
- Next
- Page 1 of 3

## Recommended Posts

### reaper7 66

- Level 2
- Members
- 66
- 174 posts
- LocationPolska
- Github Repository

Posted February 19, 2014

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:
> http://192.168.1.25/?param1=0.231&param2=0.34
> 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

- 3

hobbittns, monsonite and yosh reacted to this

### tranduythai 1

- Member
- Members
- 1
- 12 posts

Posted February 20, 2014

Pls check, i cant compile your program, erros in

public:

EtherEncLib(unsigned int port);
thanks alot

### reaper7 66

- Level 2
- Members
- 66
- 174 posts
- LocationPolska
- Github Repository

Posted February 20, 2014

what error? more info needed!

I use original energia for MSP430 without any modifications and no errors

P.S. I'm new in MSP430 world

New HARDSPI v2 version!

### yosh 121

- Level 2
- Members
- 121
- 207 posts
- LocationGermany

Posted February 21, 2014

Hi @@reaper7

which ENC28J60 breakout did you use - seems to be very tiny

### reaper7 66

- Level 2
- Members
- 66
- 174 posts
- LocationPolska
- Github Repository

Posted February 21, 2014

@@yosh - yes, it's tiny "bga" on bottom side.

http://atmega32-avr.com/wp-content/uploads/2013/02/Sensor-Webserver.jpg

I bought this module long time ago on allegro.pl (like ebay) for a very good price!

- 1

yosh reacted to this

### mestre 0

- Noob Class
- Members
- 0
- 2 posts
- Github Repository

Posted March 30, 2014
Congratulations Library Works perfectly.
What should USE Command paragraph connect to a remote ip?
and bring this information?

### reaper7 66

- Level 2
- Members
- 66
- 174 posts
- LocationPolska
- Github Repository

Posted April 1, 2014

with this lib you cannot connect from msp to remote ip

### mestre 0

- Noob Class
- Members
- 0
- 2 posts
- Github Repository

Posted April 10, 2014

E poss

### reaper7 66

- Level 2
- Members
- 66
- 174 posts
- LocationPolska
- Github Repository

Posted April 10, 2014

I am not the author

This library was created as a light server only.

You need ask this question to the author (I think he also speaks Portuguese)

### FeelGood 0

- Noob Class
- Members
- 0
- 4 posts

Posted December 12, 2014

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

### asgard20032 9

- Level 1
- Members
- 9
- 57 posts

Posted December 12, 2014

> 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.

- 1

FeelGood reacted to this

### FeelGood 0

- Noob Class
- Members
- 0
- 4 posts

Posted December 12, 2014

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

### asgard20032 9

- Level 1
- Members
- 9
- 57 posts

Posted December 12, 2014

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.

- 1

FeelGood reacted to this

### FeelGood 0

- Noob Class
- Members
- 0
- 4 posts

Posted December 12, 2014

Ok, I will try that, thank you.

### Lgbeno 188

- Level 3
- Members
- 188
- 375 posts
- LocationGreen Bay, WI

Posted December 13, 2014

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.

- 1

FeelGood reacted to this

- Prev
- 1
- 2
- 3
- Next
- Page 1 of 3

## Create an account or sign in to comment

You need to be a member in order to leave a comment

## Create an account

Sign up for a new account in our community. It's easy!

Register a new account

## Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this
Followers 2
Go To Topic Listing MSP Energia Libraries

×