Jump to content
reaper7

[Energia Library] EtherEncLib for ENC28J60

Recommended Posts

I'm also looking for an enc28j60 library for lm4f that can do http-client things.

In my case I want to be able to pull a json file from a webserver that the mcu needs to process.

 

If anyone has any ideas I'm all ears.

 

I did find the stellaris-enc28j60-booster code by xpgdk, which I have successfully built for the stellaris in the past. However, to make it a bit simpler for myself I'd like to use it with Energia, so I can make use of the included libraries.

Perhaps this library can be ported to the Energia IDE? if so does anyone have any leads on where to start with this?

Share this post


Link to post
Share on other sites

@@BRey You mean the Arduino Ethernet WebClient example?

 

I just tried compiling it for lm4f with UIPEthernet (v02) in Energia and I get:
 

UIPEthernet/UIPUdp.cpp.o:(.bss.INADDR_NONE+0x0): multiple definition of `INADDR_NONE'
UIPEthernet/Dns.cpp.o:(.bss.INADDR_NONE+0x0): first defined here
UIPEthernet/UIPClient.cpp.o:(.bss.INADDR_NONE+0x0): multiple definition of `INADDR_NONE'
UIPEthernet/Dns.cpp.o:(.bss.INADDR_NONE+0x0): first defined here
core.a(IPAddress.cpp.o).bss.INADDR_NONE+0x0): multiple definition of `INADDR_NONE'
UIPEthernet/Dns.cpp.o:(.bss.INADDR_NONE+0x0): first defined here
collect2: error: ld returned 1 exit status

Actually I get the same error for all UIPEthernet examples.

Share this post


Link to post
Share on other sites

Ok, some poking around and I commented out line 12 of Dns.h because I think this is already set in common/IPAddress

//const IPAddress INADDR_NONE(0,0,0,0);

And now it works \o/

(please correct me if this is the wrong method to fix this)

Share this post


Link to post
Share on other sites

@dreamer   I think I was able to use the examples from the Energia "Ethernet" library designed for the connected Tiva Launchpad.  I was more interested in MQTT and successfully used the examples from the Energia "PubSubClient" library.

I just tested the "Ethernet->EthernetWebserver" example. I had to change

#include "Ethernet.h" 

to

#include "SPI.h"
#include "UIPEthernet.h"
#define  D1_LED   RED_LED
#define  D2_LED   GREEN_LED

And comment out these 2 lines:

//    Serial.print("new client on port ");           // print a message out the serial port
//   Serial.println(client.port());

Then I was able to control the Red & Green parts of the RGB Led with the web page.

 

B

Share this post


Link to post
Share on other sites

UIPEthernet? this is topic about EtherEncLib not UIPEthernet :)

so, You must change line 424:

#define ENC28J60_CONTROL_CS      5

inside:      

EtherEncLib -> enc28typedef.h

 

but I don't know that this lib works with TIVA, only MSP430G2553 and MSP430F5529 are tested.

Share this post


Link to post
Share on other sites
Thanks for library!

I'm new to the MSP430 world, so I'm a bit lost about the connections with the ENC28j80 Ethernet module.

For successfully using the "Hello World" example, which PINs and connections I'm I supposed to do? Thanks!

Share this post


Link to post
Share on other sites

@lessarlz - ENC28j60 is a spi device, so connection is very simple

for eg. if You are using MSP430G2553 board:

 

ENCpin   MSPpin

Vcc          PIN1    +3.3V

GND        PIN20  GROUND

CS           PIN10    P2_2  (you can change this pin in file enc28typedef.h - line 424, then also mandatory! in sketch pinMode(10,OUTPUT);

RESET    PIN16  RESET

SI             PIN15  P1_7 (MOSI)

SCK         PIN7    P1_5 (SCK)

SO           PIN14  P1_6 (MISO)

--

WOL, INT, CLKOUT -> not connected

Share this post


Link to post
Share on other sites

@lessarlz - ENC28j60 is a spi device, so connection is very simple

for eg. if You are using MSP430G2553 board:

 

ENCpin   MSPpin

Vcc          PIN1    +3.3V

GND        PIN20  GROUND

CS           PIN5    P1_3  (you can change this pin in file enc28typedef.h - line 424, then also mandatory! in sketch pinMode(5,OUTPUT);

RESET    PIN16  RESET

SI             PIN15  P1_7 (MOSI)

SCK         PIN7    P1_5 (SCK)

SO           PIN14  P1_6 (MISO)

--

WOL, INT, CLKOUT -> not connected

 

Many thanks, reaper7.
But I'm Having some issues here.
I've tried to use the "HelloWorld" example from the EtherEncLib.c lib.
I did all the right connections and changed the "ipaddr[] " char to one appropriate to my network, but I'm not being able to access the HTML page via browser =/
Any thoughts?

Share this post


Link to post
Share on other sites

@lessarlz - sorry...my mistake...wrong platform :)

for MSP CS pin is PIN10 P2_2...

try to change hardware connection(move wire from msp pin5 to pin10) and change uart speed to 9600 for msp430

 

attachicon.gifhard.jpg

 

attachicon.gifsite.jpg

 

attachicon.gifsoft.jpg

 Thanks again, reaper7

Unfortunately, I'm still not being able to make it work.
I have double checked all the hardware connections (including the CS pin change) and got nothing =/

post-47370-0-12407700-1447020818_thumb.png

post-47370-0-37887000-1447020819_thumb.png

Share this post


Link to post
Share on other sites

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

×