ENC28j60 fail

Maple Mini, Maple Rev3, Maple Rev 5 and Maple Ret 6, iTead Maple etc
weslleymata
Posts: 14
Joined: Wed Aug 31, 2016 5:06 pm

ENC28j60 fail

Post by weslleymata » Wed Aug 31, 2016 5:18 pm

Hello ,
I'm ethernet problems with ENC28J60 module, I bought the card in the aliexpress .

[img]
https://pt.aliexpress.com/item/1pcs-STM ... .81.GS0mOZ[/img]

tested in arduino 1.6.3 and 1.6.11.

my code example enc28j60:

Code: Select all

// PIN Connections (Using STM32F103):
//
// ENC28J60 -  STM32F103
//   VCC    -    3.3V
//   GND    -    GND
//   SCK    -    Pin PA5
//   SO     -    Pin PA6
//   SI     -    Pin PA7
//   CS     -    Pin PA8
//----------------------------------------------------------------- 
//
//

#include <EtherCard_STM.h>
#include <SPI.h>

#define REQUEST_RATE 5000 // milliseconds

// ethernet interface mac address
static byte mymac[] = { 0x74,0x69,0x69,0x2D,0x30,0x31 };
// remote website name
const char website[] PROGMEM = "google.com";

byte Ethernet::buffer[700];
static long timer;

// called when the client request is complete
static void my_result_cb (uint8_t status, uint16_t off, uint16_t len) {
  Serial1.print("<<< reply ");
  Serial1.print(millis() - timer);
  Serial1.println(" ms");
  Serial1.println((const char*) Ethernet::buffer + off);
}

void setup () {
  Serial1.begin(19200);
  Serial1.println("\n[getDHCPandDNS]");
  
  if (ether.begin(sizeof Ethernet::buffer, mymac) == 0) 
    Serial1.println( "Failed to access Ethernet controller");

  if (!ether.dhcpSetup())
    Serial1.println("DHCP failed");
  
  ether.printIp("My IP: ", ether.myip);
  // ether.printIp("Netmask: ", ether.mymask);
  ether.printIp("GW IP: ", ether.gwip);
  ether.printIp("DNS IP: ", ether.dnsip);

  if (!ether.dnsLookup(website))
    Serial1.println("DNS failed");
  ether.printIp("Server: ", ether.hisip);
  
  timer = - REQUEST_RATE; // start timing out right away
}

void loop () {
    
  ether.packetLoop(ether.packetReceive());
  
  if (millis() > timer + REQUEST_RATE) {
    timer = millis();
    Serial1.println("\n>>> REQ");
    ether.browseUrl(PSTR("/foo/"), "bar", website, my_result_cb);
  }
}

I checked several times the connection between the plates , but it's all right.

help me please

zmemw16
Posts: 1449
Joined: Wed Jul 08, 2015 2:09 pm
Location: St Annes, Lancs,UK

Re: ENC28j60 fail

Post by zmemw16 » Wed Aug 31, 2016 8:29 pm

you posted a picture of the 'Blue Pill" - not a network module.
stephen

weslleymata
Posts: 14
Joined: Wed Aug 31, 2016 5:06 pm

Re: ENC28j60 fail

Post by weslleymata » Thu Sep 01, 2016 1:57 am

Hi, Sorry.
O AM use a Enc28j60 with maple mini.
Not work enc28j60 with maple mini "stm32f103".

User avatar
RogerClark
Posts: 7148
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: ENC28j60 fail

Post by RogerClark » Thu Sep 01, 2016 3:26 am

Why didnt you just search the forum for anyone else who has used the ENC28j60

I quickly found this

https://github.com/Serasidis/Ethernet_STM

Which seems to use the same Ethernet chip

weslleymata
Posts: 14
Joined: Wed Aug 31, 2016 5:06 pm

Re: ENC28j60 fail

Post by weslleymata » Thu Sep 01, 2016 10:49 am

hello RogerClark ,
I am creating an application that sends data through the internet using GET PHP before I used the ATmega328 , but I miguei for STM32F103 for reasons of memory and better performance.
When I used the ATmega328 with ENC28J60 everything it worked properly, but I'm now using STM32F103 with ENC28J60 and does not work .

I use the STM32duino -master library, usually carries STM32F103 ( MAPLE MINI ) , but it seems not work.

I am using the IDE arduino 1.6.3 .

Someone using the Arduino IDE and ENC28J60 and MAPLE MINI with a GET php sample code , please help me .
thank you now.

weslleymata
Posts: 14
Joined: Wed Aug 31, 2016 5:06 pm

