Jump to content
43oh

[Energia Library] EtherEncLib for ENC28J60


Recommended Posts

Hi! - I don't know how to help You,

a good choice is to buy a simple logic analyzer.

 

Do You have any message on serial console?

Try to "enable" debug message from lib -> EtherEncLib.h change DEBUGLIB value from 0 to 1 (line 40)

 

You must know how to check process step by step,

simplest method is inserting something like this Serial.println("i'm here"); in different library places (like begin, available etc) called from sketch.

 

You must be like a Herlock Sholmes ;)

Link to post
Share on other sites
  • Replies 40
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Popular 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 down

@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          

@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    

Posted Images

Hello,

I managed to install and make the examples work on my MSP430, good stuff!

I got one question:

I'm trying to set a MSP430 pin as an output, and control the logic value of this pin using my Browser, having the MSP430 as an web server, for example. Could anyone give me a good start on this? Thanks!

Link to post
Share on other sites
  • 3 months later...

The following concerns Energia 0101E0017 on Windows 10 and EtherEncLib-0.4.2

Launchpad MSP-EXP430G2 with a MSP430G2553

 

Hi Reaper,

thanks a lot for the library.

However, I had a bad start. To begin with, I was not able to get the smallest answer from it. Of course, I suspected the SPI interface, but was barking up the wrong tree. Not until I began to dig into the library I stroke gold.

 

The first problem was a function "F" used in print context like e.g.

? Serial.println(F("Text to print"))

 

I never encountered this function bevor with MSP430G2553, I do not know what it does, but it compiles. However, after replacing all occurrences of this function , oh wonder, nearly everything worked!

 

The second hickup I encountered, was the chip (or slave, CS or SS) select pin (in my case pin 10) in the examples. Although the sketch sets this to output mode, it does not set it to "LOW". Without setting this pin to low, I did not receive any answer from the library.  I think the SPI started up in "slave" mode.

 

This CS pin is rather finicky, I fail to understand it. The pin reference in "energia.nu" for MSP430G2553 specifies that the SPI library uses P2.0 as CS, but this dos not work, neither does P2.1. However P2.2 works, why?

 

It would interesting if you could comment.

cheers, Daniel

Link to post
Share on other sites

@DanielPHuber

 

1. "F" is declared in ...cores/msp430/WString.h and generally refers to strings stored in flash memory.

If You can know more, read about FlashStringHelper and PSTR

 

2. This lib uses "user defined" CS pin and control it from library, not from msp hardware

of course You can change it to other pin but remember, that You must change this in two places:

- in Your sketch, through properly set pin mode eg:  pinMode(10,OUTPUT)

- in enc28typedef.h inside this library folder: #define ENC28J60_CONTROL_CS    10

At this moment personally I use pin 13 and it works too

 

 

so...I can move CS pin mode initialization to library (remove pinMode from user sketch),

this is almost done but at this moment this mod is commented and I want to maintain the highest compliance with the original library.

Link to post
Share on other sites

Hi Reaper,

thanks a lot, I learned a thing ot two.

There is nothing wrong with the library, I must have fooled myself yesterday. Anyway, today the library works with F(..).

However, I do not yet understand fully what F(..) does on the MSP430.

 

On the Arduino we have a Harvard architecture, that means separate address spaces for code and data. Therefore before using "print " to print a string in code segment, we must trick "print" into fetching the string from code and not data space. must first be copied into data segment. Here F(..) makes sense.

 

However, MSP430 is von Neuman, that means there is only one single address space for both data and code. Therefore there is no problem accessing something in the code segment. What does F(..) in this case?

Is F(..) on the MSP430 superfluous? Does it add superfluous code?

 

thank's for the teaching, Daniel

Link to post
Share on other sites

@@chicken - as I wrote above F("zzz") is declared in WString.h as:

#define F(string_literal) (reinterpret_cast<const __FlashStringHelper *>(PSTR(string_literal)))

@@DanielPHuber - I don't know if F is necessary for MSP and even I don't go deep into it (FlashStringHelper or PSTR) if the library compiled and works :)

I don't know too how (or even) this affects performance and/or memory usage.

 

Can You tests memory usage and performance with and without "F" ?

Link to post
Share on other sites

@@reaper7 A sorry, didn't pay attention to the whole thread.

 

PSTR is Atmel's way to identify pointers to program memory. Energia has a define somewhere to ignore PSTR. So F() in the end does nothing to the string pointer. It doesn't have to, thanks to MSP430's sane memory model.

 

F() can safely be left away for MSP430.

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