ENC28J60 question ?

Go To Last Post
102 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Guys,

 

I have experiment with ENC28J60...

I put address on AVR as 10.0.0.20....I can ping it, but when I open the browser, it can not load the page, what's missing here ?

 

Thanks

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I use wireshark and here's the messages :

Frame 15: 82 bytes on wire (656 bits), 82 bytes captured (656 bits) on interface 0
Ethernet II, Src: QuantaCo_71:47:e0 (c8:0a:a9:71:47:e0), Dst: Broadcast (ff:ff:ff:ff:ff:ff)
Internet Protocol Version 4, Src: 10.0.0.20, Dst: 10.255.255.255
User Datagram Protocol, Src Port: 56497 (56497), Dst Port: 1947 (1947)
Data (40 bytes)

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

What's missing? A whole load of information.
Your wireshark data tells us little - http is tcp not udp.
Why don't you tell us what code you are using?
My guess is the enc is working, so look elsewhere for the problem.

Last Edited: Tue. May 17, 2016 - 02:57 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I try from tuxgrapics, it was working before but it's not working now, I don't change the code on the board....but may be the setting on my computer is changing....

Any ideas...?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

another message :

Frame 344: 175 bytes on wire (1400 bits), 175 bytes captured (1400 bits) on interface 0
Ethernet II, Src: QuantaCo_71:47:e0 (c8:0a:a9:71:47:e0), Dst: IPv4mcast_7f:ff:fa (01:00:5e:7f:ff:fa)
Internet Protocol Version 4, Src: 10.0.0.20, Dst: 239.255.255.250
User Datagram Protocol, Src Port: 56591 (56591), Dst Port: 1900 (1900)
Hypertext Transfer Protocol

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Here's the IP setting :

static uint8_t mymac[6] = {0x54,0x55,0x58,0x10,0x00,0x24};
static uint8_t myip[4] = {10,0,0,20};

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

What is the ip address of your computer?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Could the problem be in my computer network setting ?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

my computer IP address : 10.0.0.3

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

At this rate, we'll be here all night. You could just cut n paste the output of ipconfig.
Then you could show us wireshark dumps of the http request.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Ethernet adapter Local Area Connection:

   Connection-specific DNS Suffix  . :
   Link-local IPv6 Address . . . . . : fe80::9dc1:cc05:77e1:5803%11
   IPv4 Address. . . . . . . . . . . : 10.0.0.20
   Subnet Mask . . . . . . . . . . . : 255.0.0.0
   Default Gateway . . . . . . . . . : 10.0.0.1

Wireless LAN adapter Wireless Network Connection:

   Connection-specific DNS Suffix  . : BigPond
   Link-local IPv6 Address . . . . . : fe80::8cb5:63e1:c0e0:7c69%10
   IPv4 Address. . . . . . . . . . . : 10.0.0.3
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Default Gateway . . . . . . . . . : 10.0.0.138

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Interface: 10.0.0.3 --- 0xa
  Internet Address      Physical Address      Type
  10.0.0.138            00-26-44-a0-e1-e6     dynamic
  10.0.0.255            ff-ff-ff-ff-ff-ff     static
  224.0.0.22            01-00-5e-00-00-16     static
  224.0.0.252           01-00-5e-00-00-fc     static
  239.255.255.250       01-00-5e-7f-ff-fa     static
  255.255.255.255       ff-ff-ff-ff-ff-ff     static

Interface: 10.0.0.20 --- 0xb
  Internet Address      Physical Address      Type
  10.0.0.20             54-55-58-10-00-24     static
  10.255.255.255        ff-ff-ff-ff-ff-ff     static
  224.0.0.22            01-00-5e-00-00-16     static
  224.0.0.252           01-00-5e-00-00-fc     static
  239.255.255.250       01-00-5e-7f-ff-fa     static
  255.255.255.255       ff-ff-ff-ff-ff-ff     static

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Why is your lan ip address the same as the enc lan address? I'd suggest that might be a problem. No wonder the ping works.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Ethernet adapter Local Area Connection:

   Connection-specific DNS Suffix  . :
   Link-local IPv6 Address . . . . . : fe80::9dc1:cc05:77e1:5803%11
   IPv4 Address. . . . . . . . . . . : 10.0.0.20
   Subnet Mask . . . . . . . . . . . : 255.0.0.0
   Default Gateway . . . . . . . . . : 10.0.0.1

Wireless LAN adapter Wireless Network Connection:

   Connection-specific DNS Suffix  . : BigPond
   Link-local IPv6 Address . . . . . : fe80::8cb5:63e1:c0e0:7c69%10
   IPv4 Address. . . . . . . . . . . : 10.0.0.3
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Default Gateway . . . . . . . . . : 10.0.0.138

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Then you could show us wireshark dumps of the http request......................==> how can I do that ?....still wondering..

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Sorry, ip support is closed for the night. Suggest you contact Google or read the wireshark manual.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I attached what I had captured

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Is that what you mean ?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Useless. See #13. You cant have you pc ip address the same as the enc ip address. Change one of them. Or else give up.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Why is your lan ip address the same as the enc lan address? I'd suggest that might be a problem. No wonder the ping works.....

So I change my LAN to a different IP address, let me try.... thanks

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I change my computer to 10.0.0.22.....orange LED on ENC28J60 is blinking all the time....but can not ping....

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The packets :

 

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I can see this :

1024    552.599945    10.0.0.22    10.0.0.20    ICMP    74    Echo (ping) request  id=0x0001, seq=143/36608, ttl=128 (no response found!)

 

Frame 1024: 74 bytes on wire (592 bits), 74 bytes captured (592 bits) on interface 0
Ethernet II, Src: QuantaCo_71:47:e0 (c8:0a:a9:71:47:e0), Dst: 54:55:58:10:00:24 (54:55:58:10:00:24)
Internet Protocol Version 4, Src: 10.0.0.22, Dst: 10.0.0.20
Internet Control Message Protocol

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I try requesting from Firefox :

 

