Ethernet Board problem

General discussion on mikroBasic PRO for AVR.
Post Reply
Author
Message
moshes
Posts: 9
Joined: 10 Jul 2010 09:33

Ethernet Board problem

#1 Post by moshes » 12 Jul 2010 08:40

I'm trying to figure out why the ethernet board not working.
I connect it to easyAVR5A (atmega32) to potb B, the cable conect to D-LINK wireless router (dsl-2650u)
I have a laptop conect wireless to the router, its IP is 10.0.0.6 and the router ip is 10.0.0.138
I can't figure out how to set the dns and the getway.

Any help is welcome

Thanks
Moshe

moshes
Posts: 9
Joined: 10 Jul 2010 09:33

Re: Ethernet Board problem

#2 Post by moshes » 13 Jul 2010 12:34

I take these parameter from the router, but still nothing:
Anyone??


Line Rate - Upstream (Kbps): 639
Line Rate - Downstream (Kbps): 3141
LAN IP Address: 10.0.0.138
Default Gateway: 46.116.128.1
Primary DNS Server: 212.143.212.143
Secondary DNS Server: 194.90.1.5
Date/Time: Tue Jul 13 14:32:53 2010

User avatar
slavisa.zlatanovic
mikroElektronika team
Posts: 1321
Joined: 07 Apr 2009 09:39

Re: Ethernet Board problem

#3 Post by slavisa.zlatanovic » 13 Jul 2010 13:56

Hi!

I've adapted the Basic Realm example (that's being distributed with compiler) for ATMEGA32.
SPI Ethernet.rar
(168.87 KiB) Downloaded 261 times
Note that you'll have to enter your network settings instead of the default ones that we use for internal testing.

Code: Select all

...
main:
  myMacAddr[0]  = 0x00
  myMacAddr[1]  = 0x14
  myMacAddr[2]  = 0xA5
  myMacAddr[3]  = 0x76
  myMacAddr[4]  = 0x19
  myMacAddr[5]  = 0x3F

  myIpAddr[0]   = 192
  myIpAddr[1]   = 168
  myIpAddr[2]   = 20
  myIpAddr[3]   = 60

  gwIpAddr[0]   = 192
  gwIpAddr[1]   = 168
  gwIpAddr[2]   = 20
  gwIpAddr[3]   = 6

  dnsIpAddr[0]  = 192
  dnsIpAddr[1]  = 168
  dnsIpAddr[2]  = 20
  dnsIpAddr[3]  = 1

  ipMask[0]     = 255
  ipMask[1]     = 255
  ipMask[2]     = 255
  ipMask[3]     = 0
...
Best regards
Slavisa
Best regards
Slavisa

moshes
Posts: 9
Joined: 10 Jul 2010 09:33

Re: Ethernet Board problem

#4 Post by moshes » 13 Jul 2010 14:33

Great, it works !! Thanks.

How can I access it from a remote computer through the web??
How to determine the IP for it?

Thanks.

These are my current setings:

myMacAddr[0] = 0x00
myMacAddr[1] = 0x14
myMacAddr[2] = 0xA5
myMacAddr[3] = 0x76
myMacAddr[4] = 0x19
myMacAddr[5] = 0x3F


' set IP address
myIpAddr[0] = 10
myIpAddr[1] = 0
myIpAddr[2] = 0
myIpAddr[3] = 10

' set gateway address
gwIpAddr[0] = 46
gwIpAddr[1] = 116
gwIpAddr[2] =128
gwIpAddr[3] = 1

' set dns address
dnsIpAddr[0] = 194
dnsIpAddr[1] = 90
dnsIpAddr[2] = 1
dnsIpAddr[3] = 5

ipMask[0] = 255
ipMask[1] = 255
ipMask[2] = 255
ipMask[3] = 0

User avatar
slavisa.zlatanovic
mikroElektronika team
Posts: 1321
Joined: 07 Apr 2009 09:39

Re: Ethernet Board problem

#5 Post by slavisa.zlatanovic » 14 Jul 2010 11:13

Hi!

Your D-LINK wireless router (dsl-2650u) must own a static IP address.
If that condition is fulfilled, then the part of code listed below determines your device's IP address:

Code: Select all

' set IP address
myIpAddr[0] = 10
myIpAddr[1] = 0
myIpAddr[2] = 0
myIpAddr[3] = 10
Best regards
Slavisa
Best regards
Slavisa

moshes
Posts: 9
Joined: 10 Jul 2010 09:33

Re: Ethernet Board problem

#6 Post by moshes » 14 Jul 2010 18:46

slavisa.zlatanovic wrote:Hi!

Your D-LINK wireless router (dsl-2650u) must own a static IP address.
If that condition is fulfilled, then the part of code listed below determines your device's IP address:

Code: Select all

' set IP address
myIpAddr[0] = 10
myIpAddr[1] = 0
myIpAddr[2] = 0
myIpAddr[3] = 10
Best regards
Slavisa

Thanks for your help.
In this case, when my router not own a ststic IP, is it possible to send a UDP messgae
from the pic to a remote IP, outside my local network?
Is the UDP function will works here?
Ethernet_sendUDP (IpAddr, 10001, 10001, "Hello", 5);

Thanks again.
Moshe

User avatar
slavisa.zlatanovic
mikroElektronika team
Posts: 1321
Joined: 07 Apr 2009 09:39

Re: Ethernet Board problem

#7 Post by slavisa.zlatanovic » 15 Jul 2010 13:36

Hi!
Is the UDP function will works here?
Ethernet_sendUDP (IpAddr, 10001, 10001, "Hello", 5);
Yes, it will work.

Best regards
Slavisa
Best regards
Slavisa

Post Reply

Return to “mikroBasic PRO for AVR General”