Go Down

Topic: Arduino DUE, ENC28J60 and UIPEthernet (Read 8540 times) previous topic - next topic

erictronico

Hi!
I'm using the ENC28J60 with Arduino DUE, using UIPEthernet library. so far the only thing I've done is show a part of a text, it seems that it is only able to send a limited number of bits and then send no more, I tried with other libraries, but the others don't even compile. attached the code I'm using and the result I get.
Code: [Select]
#include <SPI.h>
#include <UIPEthernet.h>

// **** ETHERNET SETTING ****
byte mac[] = { 0x54, 0x34, 0x41, 0x30, 0x30, 0x31 };                                       
IPAddress ip(192, 168, 1, 177);                       
EthernetServer server(80);

void setup() {
  Serial.begin(9600);

  // start the Ethernet connection and the server:
  Ethernet.begin(mac, ip);
  server.begin();

  Serial.print("IP Address: ");
  Serial.println(Ethernet.localIP());
}

void loop() {
  // listen for incoming clients
  EthernetClient client = server.available();

  if (client)
  { 
    Serial.println("-> New Connection");

    // an http request ends with a blank line
    boolean currentLineIsBlank = true;

    while (client.connected())
    {
      if (client.available())
      {
        char c = client.read();

        // if you've gotten to the end of the line (received a newline
        // character) and the line is blank, the http request has ended,
        // so you can send a reply
        if (c == '\n' && currentLineIsBlank)
        {
          client.println("<html><title>Hello World!</title><body><h3>Hello 123456789</h3></body>");
          break;
        }

        if (c == '\n') {
          // you're starting a new line
          currentLineIsBlank = true;
        }
        else if (c != '\r')
        {
          // you've gotten a character on the current line
          currentLineIsBlank = false;
        }
      }
    }

    // give the web browser time to receive the data
    delay(100);

    // close the connection:
    client.stop();
    Serial.println("   Disconnected\n");
  }
}


and the result on the bowser is:
Hello 12345
hope you can help me,
Greetings

erictronico

Well, I answer myself, I tried this version of the library and it worked the first try !
I tried the example to show WIZNET analog inputs and it worked fine but replacing the include UIPethernet include ethernet. hope this works for someone else.

https://github.com/ntruchsess/arduino_uip/releases/tag/UIPEthernet_v1.57
Greetings from Chile!

erictronico

only worked about 5 minutes and then crashes, I need to reset to get back to work. =(
any idea what may be wrong?  :~

erictronico

#3
Sep 12, 2014, 03:52 am Last Edit: Sep 14, 2014, 05:44 am by erictronico Reason: 1
nobody can help me? works well for about 200 requests and then gets stuck. probe in the Arduino DUE with UIPEthernet, I can access the page from 200 to 300 times and then stops responding (Arduino still working).
I think it may be problem ENC28J60 internal memory or something. once it hits the ethernet port light continues to flash.
someone who can help me? :(

erictronico

finally seems to be a problem with the speed of the SPI bus.
in the library was set to about 8 MHz, change the divisor of 10 to 21 (line 85 of file Enc28J60Network.cpp) leaving the bus at 4MHz. I've been testing it for hours and  I  had no problems.
I hope this works for someone else. :)
Greetings from Chile

ntruchsess

thank you for this information. As there are quite a lot of people running into freeze-issues that will only resolve by resetting the enc28j60 I think it makes sense to make the SPI-speed configurable.

regards,

Norbert

erictronico

Thanks to you Norbert for make it easy for us.
but again with the problem. I turned it off for a week, and when i turn it  on just as before, run a couple of loads and then freezes as before. the ARDUINO DUE is good, the same code works fine with WIZNET, and whith ARDUINO duemilanove ENC28J60 runs smoothly with library " Ethershield and ETHER_28J60".
i slow down the SPI bus to 1 MHZ, but the problem persist.
i don´t know what more can i do.... :~

ntruchsess

I've fixed a bug that led to failure of enc28j60 chip so you may want to check out new version 1.59 now.

regards,

Norbert


ntonci

Can someone describe the wiring scheme for ENC28J60 and Arduino Due?
Thanks

Regards
Nicolò

olbaid

Can i have an help me too? I've buyed the enc28j60 but i dont know how to configure it with arduino due. And i dont know what kind of libraries i had to use. Please help me :)

AussieSusan

Olbaid - you don't say what package style of ENC28J60 you have bought (or perhaps you bought the PicTail daughter board). I would suggest that you look at the ENC28J60 data sheet on the Microchip site as it contains all of the chip pin descriptions, or the PicTail data sheet.
For a library, have you looked at the link in response #7 (two above your post)?
Susan

olbaid

ty for your answer. I solved my problem about the libraries. About the pinmapping, i follow http://arduino.cc/en/Hacking/PinMappingSAM3X here, but so i've use
25 - SO
26 - SI
27 - SCK
28 - CS
vcc - 3.3 V
gnd - GND

But this doesnt work. How do u think id to proceed?


AussieSusan

Olbaid - Perhaps others )like me) don't look at this over the weekend.
However, you still have not given us very much to go on. You mention the pins on the DUE side of things but not what type of board you might be using to holds the ENC28J60 (if any).
If you are using a Pictail (or similar) board then you will need to look at the data sheet to see what pins need to be connected.
If you are using the chip directly, then there are a number of other connections that are required (crystal etc.).
Either way, the ENC28J60 also needs "\RESET\" and "\INT\" (Interrupt) connections and you have not mentioned those.
Susan

olbaid

#14
Dec 01, 2014, 12:17 pm Last Edit: Dec 01, 2014, 12:18 pm by olbaid
Ty for your help, i have Arduino due and http://www.ebay.it/itm/271638435780?ssPageName=STRK:MEWNX:IT&_trksid=p3984.m1439.l2649

I've read in web that the common connections for ENC28J60 are SO SI SCK CS VCC GND, so i read
here 
http://arduino.cc/en/uploads/Main/arduino-Due-schematic.pdf
and here
http://arduino.cc/en/Hacking/PinMappingSAM3X
and here
http://arduino.cc/en/Reference/DueExtendedSPI

to understand that, in arduino due,u can use pins 4, 10, and 52 for CS.

The i've tried to understand what do the libraries, the only one i've find in web (UIPEthernet 1.51) and the methods i'll use to program, thinking the problems are in how to use it.
But i dont understand the problem.
However i'm a stubborn noob that want to approach to arduino, but i dont want to wait for other compatible ethernet shield.
ty in advance :)

Go Up