The response :

 

Frame 1042: 70 bytes on wire (560 bits), 70 bytes captured (560 bits) on interface 0
Ethernet II, Src: QuantaCo_71:47:e0 (c8:0a:a9:71:47:e0), Dst: 54:55:58:10:00:24 (54:55:58:10:00:24)
Internet Protocol Version 4, Src: 10.0.0.22, Dst: 10.0.0.20
Transmission Control Protocol, Src Port: 55839 (55839), Dst Port: 80 (80), Seq: 0, Len: 0

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Does cross cable matter ?
 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Does the AVR have any form of debug available (UART, LCD, LEDs, morse code beeps, whatever?). It should be able to tell you if it is "seeing" anything.

 

Also you say that in the AVR you have set:

static uint8_t mymac[6] = {0x54,0x55,0x58,0x10,0x00,0x24};

so if you see this Mac address in the wireshark traffic such as you mention in #23/#24 doesn't that at least prove something? If the detail of what the Mac address has "got out" of the AVR and on to the wires then in some sense it is communicating.

 

However when I download your ENC28J60 packets2.txt in post #22 and search for "54:55" I don't see anything in that traffic using that Mac address?

 

Remember that TCP on IP on Ethernet are layers of the OSI 7 layer networking model. I would explore the communication at every level from the electrical signalling (scope) upwards to see at which layers the connection seems to be made and at which it might be broken. Wireshark will help you with the higher layers but you want to start at the bottom and for example just verify that Ethernet packets are making it from one Mac address to the other. Worry about the IP and TCP and anything else above these later - if the low level comms does not work nothing above it that relies on it will either.

 

Isn't life a whole lot less complicated with a WIZ812MJ ? ;-) The only real reason for messing about either ENC28J60's and the like is when you are looking at bulk quantities in mass produced devices. If this is just some one-off project experimentation I would stick to the easy to use solutions.

Last Edited: Tue. May 17, 2016 - 04:56 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yes I'm using UART :

