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

Re: ENC28j60 fail

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

I need the stm32 use a dynamic IP , ie , the card will plug into several different networks , after getting an IP it will start to send data via GET PHP.

I decided to change to ATmega328 STM32F103 for memory reasons.

and so I am new to the world of CORTEX - M3

danieleff
Posts: 336
Joined: Thu Sep 01, 2016 8:52 pm
Location: Hungary
Contact:

Re: ENC28j60 fail

Post by danieleff » Thu Sep 01, 2016 9:01 pm

I tried your code, and what I got was: using Serial, it worked, but using Serial1 (and the correct pins of course), it only got to [getDHCPandDNS], and then stopped (probably inside ether.begin(...)).

So maybe try Serial with A9/A10 pins.

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

Re: ENC28j60 fail

Post by weslleymata » Fri Sep 02, 2016 10:46 am

Good Morning,
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 ?

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

Re: ENC28j60 fail

Post by weslleymata » Fri Sep 02, 2016 1:35 pm

I connected the micro USB cable to the mini Maple plate , now I'm using serial and no more Serial1 , and carrying scketch with ST -LINK V2 cable and IDE arduino 1.6.3 , bad even then the Ethernet network does not work.

Upload to RTCclock and led PC13 blink and everything works normally.

Code: Select all

#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);
  }
}
but carrying the serasidis_Ethercard_stm scketch does not work , not even the serial works.

can you help me.

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

Re: ENC28j60 fail

Post by weslleymata » Fri Sep 02, 2016 2:00 pm

Looking for maple mini board , when I upload the scketch of UIP_ethernet or serasidis_ethernet_stm , the serial does not work , but when I upload the scketch blink led normally works the serial .

what could it be?

User avatar
Vassilis
Posts: 320
Joined: Thu May 21, 2015 6:42 am
Location: Thessaloniki, Greece
Contact:

Re: ENC28j60 fail

Post by Vassilis » Mon Sep 05, 2016 1:05 pm

@ weslleymata
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)

Code: Select all

 if (ether.begin(sizeof Ethernet::buffer, mymac) == 0)
PA4 is used as Chip Select pin (custom setting)

Code: Select all

 if (ether.begin(sizeof Ethernet::buffer, mymac, PA4) == 0)

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

Re: ENC28j60 fail

Post by weslleymata » Fri Sep 09, 2016 7:23 pm

Hi Vassilis ,
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 .

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

Re: ENC28j60 fail

Post by RogerClark » Fri Sep 09, 2016 8:31 pm

There is a clock multplier on the clock frequency inside the STM32.
( It is set to 9 times multiplication, hence 72mhz which is the normal clock freq for this device)

Post Reply