Re: ENC28j60 fail

Post by weslleymata » Thu Sep 01, 2016 11:03 am

see the tests failed DNS with my serial1 , bad when I use ATmega328 everything works normally.

Code: Select all

[getDHCPandDNS]
DNS failed

>>> REQ

>>> REQ

>>> REQ

>>> REQ

>>> REQ

>>> REQ

>>> REQ

>>> REQ
<<< reply 1077 ms
tii-01Àêäd
<<< reply 1077 ms
tii-01Àêäd

>>> REQ
<<< reply 371 ms
tii-01Àêäd
my code used:

Code: Select all

// This demo does web requests via DHCP and DNS lookup.
// 2011-07-05 <jc@wippler.nl> http://opensource.org/licenses/mit-license.php
//
//
//-----------------------------------------------------------------
//  Ported to STM32F103 by Vassilis Serasidis on 21 May 2015
//  Home:  http://www.serasidis.gr
//  email: avrsite@yahoo.gr
//
// PIN Connections (Using STM32F103):
//
// ENC28J60 -  STM32F103
//   VCC    -    3.3V
//   GND    -    GND
//   SCK    -    Pin PA5
//   SO     -    Pin PA6
//   SI     -    Pin PA7
//   CS     -    Pin PA8
//----------------------------------------------------------------- 
//
//

#include <EtherCard_STM.h>
#include <SPI.h>

#define REQUEST_RATE 5000 // milliseconds

// ethernet interface mac address
static byte mymac[] = { 0x74,0x69,0x69,0x2D,0x30,0x31 };
// remote website name
const char website[] PROGMEM = "google.com";

byte Ethernet::buffer[700];
static long timer;

// called when the client request is complete
static void my_result_cb (uint8_t status, uint16_t off, uint16_t len) {
  Serial1.print("<<< reply ");
  Serial1.print(millis() - timer);
  Serial1.println(" ms");
  Serial1.println((const char*) Ethernet::buffer + off);
}

void setup () {
  Serial1.begin(19200);
  Serial1.println("\n[getDHCPandDNS]");
  
  if (ether.begin(sizeof Ethernet::buffer, mymac) == 0) 
    Serial1.println( "Failed to access Ethernet controller");

  if (!ether.dhcpSetup())
    Serial1.println("DHCP failed");
  
  ether.printIp("My IP: ", ether.myip);
  // ether.printIp("Netmask: ", ether.mymask);
  ether.printIp("GW IP: ", ether.gwip);
  ether.printIp("DNS IP: ", ether.dnsip);

  if (!ether.dnsLookup(website))
    Serial1.println("DNS failed");
  ether.printIp("Server: ", ether.hisip);
  
  timer = - REQUEST_RATE; // start timing out right away
}

void loop () {
    
  ether.packetLoop(ether.packetReceive());
  
  if (millis() > timer + REQUEST_RATE) {
    timer = millis();
    Serial1.println("\n>>> REQ");
    ether.browseUrl(PSTR("/foo/"), "bar", website, my_result_cb);
  }
}

User avatar
RogerClark
Posts: 7148
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: ENC28j60 fail

Post by RogerClark » Thu Sep 01, 2016 12:01 pm

Try PM'ing @vassilis he wrote that code, I don't have that hardware

User avatar
zoomx
Posts: 523
Joined: Mon Apr 27, 2015 2:28 pm
Location: Mt.Etna, Italy

Re: ENC28j60 fail

Post by zoomx » Thu Sep 01, 2016 2:17 pm

Check if it works with 8.8.8.8 instead of google.com

User avatar
martinayotte
Posts: 1229
Joined: Mon Apr 27, 2015 1:45 pm

Re: ENC28j60 fail

Post by martinayotte » Thu Sep 01, 2016 2:43 pm

There is also the Arduino_UIP library which I've used under F4, it should be trivial to port it under F1.
https://github.com/rogerclarkmelbourne/ ... rduino_uip

weslleymata
Posts: 14
Joined: Wed Aug 31, 2016 5:06 pm

Re: ENC28j60 fail

Post by weslleymata » Thu Sep 01, 2016 2:52 pm

Hello everyone,
yet still the same error . see the serial monitor :

Code: Select all

[getDHCPandDNS]
DNS failed

>>> REQ

>>> REQ

>>> REQ

>>> REQ

>>> REQ

>>> REQ

>>> REQ

>>> REQ
<<< reply 185 ms
tii-01Àêäd
<<< reply 186 ms
tii-01Àêäd

>>> REQ
<<< reply 538 ms
tii-01Àêäd

Post Reply