The code :

 init_ip_arp_udp_tcp(mymac,myip,MYWWWPORT);
        usart_pstr("BEFORE WHILE");
		NEXT_LINE;

		while(1){

 

It's working until this level, UART message :

 

ENC28J60 Test application!

ENC28J60 Initialization finished!

ENC28J60 init!

BEFORE WHILE

 

I haven't put anything yet inside the loop....

I want to try it later on......

 

Any other clues guys ?

 

Thanks

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I try with ping, why isn't it ping from 10.0.0.22 ?? 10.0.0.3 is my computer via wifi and 10.0.0.022 is my computer via LAN to ENC28J60...

 

Pinging 10.0.0.20 with 32 bytes of data:
Reply from 10.0.0.3: Destination host unreachable.
Request timed out.
Request timed out.
Request timed out.

Ping statistics for 10.0.0.20:
    Packets: Sent = 4, Received = 1, Lost = 3 (75% loss),

 

 

Ethernet adapter Local Area Connection:

   Connection-specific DNS Suffix  . :
   Link-local IPv6 Address . . . . . : fe80::9dc1:cc05:77e1:5803%11
   IPv4 Address. . . . . . . . . . . : 10.0.0.22
   Subnet Mask . . . . . . . . . . . : 255.0.0.0
   Default Gateway . . . . . . . . . : 10.0.0.138

Wireless LAN adapter Wireless Network Connection:

   Connection-specific DNS Suffix  . : BigPond
   Link-local IPv6 Address . . . . . : fe80::8cb5:63e1:c0e0:7c69%10
   IPv4 Address. . . . . . . . . . . : 10.0.0.3
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Default Gateway . . . . . . . . . : 10.0.0.138

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Isn't life a whole lot less complicated with a WIZ812MJ ? ;-),

 

Is it the same with W5100 for Arduino ? I have that module somewhere in my shelf.....Is it SPI as well do you have the example ? thanks

This ENC28J60 was working before, with different Atmega board....

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Does it need pull up resistor on CS? And is it compatible with 5v Spi? I put 5v with my atmega....

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Gyys, any clues starting debugging from ? starting from here ? enc28j60Init(uint8_t* macaddr)

 

This experiment was working and suddenly not, I really don't understand....

 

void enc28j60Init(uint8_t* macaddr)
{
	// initialize I/O
	//DDRB  |= 0b00010110;
	//DDRB = 0x16;
    
	    // ss as output:
	ENC28J60_CONTROL_DDR |= 1<<ENC28J60_CONTROL_CS;
    DDR_B.b4 = 0x01;
	
	ENC28J60_CONTROL_CS_H; // ss=0
	//ENC28J60_CONTROL_CS_L; // ss=0
    	
	DDRB  |= 1<<PB1 | 1<<PB2; // mosi, sck output
	cbi(DDRB,PINB3); // MISO is input
    
	    //
        cbi(PORTB,PB1); // MOSI low
        cbi(PORTB,PB2); // SCK low
	//
	// ³õʼ»¯ SPI
	// Ö÷»úģʽ£¬Fosc ¶þ·ÖƵ
	//8MHz SPI start
        SPCR = (1<<SPE)|(1<<MSTR);
        SPSR |= (1<<SPI2X); //8MHz
	//8MHz SPI end	
		//SPCR = 0x53;			/* Enable SPI function in mode 3 fck/128 */
		//SPCR = (1<<SPE)|(1<<MSTR)|(1<<SPR0);
		//SPSR = 0x00;
	// perform system reset
	enc28j60WriteOp(ENC28J60_SOFT_RESET, 0, ENC28J60_SOFT_RESET);
	
	_delay_ms(50);
	
	// check CLKRDY bit to see if reset is complete
        // The CLKRDY does not work. See Rev. B4 Silicon Errata point. Just wait.
	//while(!(enc28j60Read(ESTAT) & ESTAT_CLKRDY));
	// do bank 0 stuff
	// ³õʼ»¯½ÓÊÕ»º³å
	// 16-bit transfers, must write low byte first
	// set receive buffer start address
	NextPacketPtr = RXSTART_INIT;
        // Rx start
	enc28j60Write(ERXSTL, RXSTART_INIT&0xFF);
	enc28j60Write(ERXSTH, RXSTART_INIT>>8);
	// set receive pointer address
	enc28j60Write(ERXRDPTL, RXSTART_INIT&0xFF);
	enc28j60Write(ERXRDPTH, RXSTART_INIT>>8);
	// RX end
	enc28j60Write(ERXNDL, RXSTOP_INIT&0xFF);
	enc28j60Write(ERXNDH, RXSTOP_INIT>>8);
	// TX start
	enc28j60Write(ETXSTL, TXSTART_INIT&0xFF);
	enc28j60Write(ETXSTH, TXSTART_INIT>>8);
	// TX end
	enc28j60Write(ETXNDL, TXSTOP_INIT&0xFF);
	enc28j60Write(ETXNDH, TXSTOP_INIT>>8);
	// do bank 1 stuff, packet filter:
        // For broadcast packets we allow only ARP packtets
        // All other packets should be unicast only for our mac (MAADR)
        //
        // The pattern to match on is therefore
        // Type     ETH.DST
        // ARP      BROADCAST
        // 06 08 -- ff ff ff ff ff ff -> ip checksum for theses bytes=f7f9
        // in binary these poitions are:11 0000 0011 1111
        // This is hex 303F->EPMM0=0x3f,EPMM1=0x30
	enc28j60Write(ERXFCON, ERXFCON_UCEN|ERXFCON_CRCEN|ERXFCON_PMEN);
	enc28j60Write(EPMM0, 0x3f);
	enc28j60Write(EPMM1, 0x30);
	enc28j60Write(EPMCSL, 0xf9);
	enc28j60Write(EPMCSH, 0xf7);
        //
        //
	// do bank 2 stuff
	// enable MAC receive
	enc28j60Write(MACON1, MACON1_MARXEN|MACON1_TXPAUS|MACON1_RXPAUS);
	// bring MAC out of reset
	enc28j60Write(MACON2, 0x00);
	// enable automatic padding to 60bytes and CRC operations
	enc28j60WriteOp(ENC28J60_BIT_FIELD_SET, MACON3, MACON3_PADCFG0|MACON3_TXCRCEN|MACON3_FRMLNEN);
	// set inter-frame gap (non-back-to-back)
	enc28j60Write(MAIPGL, 0x12);
	enc28j60Write(MAIPGH, 0x0C);
	// set inter-frame gap (back-to-back)
	enc28j60Write(MABBIPG, 0x12);
	// Set the maximum packet size which the controller will accept
        // Do not send packets longer than MAX_FRAMELEN:
	enc28j60Write(MAMXFLL, MAX_FRAMELEN&0xFF);	
	enc28j60Write(MAMXFLH, MAX_FRAMELEN>>8);
	// do bank 3 stuff
        // write MAC address
        // NOTE: MAC address in ENC28J60 is byte-backward
        enc28j60Write(MAADR5, macaddr[0]);
        enc28j60Write(MAADR4, macaddr[1]);
        enc28j60Write(MAADR3, macaddr[2]);
        enc28j60Write(MAADR2, macaddr[3]);
        enc28j60Write(MAADR1, macaddr[4]);
        enc28j60Write(MAADR0, macaddr[5]);
	// no loopback of transmitted frames
	enc28j60PhyWrite(PHCON2, PHCON2_HDLDIS);
	// switch to bank 0
	enc28j60SetBank(ECON1);
	// enable interrutps
	enc28j60WriteOp(ENC28J60_BIT_FIELD_SET, EIE, EIE_INTIE|EIE_PKTIE);
	// enable packet reception
	enc28j60WriteOp(ENC28J60_BIT_FIELD_SET, ECON1, ECON1_RXEN);
	usart_pstr("ENC28J60 Initialization finished!");
}

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The enc28j60 is rather sensitive to spi speed. This is all documented, but you do have to make an effort to find it. Start debugging!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

What speed do u reckon fclk÷8?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

How should I know? You haven't told me what your fclk is. I think you need to spend some time with yourself and work through the problem rather than ask questions we can't answer because you can't be bothered.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Kartman wrote:
I think you need to spend some time with yourself...

 

Hmmm...

Ross McKenzie ValuSoft Melbourne Australia

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

But it was working with this setting with different board??

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

with this setting I will get 16Mhz SPI speed, correct me if I'm wrong :

 

        SPCR = (1<<SPE)|(1<<MSTR)|(0<<SPR1)|(0<<SPR1); //fck/2
        SPSR |= (1<<SPI2X); //  fck/2 * 2 = 8Mhz x2 =  sck = 16Mhz

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I can see the board on different interface, the IP is 10.0.0.30....

but I need it to be connected on 10.0.0.20, which is LAN, how can I move it ?

 

Interface: 10.0.0.3 --- 0xa
  Internet Address      Physical Address      Type
  10.0.0.30             54-55-58-10-00-24     static
  10.0.0.138            00-26-44-a0-e1-e6     dynamic
  10.0.0.255            ff-ff-ff-ff-ff-ff     static
  224.0.0.22            01-00-5e-00-00-16     static
  224.0.0.252           01-00-5e-00-00-fc     static
  239.255.255.250       01-00-5e-7f-ff-fa     static
  255.255.255.255       ff-ff-ff-ff-ff-ff     static

Interface: 10.0.0.20 --- 0xb
  Internet Address      Physical Address      Type
  10.255.255.255        ff-ff-ff-ff-ff-ff     static
  224.0.0.22            01-00-5e-00-00-16     static
  224.0.0.252           01-00-5e-00-00-fc     static
  239.255.255.250       01-00-5e-7f-ff-fa     static
  255.255.255.255       ff-ff-ff-ff-ff-ff     static

Interface: 192.168.89.1 --- 0x14
  Internet Address      Physical Address      Type
  192.168.89.255        ff-ff-ff-ff-ff-ff     static
  224.0.0.22            01-00-5e-00-00-16     static
  224.0.0.252           01-00-5e-00-00-fc     static
  239.255.255.250       01-00-5e-7f-ff-fa     static
  255.255.255.255       ff-ff-ff-ff-ff-ff     static

Interface: 192.168.145.1 --- 0x15
  Internet Address      Physical Address      Type
  192.168.145.255       ff-ff-ff-ff-ff-ff     static
  224.0.0.22            01-00-5e-00-00-16     static
  224.0.0.252           01-00-5e-00-00-fc     static
  239.255.255.250       01-00-5e-7f-ff-fa     static

 

Thanks

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

bianchi77 wrote:
But it was working with this setting with different board??

Doesn't that make the question obvious?

 

"What was the difference between that board and this?"

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

clawson wrote:

bianchi77 wrote:

But it was working with this setting with different board??

 

Doesn't that make the question obvious?

 

"What was the difference between that board and this?"

 

the previous board ENC28J60 is on the module, now it's mounted on the board...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yes but clearly there are some other electrical difference otherwise the same code with the same chip would work identically. If you haven't changed the code it must be something in the electronics that is different. Find out what that is and change it back and the thing WILL work.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

How many beards do you have?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I have some boards, unsoldered....

Is it possible that my network setting isn't right, because I can see "Unidentified network" on my computer....??

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

How can I set my gateway ? I connect the board via a switch...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Just for once in your life try to approach this like an engineer and apply an engineering technique to it.

As I say you have two circuits. With the same code one works. the other doesn't. That says that there's some electrical difference so you get out you electrical difference investigation tools (multimeter, logic probe, oscilloscope, logic analyser, LED+resistor, etc) and you probe each circuit while they attempt to do the same thing and analyse what is different between one and the other. When you find that difference you should be very close to finding the reason why one of them is not working. Presumably there's a wire loose/misplaced or a solder bridge missing or a dry joint or a track broken or something?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Ok, I will, how about "no network access" on windows 7 property, does it matter ? thanks

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Here's the windows shot

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

But the enc28j60 only does 10mbit.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'm thinking my network setting on my computer is not right, because the other board was working ok, and I forgot already with my network setting...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

bianchi77 wrote:

I'm thinking my network setting on my computer is not right, because the other board was working ok, and I forgot already with my network setting...

 

So you are traying to connect from your Windows PC to two different boards both using an ENC28j60. Now, from your own investigation (this in itself may be the wrong wording for your way of troubleshooting) one board is working while the other does not. Why in heaven are you then concluding that the error resides within your Windows PC?

Einstein was right: "Two things are unlimited: the universe and the human stupidity. But i'm not quite sure about the former..."

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Because I changed my ip setting for something else and I have reset it..

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

What s the IP for default gateway if I use switch?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Pretty much all modern networks have a DHCP server somewhere. When an ethernet device first connects to a network to set up an IP link it sends broadcats to 255.255.255.255 which the DHCP server will process and issue it the next available IP from a local pool of subnet addresses often 192.168.0.x. In this case the gateway would almost certainly be 192168.01 and this is one of the things passed to the DHCP client when it is issued the IP address. So your local machine should be able to tell you the IP of the gateway that was retrieved during this process.

 

On the other hand it IS possible to set up a network with static/fixed IP where they are just assigned manually but surely your local PC network isn't like this?

 

A thing that commonly happens is that if you add some very dumb devices to the network (the kind of thing made with an AVR in fact) they won't have the brains to do DHCP so they must be given static/fixed IP addresses but they still need to be in the local subnet range. For example at home I have a couple of IP cameras I just picked 192.168.0.235 and 192.168.0.241 for on the basis that it was unlikely my router's DHCP would ever actually issue these addresses. Though you have to be careful on larger networks that you might accidentally set a fixed IP that was then assigned automatically by DHCP .

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

bianchi77 wrote:
Because I changed my ip setting for something else and I have reset it..

 

But then, again, for heaven's sake, and just to show us that you are in fact capable of logical arguing...

 

DON'T CHANGE ANYTHING AT YOUR PC AND DO 2 TESTS WITH YOUR 2 BOARDS AND TELL IF THERE'S A DIFFERENT RESULT. Is it that difficult to arrive at a certain form of intelligent problem analysis?

Einstein was right: "Two things are unlimited: the universe and the human stupidity. But i'm not quite sure about the former..."

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Guys - you're being trolled.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Always got accused as a troller....that's ok....fine with me...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

DON'T CHANGE ANYTHING AT YOUR PC AND DO 2 TESTS WITH YOUR 2 BOARDS AND TELL IF THERE'S A DIFFERENT RESULT ,

 

Ok, I'll start with working board before and nothing in my computer, my wifi is 10.0.0.3 and I have two interfaces in my computer....LAN and wifi...

I don't know what to do with LAN....I can connect to switch or cross cable to the board

 

What should I do with this :

 

Attachment(s): 

Last Edited: Fri. May 20, 2016 - 10:57 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I 'm trying now with :

My board Ip is 10.0.0.20
 

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Was working :

 

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Is this a clue ?

26    1.737808    QuantaCo_71:47:e0    Broadcast    ARP    42    Who has 184.86.223.195? Tell 10.0.0.2 ....is it pointing to my board ?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Is your board named Akamai?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I tried to debug here :




uint8_t enc28j60Read(uint8_t address)
{
        // set the bank
        enc28j60SetBank(address);
        // do the read
        return enc28j60ReadOp(ENC28J60_READ_CTRL_REG, address);
}

void enc28j60Write(uint8_t address, uint8_t data)
{
        // set the bank
        enc28j60SetBank(address);
        // do the write
        enc28j60WriteOp(ENC28J60_WRITE_CTRL_REG, address, data);
}

    char mac_0[10];
    uint8_t mac_0_int;

enc28j60Write(MAADR0, macaddr[5]);
//debug MAC0 vlue
	mac_0_int = enc28j60Read(MAADR0);
	sprintf(mac_0,"%.2d",mac_0_int);
	usart_pstr("MAC ADDR 0: \n");
	usart_pstr(mac_0); 
uint8_t enc28j60ReadOp(uint8_t op, uint8_t address)
{
        ENC28J60_CONTROL_CS_L;
        // issue read command
        SPDR = op | (address & ADDR_MASK);
        waitspi();
        // read data
        SPDR = 0x00;
        waitspi();
        // do dummy read if needed (for mac and mii, see datasheet page 29)
        if(address & 0x80)
        {
                SPDR = 0x00;
                waitspi();
        }
        // release CS
        ENC28J60_CONTROL_CS_H;
        return(SPDR);
}

void enc28j60WriteOp(uint8_t op, uint8_t address, uint8_t data)
{
        ENC28J60_CONTROL_CS_L;
        // issue write command
        SPDR = op | (address & ADDR_MASK);
        waitspi();
        // write data
        SPDR = data;
        waitspi();
        ENC28J60_CONTROL_CS_H;
}

Result :

ENC28J60 Test application!

ENC28J60 Initialization finished!
MAC ADDR 0:
00

ENC28J60 init!

BEFORE WHILE

 

Why MAC  = 00 ?

Init code :

// structure to allow bit field operations, name conversions: PORTA.0 -> PORT_A.b0  PORTB.7 -> PORT_B.b7
typedef struct{ uint8_t b0:1;
	uint8_t b1:1;
	uint8_t b2:1;
	uint8_t b3:1;
	uint8_t b4:1;
	uint8_t b5:1;
	uint8_t b6:1;
uint8_t b7:1; } bits;

// define all the ports of your microcontroller, add more ports depending on the available mcu ports
#define PORT_B (* (volatile bits *) &PORTB)
#define PIN_D (* (volatile bits *) &PIND)
#define DDR_B (* (volatile bits *) &DDRB)
#define PORT_E (* (volatile bits *) &PORTE)

#define ENC28J60_CONTROL_PORT	PORTB
#define ENC28J60_CONTROL_DDR	DDRB
#define ENC28J60_CONTROL_CS		PORT_B.b4
#define ENC28J60_CONTROL_CS_L 	PORT_B.b4=0x00
#define ENC28J60_CONTROL_CS_H 	PORT_B.b4=0x01

void enc28j60Init(uint8_t* macaddr)
{
	char mac_0[10];
	uint8_t mac_0_int;
	// initialize I/O

	    // ss as output:
	ENC28J60_CONTROL_DDR |= 1<<ENC28J60_CONTROL_CS;

    DDR_B.b4 = 1;

 	ENC28J60_CONTROL_CS_H; // ss=0

	DDRB  |= 1<<PB1 | 1<<PB2; // mosi, sck output

	cbi(DDRB,PINB3); // MISO is input
    
	    //
        cbi(PORTB,PB1); // MOSI low
        cbi(PORTB,PB2); // SCK low
	//
	// ³õʼ»¯ SPI
	// Ö÷»úģʽ£¬Fosc ¶þ·ÖƵ
	//16MHz SPI start
	        SPCR = (1<<SPE)|(1<<MSTR);
            SPSR |= (1<<SPI2X); //  fck/2 * 2 = 8Mhz x2 =  sck = 16Mhz
		// perform system reset
	enc28j60WriteOp(ENC28J60_SOFT_RESET, 0, ENC28J60_SOFT_RESET);
	
	_delay_ms(50);
	
	// check CLKRDY bit to see if reset is complete
        // The CLKRDY does not work. See Rev. B4 Silicon Errata point. Just wait.
	//while(!(enc28j60Read(ESTAT) & ESTAT_CLKRDY));
	// do bank 0 stuff
	// ³õʼ»¯½ÓÊÕ»º³å
	// 16-bit transfers, must write low byte first
	// set receive buffer start address
	
	//Test CS LOW by Riko 21 May 2015
	//ENC28J60_CONTROL_CS_L; // ss=0
	NextPacketPtr = RXSTART_INIT;
        // Rx start
	enc28j60Write(ERXSTL, RXSTART_INIT&0xFF);
	enc28j60Write(ERXSTH, RXSTART_INIT>>8);
	// set receive pointer address
	enc28j60Write(ERXRDPTL, RXSTART_INIT&0xFF);
	enc28j60Write(ERXRDPTH, RXSTART_INIT>>8);
	// RX end
	enc28j60Write(ERXNDL, RXSTOP_INIT&0xFF);
	enc28j60Write(ERXNDH, RXSTOP_INIT>>8);
	// TX start
	enc28j60Write(ETXSTL, TXSTART_INIT&0xFF);
	enc28j60Write(ETXSTH, TXSTART_INIT>>8);
	// TX end
	enc28j60Write(ETXNDL, TXSTOP_INIT&0xFF);
	enc28j60Write(ETXNDH, TXSTOP_INIT>>8);
	// do bank 1 stuff, packet filter:
        // For broadcast packets we allow only ARP packtets
        // All other packets should be unicast only for our mac (MAADR)
        //
        // The pattern to match on is therefore
        // Type     ETH.DST
        // ARP      BROADCAST
        // 06 08 -- ff ff ff ff ff ff -> ip checksum for theses bytes=f7f9
        // in binary these poitions are:11 0000 0011 1111
        // This is hex 303F->EPMM0=0x3f,EPMM1=0x30
	enc28j60Write(ERXFCON, ERXFCON_UCEN|ERXFCON_CRCEN|ERXFCON_PMEN);
	enc28j60Write(EPMM0, 0x3f);
	enc28j60Write(EPMM1, 0x30);
	enc28j60Write(EPMCSL, 0xf9);
	enc28j60Write(EPMCSH, 0xf7);
        //
        //
	// do bank 2 stuff
	// enable MAC receive
	enc28j60Write(MACON1, MACON1_MARXEN|MACON1_TXPAUS|MACON1_RXPAUS);
	// bring MAC out of reset
	enc28j60Write(MACON2, 0x00);
	// enable automatic padding to 60bytes and CRC operations
	enc28j60WriteOp(ENC28J60_BIT_FIELD_SET, MACON3, MACON3_PADCFG0|MACON3_TXCRCEN|MACON3_FRMLNEN);
	// set inter-frame gap (non-back-to-back)
	enc28j60Write(MAIPGL, 0x12);
	enc28j60Write(MAIPGH, 0x0C);
	// set inter-frame gap (back-to-back)
	enc28j60Write(MABBIPG, 0x12);
	// Set the maximum packet size which the controller will accept
        // Do not send packets longer than MAX_FRAMELEN:
	enc28j60Write(MAMXFLL, MAX_FRAMELEN&0xFF);	
	enc28j60Write(MAMXFLH, MAX_FRAMELEN>>8);
	// do bank 3 stuff
        // write MAC address
        // NOTE: MAC address in ENC28J60 is byte-backward
        enc28j60Write(MAADR5, macaddr[0]);
        enc28j60Write(MAADR4, macaddr[1]);
        enc28j60Write(MAADR3, macaddr[2]);
        enc28j60Write(MAADR2, macaddr[3]);
        enc28j60Write(MAADR1, macaddr[4]);
        enc28j60Write(MAADR0, macaddr[5]);
	// no loopback of transmitted frames
	enc28j60PhyWrite(PHCON2, PHCON2_HDLDIS);
	// switch to bank 0
	enc28j60SetBank(ECON1);
	// enable interrutps
	enc28j60WriteOp(ENC28J60_BIT_FIELD_SET, EIE, EIE_INTIE|EIE_PKTIE);
	// enable packet reception
	enc28j60WriteOp(ENC28J60_BIT_FIELD_SET, ECON1, ECON1_RXEN);
	usart_pstr("ENC28J60 Initialization finished! \n");
	//debug MAC0 vlue
	mac_0_int = enc28j60Read(MAADR0);
	sprintf(mac_0,"%.2d",mac_0_int);
	usart_pstr("MAC ADDR 0: \n");
	usart_pstr(mac_0);
}

Any knowledge ?

 

Thanks for concerning.....

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Look in the eratta for the enc28j60.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Wht should I give attention at errata? Tx

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ErrataAn errata sheet, describing minor operational differences from the data sheet and recommended workarounds, may exist for currentdevices. As device/documentation issues become known to us, we will publish an errata sheet. The errata will specify the revisionof silicon and revision of document to which it applies.To determine if an errata sheet exists for a particular device, please check with one of the following:•Microchip’s Worldwide Web site; http://www.microchip.com•Your local Microchip sales office (see last page)When contacting a sales office, please specify which device, revision of silicon and data sheet (include literature number) you areusing.Customer Notification System

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

That one? Probably my chip has different version? Let me see

http://ww1.microchip.com/downloa...

 

How do I know which chip I have with which errata ?

Thanks

Last Edited: Mon. May 23, 2016 - 01:25 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0
#define ENC28J60_CONTROL_DDR	DDRB
#define ENC28J60_CONTROL_CS	4

ENC28J60_CONTROL_DDR |= 1<<ENC28J60_CONTROL_CS;

Is ENC28J60_CONTROL_DDR |= 1<<ENC28J60_CONTROL_CS; equal with DDRB = 0x10; ?

 

I tried to get EREVID but got 0000, what do I miss here ?

 

Thanks

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

bianchi77 wrote:

#define ENC28J60_CONTROL_DDR	DDRB
#define ENC28J60_CONTROL_CS	4

ENC28J60_CONTROL_DDR |= 1<<ENC28J60_CONTROL_CS;

Is ENC28J60_CONTROL_DDR |= 1<<ENC28J60_CONTROL_CS; equal with DDRB = 0x10; ?

 

I tried to get EREVID but got 0000, what do I miss here ?

 

Thanks

 

Are you REALLY trying to tell us that you are not able to see if a 1 shifted left by 4 is or is not equal to 0x10?

 

What about playing with marbels or reading a comic?

Einstein was right: "Two things are unlimited: the universe and the human stupidity. But i'm not quite sure about the former..."

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Abit confuse with shifting logic ...

I made

 

#define ENC28J60_CONTROL_CS        PORT_B.b4

#define ENC28J60_CONTROL_DDR    DDRB

 

ENC28J60_CONTROL_DDR |= 1<<ENC28J60_CONTROL_CS;

 

is it equal to DDRB = 0x10, I want to activate DDRB bit 4 as output, but confuse with the define,

 

or

 

#define ENC28J60_CONTROL_CS       DDR_B.b4

#define ENC28J60_CONTROL_DDR    DDRB

 

ENC28J60_CONTROL_DDR |= 1<<ENC28J60_CONTROL_CS;

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You keep asking us questions assuming we know exactly what compiler etc. You have told us very little. Do you do this to waste our time or are you just clueless? I think we're past three years already - how much longer will this go on for?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'm using Atmel Studio 6...Please correct me if I'm wrong with those define statement...tx

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

bianchi77 wrote:
#define ENC28J60_CONTROL_CS DDR_B.b4

This syntax assumes you have something using  a struct def with bit fields to name the bits b0..b7. Do you have/use such a thing? If not stick to standard C notation.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

What's the standard one ?

 

here's what I have :

// structure to allow bit field operations, name conversions: PORTA.0 -> PORT_A.b0  PORTB.7 -> PORT_B.b7
typedef struct{ uint8_t b0:1;
    uint8_t b1:1;
    uint8_t b2:1;
    uint8_t b3:1;
    uint8_t b4:1;
    uint8_t b5:1;
    uint8_t b6:1;
uint8_t b7:1; } bits;

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You have a logic analyser that you could use to confirm this in seconds.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

This works in every C compiler on earth:

dest |= (1 << 5);

while:

dest.b5 = 1

only works if "dest" has been defined as a struct of 1 bit length bit fields called b0..b7

 

Anyway looking at your question above again:

#define ENC28J60_CONTROL_CS       DDR_B.b4

#define ENC28J60_CONTROL_DDR    DDRB

 

ENC28J60_CONTROL_DDR |= 1<<ENC28J60_CONTROL_CS;

this just looks like utter nonsense. Try expanding out the macros here and you would be looking at:

 

DDRB |= 1 << DDR_B.b4

 

given that the purpose of DDR_B.b4 is presumably to make a single bit in DDR settable using 0 and 1 then the only possible values of DDR_B.b4 would be 0 or 1 and thus this line can only mean:

 

DDRB |= 1 << 0

or

DDRB |= 1 << 1

 

So if the intention is to set bit 4 why would you use something that only sets bit 1 or bit 0. Utter nonsense.

 

To be frank your current understanding and programming skills just aren't up to a job like doing TCP/IP using an ENC28J60. You need to learn some basic C before you can attempt something that complex. Sorry to be brutal but it's a sad fact and just "guessing at stuff" is not going to write sensible C code for you and especially not for something as complex as Ethernet chips.

 

if you just want an AVR to connect to the internet why not get an Ethernet shield on an Arduino or something much simpler like that?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You need to learn some basic C

well, more BASIC than C, i guess! :-)

 

