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 .
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..."
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
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?
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.
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?
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...
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.
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
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... ..
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.
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...
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?
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.
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.
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..."
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
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.
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....
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.
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 s the IP for default gateway if I use switch?
- Log in or register to post comments
TopPretty 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 .
- Log in or register to post comments
TopBut 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..."
- Log in or register to post comments
TopGuys - you're being trolled.
- Log in or register to post comments
TopAlways got accused as a troller....that's ok....fine with me...
- Log in or register to post comments
TopDON'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):
- Log in or register to post comments
TopI 'm trying now with :
My board Ip is 10.0.0.20
Attachment(s):
- Log in or register to post comments
TopWas working :
Attachment(s):
- Log in or register to post comments
TopIs 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 ?
- Log in or register to post comments
TopIs your board named Akamai?
- Log in or register to post comments
TopI tried to debug here :
Result :
ENC28J60 Test application!
ENC28J60 Initialization finished!
MAC ADDR 0:
00
ENC28J60 init!
BEFORE WHILE
Why MAC = 00 ?
Init code :
Any knowledge ?
Thanks for concerning.....
- Log in or register to post comments
TopLook in the eratta for the enc28j60.
- Log in or register to post comments
TopWht should I give attention at errata? Tx
- Log in or register to post comments
TopErrataAn 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
- Log in or register to post comments
TopThat 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
- Log in or register to post comments
TopIs 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
- Log in or register to post comments
TopAre 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..."
- Log in or register to post comments
TopAbit 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;
- Log in or register to post comments
TopYou 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?
- Log in or register to post comments
TopI'm using Atmel Studio 6...Please correct me if I'm wrong with those define statement...tx
- Log in or register to post comments
TopThis 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.
- Log in or register to post comments
TopWhat'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;
- Log in or register to post comments
TopYou have a logic analyser that you could use to confirm this in seconds.
- Log in or register to post comments
TopThis works in every C compiler on earth:
while:
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:
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?
- Log in or register to post comments
Topwell, 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..."
- Log in or register to post comments
TopYup 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
- Log in or register to post comments
Topand 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....
- Log in or register to post comments
TopTEST 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...
any suggestions or corrections from MASTER of C language ?
- Log in or register to post comments
TopIf 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.
- Log in or register to post comments
TopSorry if u are felt being sucked....that s ur own thinking... like I said I learn...learning is different with sucking...
- Log in or register to post comments
TopSo how do u suggest me writing the definition? Thanks
- Log in or register to post comments
Topif 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... ..
- Log in or register to post comments
TopIt'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.
- Log in or register to post comments
TopI 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.
- Log in or register to post comments
Top@kartkan Good luck for ur work... may I know... what series do u use? Mega ..sam?
- Log in or register to post comments
TopI think I m not good on explaining my issue.... sorry if it s making u guys annoyed
- Log in or register to post comments
TopI use freescale/nxp at the office, but I'm doing web stuff at the moment in php/javascript.
- Log in or register to post comments
TopI 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?
- Log in or register to post comments
Topthe 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.
- Log in or register to post comments
TopPlease correct me if I'm wrong :
- Log in or register to post comments
TopI got something on SPI but I haven't tested for complete REVID....
DDRB = 0xB7;
- Log in or register to post comments
TopThat 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.
- Log in or register to post comments
TopHow 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 andcapabilities.Einstein was right: "Two things are unlimited: the universe and the human stupidity. But i'm not quite sure about the former..."
- Log in or register to post comments
TopPlease 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
Have a look....if you don't know the answer just silence...a lot easier, than speak up but saying something useless...
- Log in or register to post comments
TopI 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.
- Log in or register to post comments
TopI 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
- Log in or register to post comments
TopWhat 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....
- Log in or register to post comments
TopWe 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.
- Log in or register to post comments
TopWhat information do u need?
- Log in or register to post comments
TopToo late. You've burnt this bridge.
- Log in or register to post comments
TopPages