Jump to content

[Energia Library] StellarPad EtherCard (enc28j60) library

Recommended Posts

This is a JeeLab ENC28J60 library mod for Energia StellarPad,

working OK with other devices on the same SPI bus.











New version 0.9a [28.06.2014]:

1. fix wrong type of variable in emit_p

2. fixes by Francis Van Den Bussche, email 9/5/2014

3. fixed obvious bug, redmine issue #539

4. update README info and links

5. Add documentation on class BufferFiller


New version 0.9 [20.06.2014]:

1. added all fixes since my last release -> exactly between 01-03.05.2014 (https://github.com/jcw/ethercard/commits/master)

2. library (v09) from now should work on MSP430F5529 too, please test


New version 0.8 [26.04.2014]:

1. Fixes issue #492 (DNS lookup fails)


New version 0.7a [07.04.2014]:

1. changes inside dhcp.cpp - Custom DHCP option processing #119


New version 0.7 [05.04.2014]:

1. contains all github fixes since the last release.

2. working with oryginal spi library from Energia 0101E0012


New version 0.6 [27.04.2013]:

1. For clarity *.ino files I decided to move SPI initialize to library.

from now begin look like this: ether.begin(sizeof Ethernet::buffer, mymac, CS_PIN, SPI_MODULE).


- ether.begin(sizeof Ethernet::buffer, mymac) -> DEFAULT initialize eth on SPI 2 & Chip Select on PB_5

- ether.begin(sizeof Ethernet::buffer, mymac, PD_1, 3) -> initialize eth on SPI 3 & Chip Select on PD_1

SPI speed is defined in enc28j60.cpp file (line 256), maybe more sense is move SPI speed to begin too?


New version 0.5 [20.04.2013]:

1. "DHCP fix" - Andy Lindsay github commit


New version 0.4 [12.04.2013]:

1. "Implemented a simple UDP listening server, that listens for packets on ports and triggers callbacks" - brianlah87 github commit


New version 0.3 [04.04.2013]:

1. "adding header arg to browseUrl" - jscrane github commit


New version 0.2 [24.02.2013]:

1. "Accept of tcp packets refactored to a separate method" - mrbig github commit

2. New example for the above: "quasiMultiport" -> You can open more browser windows on different ports with different contents e.g.

http://stella_ip, http://stella_ip:1224, http://stella_ip:22222, etc...

3. New function setupWakeUp() in enc28j60.cpp/h -> You can setup enc28j60 to filter/receive only WOL package for e.g. WakeUp host (StellarPad) from hibernation,(enc28j60 pdf - chapter 12.2.1 pt1-3), return to normal mode through existing function enableBroadcast()

P.S. pt2 & 3 is my low quality ideas, so - don't report problem with them to jeelib ;)


still is some bugs e.g. DHCP with mac addr starting with first number > 0 not working for me :-/


Connections (If You are using default Energia SPI bus 2):


CS - PB_5 (J1.02) - selectable in *.ino
INT - PE_4 (J1.05)
SCK - PB_4 (J1.07)
SI - PB_6 (J2.07) - (or PD_0 - J3.03)
SO - PB_7 (J2.06) - (or PD_1 - J3.04)
RST - RESET (J2.05)


My sandwich StellarPad + universal ENC28J60 module from e.g. eBay + LCD5110 with tongue (nrf24l01+):


Sandwich get temperature from remote sensor (based on my second StellarPad and this project moved to Energia) via MiRF library,

display temp on LCD5110 modified library (number & graph idea by timotet) and create a simply web page to display temp

This is a very simply and fast making test platform ;)

Share this post

Link to post
Share on other sites

@reaper7, this is really great! I just got it hooked up to a board i have and it is working. I have been using the Ethercard library for over a year and it is what I am most familiar with. I wanted to port it myself, but don't yet have the knowledge.


Did you find any online resources or do you have any quick tips that would guide to porting arduino libraries to energia stellerpad?


btw I set the MAC higher than zero in the first digit and it worked. That has been one of my complaints with the Ethercard library, inconsistent DHCP results across different DHCP devices.

Share this post

Link to post
Share on other sites


Just curious what your opinion is of the relative merits between lwip and the ethercard code?


One of the things I had considered was whether the code you had working with lwip would function as a energia library?

Share this post

Link to post
Share on other sites

@soccou - for me LwIP is a complete stack,  EtherCard is a collection of some basic functions.



My knowledge is low too but desire high :D

so...first of all: PROGMEM,  pgm_read_byte and other friends... I remove all PROGMEM and replace pgm_read_byte with *

For others You must look out for "avr compat" in uncle goo ;)

second: SPI -> look inside my mods (mirf,ether and 5110 lcd by Rei Vilo), in Launchpad we have a good SPI.h lib for that.

And last: arduino "word" :rolleyes: - I replace it with uint16_t.



...and my new purchase for test (very compact but raster (module width) is not a multiple of 2.54)



fast test complete...IT'S WORKING :D


Share this post

Link to post
Share on other sites

@soccou - for me LwIP is a complete stack,  EtherCard is a collection of some basic functions.


I agree with you, reaper7. The EtherCard TCP/IP-stack (which is based on the tuxgraphics.org stack) is a really elegant low-memory TCP "hack". lwIP and uIP, on the other hand, are real TCP/IP stacks.


With regards to lwIP with Energia, that would really be interesting. Not quite sure if it can be done. It would be fun to try, though ;-)

Share this post

Link to post
Share on other sites

@energia - sorry, I don't have a MSP430 but oh43 community is really big and I think that someone modify my mod for MSP ;)

Maybe you just need to tell them? :D


...so, keep your modules on desk, because using them on energia is really easy for simply applications

Share this post

Link to post
Share on other sites

I am very tempted to try and see if this can work on the MSP430G2553. I fear that it might be a bit short on RAM, though.

Adding a bit of SPI ram probably helps a bit, but also makes the code slightly more complicated :-)

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.

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