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:
// 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);
}
}
stephen
O AM use a Enc28j60 with maple mini.
Not work enc28j60 with maple mini “stm32f103”.
I quickly found this
https://github.com/Serasidis/Ethernet_STM
Which seems to use the same Ethernet chip
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.
[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
https://github.com/rogerclarkmelbourne/ … rduino_uip
yet still the same error . see the serial monitor :
[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
I decided to change to ATmega328 STM32F103 for memory reasons.
and so I am new to the world of CORTEX – M3
So maybe try Serial with A9/A10 pins.
I use Serial1 because I’m using the ST -LINK V2 cable and use one card arduino in Serial1 to communicate send the data in the serial monitor .
Using the ST -LINK V2 cable and look at the serial monitor ?
Upload to RTCclock and led PC13 blink and everything works normally.
#include <RTClock.h>
RTClock rt (RTCSEL_LSE); // initialise
uint32 tt;
#define LED_PIN PC13
// This function is called in the attachSecondsInterrpt
void blink ()
{
digitalWrite(LED_PIN,!digitalRead(LED_PIN));
}
void setup()
{
pinMode(LED_PIN, OUTPUT);
rt.attachSecondsInterrupt(blink);// Call blink
}
void loop()
{
if (rt.getTime()!=tt)
{
tt = rt.getTime();
Serial.print("time is: ");
Serial.println(tt);
}
}
what could it be?
Sorry for the delay but I was very busy (as most of us) during the last months.
I saw the example code you posted and it works ok, at least on my STM32F103C8T6 and ENC28J60 ethernet module.
Arduino IDE: 1.6.5
Libray: Ethercard_STM
Serial terminal snapshot
My IP: 192.168.1.9
GW IP: 192.168.1.1
DNS IP: 192.168.1.1
Server: 62.1.38.163
>>> REQ
<<< reply 86 ms
HTTP/1.0 404 Not Found
Content-Type: text/html; charset=UTF-8
Content-Length: 1568
Date: Mon, 05 Sep 2016 12:19:19 GMT
<!DOCTYPE html>
<html lang=en>
<meta charset=utf-8>
<meta name=viewport content=”initial-scale=1, minimum-scale=1, width=device-width”>
<title>Error 404 (Not Found)!!1</title>
<style>
*{margin:0;padding:0}html,code{font:15px/22px arial,sans-serif}html{background:#fff;color:#222;padding:15px}body{margin:7% auto 0;max-width:390px;min-height:180px;padding:30px 0 15px}* > body
…
The only thing I need to notice is that by default the Chip Select (CS) pin is the PA8. If you want to use any other pin you have to declare it to the ether.begin line.
PA8 is used as Chip Select pin (default setting)
if (ether.begin(sizeof Ethernet::buffer, mymac) == 0)
I tested in my house and this normal functioning , thank you.
Another question , the crystal is on the board is 8MHZ but works in 8MHZ or 72MHz ?
Another question , I’m using a dynamic IP , it will be used in several different types of networks , poor have any networks that does not work , even turning off the firewall network ETH ENC28J60 card can not connect to the internet.
Thanks for everything .
( It is set to 9 times multiplication, hence 72mhz which is the normal clock freq for this device)