Sorry, couldn't resist...

Einstein was right: "Two things are unlimited: the universe and the human stupidity. But i'm not quite sure about the former..."

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yup I will learn more basic than C.....not a problem, life is learning for me....and you guys will give me some lessons...that would be good...

that's the point I'm joining this forum, LEARNING....

I'll make like this then ..

 

DDRB =0x16; //PB4 = CS, PB1= MOSI OUT, PB2 = SCK OUT, PB3 = MISO IN

Last Edited: Mon. May 23, 2016 - 09:35 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

and from logic analyzer....the output is not good...I do not understand....

I'm using a library and it was working before....that's why I have a question ??? Is the library stable or just another C experiment ??

Is it because I share SPI port with some chips ? or between 3.3V and 5V ?

 

Have a look on logic analyzer.....very bad....that's the chip talking to me....not in any languages only 0 and 1.....not C....

 

 

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

TEST code with low level beginner BASIC C,

first thing I want to know, what's the ID of this ENC28J60, because Kartman suggest seeing errata....different revision different treatment, there's a possibility I'm using different chip with my previous experiment...

void test_port()
{
	char mac_0[10];
	uint8_t mac_0_int;
	// initialize I/O
		DDRB =0x16; //PB4 = CS, PB1= MOSI OUT, PB2 = SCK OUT, PB3 = MISO IN !!!!!

	ENC28J60_CONTROL_CS_H; //CS=0

	cbi(PORTB,PB1); // MOSI low
	cbi(PORTB,PB2); // SCK low

	//16MHz SPI start
	SPCR = (1<<SPE)|(1<<MSTR);
	SPSR |= (1<<SPI2X); //  fck/2 * 2 = 8Mhz x2 =  sck = 16Mhz
	//16MHz SPI end

	ENC28J60_CONTROL_CS_L;
	mac_0_int = enc28j60getrev();
	sprintf(mac_0,"%.5x",mac_0_int);
	usart_pstr("EREVID: \n");
	usart_pstr(mac_0);
}

any suggestions or corrections from MASTER of C language ?

 

Last Edited: Mon. May 23, 2016 - 09:38 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If your spi is not good, what is the point of tryingvto get the id? Fix one problem at a time and don't try sucking up to us - you've been at this game for a few years now so get some self respect.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Sorry if u are felt being sucked....that s ur own thinking... like I said I learn...learning is different with sucking...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

clawson wrote:

This works in every C compiler on earth:

dest |= (1 << 5);

while:

dest.b5 = 1

only works if "dest" has been defined as a struct of 1 bit length bit fields called b0..b7

 

Anyway looking at your question above again:

#define ENC28J60_CONTROL_CS       DDR_B.b4

#define ENC28J60_CONTROL_DDR    DDRB

 

ENC28J60_CONTROL_DDR |= 1<<ENC28J60_CONTROL_CS;

this just looks like utter nonsense. Try expanding out the macros here and you would be looking at:

 

DDRB |= 1 << DDR_B.b4

 

given that the purpose of DDR_B.b4 is presumably to make a single bit in DDR settable using 0 and 1 then the only possible values of DDR_B.b4 would be 0 or 1 and thus this line can only mean:

 

DDRB |= 1 << 0

or

DDRB |= 1 << 1

 

So if the intention is to set bit 4 why would you use something that only sets bit 1 or bit 0. Utter nonsense.

 

To be frank your current understanding and programming skills just aren't up to a job like doing TCP/IP using an ENC28J60. You need to learn some basic C before you can attempt something that complex. Sorry to be brutal but it's a sad fact and just "guessing at stuff" is not going to write sensible C code for you and especially not for something as complex as Ethernet chips.

 

if you just want an AVR to connect to the internet why not get an Ethernet shield on an Arduino or something much simpler like that?

So how do u suggest me writing the definition? Thanks

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

if you just want an AVR to connect to the internet why not get an Ethernet shield on an Arduino or something much simpler like that?

Doesn't matter...there s a probability I will get stuck with arduino as well... right? No guarantee it will work n i return to the avr chip finally... no different... ..

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

It's all about narrowing down the possibilities. Most people can't cope when there is more than one problem and you most likely have a number of probably small defects that conspire to make the problem intractable. Since you don't give us much information, we have a real hard time trying to help. But I've been through all this before over the years and you're still not getting it. There's no magic in this stuff - just a bit or work. Who do you think sorts out my technical problems? I've got a few at the moment that aren't going to magically solve themselves - I actually have to do some work.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I ll give a test only one chip atmega with logic analyzer n test_port function... @kartman how do u reckon of my spi register setting? This enc28.. from I hv read... some versions sensitive with SCK speed..
And I don t know which one I hv... can not read its id yet...

Anyway thx for concerning.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

@kartkan Good luck for ur work... may I know... what series do u use? Mega ..sam?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I think I m not good on explaining my issue.... sorry if it s making u guys annoyed

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I use freescale/nxp at the office, but I'm doing web stuff at the moment in php/javascript.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I used to do php n JavaScript with linux before r u using embedded linux? I read at glance this morning about freescale... actually i wanna know.. any cheap freescale board that i can buy n play with it?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

the current work is cloud based. Linux, embedded linux,bare metal,rtos, I do it all. Sometimes all in one day.

" actually i wanna know.. any cheap freescale board that i can buy n play with it?" that's the sort of question that annoys me. Freescale/nxp make a stupid amount of different processors - you can easily Google what they are offering and find out the price - so why ask such a question? You've got a STM32F4 board, so that is similar to the higher end parts of the Kinetis range. Personally, I prefer STM32 parts as the peripherals are a bit more sensible than the Kinetis.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Please correct me if I'm wrong :

#define ENC28J60_CONTROL_PORT	PORTB
#define ENC28J60_CONTROL_DDR	DDRB

#define ENC28J60_CONTROL_CS		PORTB4
#define ENC28J60_CONTROL_CS_L 	ENC28J60_CONTROL_PORT&=~(1<<ENC28J60_CONTROL_CS)
#define ENC28J60_CONTROL_CS_H 	ENC28J60_CONTROL_PORT|=(1<<ENC28J60_CONTROL_CS)

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I got something on SPI but I haven't tested for complete REVID....

 

DDRB  = 0xB7;

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

That picture is meaningless to me. All I can see is activity - but not what that activity entails. I could suggest that there is no short circuits, but that's about all.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

bianchi77 wrote:

Please correct me if I'm wrong :

#define ENC28J60_CONTROL_PORT	PORTB
#define ENC28J60_CONTROL_DDR	DDRB

#define ENC28J60_CONTROL_CS		PORTB4
#define ENC28J60_CONTROL_CS_L 	ENC28J60_CONTROL_PORT&=~(1<<ENC28J60_CONTROL_CS)
#define ENC28J60_CONTROL_CS_H 	ENC28J60_CONTROL_PORT|=(1<<ENC28J60_CONTROL_CS)

 

 

How does the definition of PORTB4 look like? Is it a bit number (which would be correct) or a bit mask (which would be wrong)?

 

And please: if you don't know the difference, ultimately stop playing with MCUs and programming and do something more adhering to your likes and capabilities.

Einstein was right: "Two things are unlimited: the universe and the human stupidity. But i'm not quite sure about the former..."

Last Edited: Tue. May 24, 2016 - 02:24 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Please don't tell me what to do or what I LIKE to do, and speak about my capability, I"m learning, so if you're the MASTER tell me then....

DO NOT critize only but not even helping....thank you very much...if you're not interested on reading, pass it...easier...don't even click the topic....WHO ask you to click it anyway...NOT ME..

I try getting 8MHz SPI but I get 4MHz in logic analyzer

 

//8MHz SPI start
	  SPCR = (1<<SPE)|(1<<MSTR)|(0<<SPR1)|(0<<SPR0)|(0<<DORD)|(0<<CPOL);
	  SPSR = (1<<SPI2X); //fosc/2
//8MHz SPI end

Have a look....if you don't know the answer just silence...a lot easier, than speak up but saying something useless...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I read from :

http://easyelectronics.ru/img/Mo...

 

page 3....

oo....my fastest SPI on atmega is 8MHz....can I overclock it to 25MHz on its crystal ?

1. Module: MAC Interface

When the SPI clock from the host microcontroller

is run at frequencies of less than 8 MHz, reading or

writing to the MAC registers may be unreliable.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I agree that if people don't have anything to say that will help they simply should not say it.

 

Having said that I do think you have to recognise that you evidently are attempting something that appears to be beyond your current skillset and the only way to remedy that is to expand your skillset (ie learn more about C programming and things like Ethernet, TCP/IP and so on) before attempting to continue. Otherwise it's just like bubbles under the wallpaper. You may fix one of your problems in one place just to have others pop up elsewhere.

 

Moderator

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

What I DO NOT understand.....it was working ok without a problem, now with the same board and the same code...I DO NOT change anything and IT IS NOT WORKING....really ridicilus for me...

despite of I"m capable on making it  or not.... you don't have to judge like you're my MASTER or my TEACHER or already VERY GOOD IN C .....are you my MASTER ?? WHAT'S THE POINT I'M JOINING THE FORUM IF I CAN NOT ASK.... ?? that's really strange for me....

 

THAT IS WHY, I HAVE A QUESTION....if you have the situation like this....what do you have in your mind ?

 

I get 8MHz on SPI, get response from EN28J60...I keep trying....

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

We don't understand either because you haven't given us enough information. Maybe you think we magically solve problems given zero information. For years we've been telling you the same thing, but you don't listen.
So feel free to go elsewhere if you don't like the service, but i'd suggest the root cause is closer to home.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Kartman wrote:
We don't understand either because you haven't given us enough information. Maybe you think we magically solve problems given zero information. For years we've been telling you the same thing, but you don't listen.
So feel free to go elsewhere if you don't like the service, but i'd suggest the root cause is closer to home.

What information do u need?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Too late. You've burnt this bridge.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Kartman wrote:
Too late. You've burnt this bridge.

 

Yep, I'm out as well. In fact, since many months, i managed to avoid posts from bianchi77. But some days ago, i was wondering if this guy actually improved or if reading his posts would again provide some fun... It worked.

Einstein was right: "Two things are unlimited: the universe and the human stupidity. But i'm not quite sure about the former..."