Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

ARP generator

 
Post new topic   Reply to topic    www.mcselec.com Forum Index -> EASY TCP/IP
View previous topic :: View next topic  
Author Message
uhrmacher

Bascom Member



Joined: 15 Sep 2005
Posts: 60
Location: Donauwoerth

germany.gif
PostPosted: Fri Oct 23, 2015 10:08 am    Post subject: ARP generator Reply with quote

Hi,

for an machine network, i have still connected a notebook to the network of the machine to generate an ARP request....
but its silly to use an notebook, simply to be plugged on the network "only to be there"

so i have done a arduino ethernet shield trying to make a "notebook simulation" to the net. The arduino has nothing else to do, as to "be there"
and sendig an ARP request, as the Win TCP/IP v4 of windows does.

now my question, how should i do the config in bascom? I have seen in arduino cod it is simply this:

byte mac [] = {0x00, 0x22, 0x20, 0x0D, 0xC4, 0x21};
IPAddress ip (193,0,161,10);

String HTTP_requ = "";

void setup{
Ethernet.begin(mac, ip);
Server.begin()


but i like to make it as usual in bascom,

as far i have configured the W5100 chip:



config tcpip = NOINT , MAC = 0.34.32.13.4 , IP = 193.0.161.10 , Submask = 255.255.255.0 , Gateway = 193.0.161.1 , Localport = 1000 , TX =$55 , RX = $55 , Chip = W5100 , Spi = 0

and now? i have no idea to find a similar to "ethernet.begin" and "Server.begin"

i tried different ways with socket.... but missed all...


any help is very welcome!



best regards
uhrmacher
Back to top
View user's profile Visit poster's website
albertsm

Administrator



Joined: 09 Apr 2004
Posts: 5921
Location: Holland

blank.gif
PostPosted: Fri Oct 23, 2015 10:19 am    Post subject: Reply with quote

just create a socket in listen mode. so check out the tcp or udp server samples.
when you start listening an ARP is sent so your IP and MAC are known.

_________________
Mark
Back to top
View user's profile Visit poster's website
bzijlstra

Bascom Ambassador



Joined: 30 Dec 2004
Posts: 1179
Location: Tilburg - Netherlands

netherlands.gif
PostPosted: Fri Oct 23, 2015 1:23 pm    Post subject: ARP Reply with quote

If you get a response on a PING, ARP is working.

Have fun
Ben Zijlstra
Back to top
View user's profile Visit poster's website
albertsm

Administrator



Joined: 09 Apr 2004
Posts: 5921
Location: Holland

blank.gif
PostPosted: Fri Oct 23, 2015 1:29 pm    Post subject: Reply with quote

Hi Ben, good that you shine some light on this.
in that case, you do not even need to use a socket. After the config tcpip, you already get a response from a ping.

_________________
Mark
Back to top
View user's profile Visit poster's website
uhrmacher

Bascom Member



Joined: 15 Sep 2005
Posts: 60
Location: Donauwoerth

germany.gif
PostPosted: Mon Oct 26, 2015 2:23 pm    Post subject: Reply with quote

Hi Mark,

as Ben says, i have :



config Tcpip = Noint, MAC = 00.34.32.13.196,33 , IP = 193.0.161.10 , Submask = 255.255.255.0 , Gateway = 192.168.1.1 , localport = 1000 , Tx = $55 , RX = $55 , Chip = W5100 , SPI = 1


if i ping the device on win commandline with: c:\users\Administrator\ping 193.0.161.10

the response is:


Ping wird ausgeführt für 193.0.161.10 mit 32 byte Daten:
Antwort von 193.0.161.5: Zielhoste nicht erreichbar
Antwort von 193.0.161.5: Zielhoste nicht erreichbar
Antwort von 193.0.161.5: Zielhoste nicht erreichbar
Antwort von 193.0.161.5: Zielhoste nicht erreichbar

Ping Statistik für 193.0.161.10:
Pakete gesendet = 4, Empfangen = 4 , Verloren = 0


if i execute the arduino code on the SAME hardware it responses:
Antwort von 193.0.161.10: Bytes = 32 Zeit < 1ms TTL = 128
Antwort von 193.0.161.10: Bytes = 32 Zeit < 1ms TTL = 128
Antwort von 193.0.161.10: Bytes = 32 Zeit < 1ms TTL = 128
Antwort von 193.0.161.10: Bytes = 32 Zeit < 1ms TTL = 128


so far, with same hardware, with arduino code ( as outlined in my first comment..) pings ok, but i am not able to find the reason
in my bascom code why it will not response same way.
do i still overseen something or wrong configured??
Back to top
View user's profile Visit poster's website
albertsm

Administrator



Joined: 09 Apr 2004
Posts: 5921
Location: Holland

blank.gif
PostPosted: Mon Oct 26, 2015 2:31 pm    Post subject: Reply with quote

you post just 1 line. what do i need to make of it? please post complete code not fragments.
but here a fragment too from one of the samples :

Config Spi = Hard , Interrupt = Off , Data_order = Msb , Master = Yes , Polarity = Low , Phase = 0 , Clockrate = 4 , Noss = 0
Spiinit

Config Tcpip = Noint , Mac = 12.128.12.34.56.78 , Ip = 192.168.1.70 , Submask = 255.255.255.0 , Gateway = 192.168.1.1 , Localport = 1000 , Tx = $55 , Rx = $55 , Chip = W5100 , Spi = 1 , Cs = Portb.4

_________________
Mark
Back to top
View user's profile Visit poster's website
bzijlstra

Bascom Ambassador



Joined: 30 Dec 2004
Posts: 1179
Location: Tilburg - Netherlands

netherlands.gif
PostPosted: Mon Oct 26, 2015 2:38 pm    Post subject: Gateway not correct Reply with quote

Your IP address, mask and gateway combination can not work.

193.0.161.10 with a mask 255.255.255.0
Your gateway should be in the range
193.0.161.1 - 193.0.161.254

Check a subnet calculator on the Internet.

Have fun
Ben Zijlstra
Back to top
View user's profile Visit poster's website
uhrmacher

Bascom Member



Joined: 15 Sep 2005
Posts: 60
Location: Donauwoerth

germany.gif
PostPosted: Wed Oct 28, 2015 8:10 am    Post subject: Reply with quote

God morning Mark, Ben,

sorry that i not post complete code gentlemen so here it is:

@ BEN: i have had corrected the standard gateway to 193.0.161.1. but response is

Ping wird ausgeführt für 193.0.161.10 mit 32 byte Daten:
Antwort von 193.0.161.5: Zielhoste nicht erreichbar
Antwort von 193.0.161.5: Zielhoste nicht erreichbar
Antwort von 193.0.161.5: Zielhoste nicht erreichbar
Antwort von 193.0.161.5: Zielhoste nicht erreichbar
Ping Statistik für 193.0.161.10:
Pakete: Gesendet = 4, Empfangen = 4, Verloren =0


@ Mark: today morning i have included the config spi.
Cs = PortB.4 would refer on arduino board to Pin27 but that is "MISO" . I changed to PortB.2 just trying if it match to the SS Input Pin29 of the W5100 chip, but both variants won´t work.
hm, i believe that there is a hardware difference on the arduino ethernet board which do not comply to the definitions in bascom lib but i am not shure.

for that to investigate i have added also the arduino ethernet board schematic to this post,



the code here:

[code]
$regfile = "M328def.dat"
$hwstack = 128
$swstack = 128
$framesize = 128
$crystal = 16000000

Open "Com1:" As Binary As #1
Config Serialin = Buffered , Size = 254
Const Baudvalue = 115200
Baud = Baudvalue '

print #1 , "arduino bascom"

Config SPI = Hard , Interrupt = off , Data Order = Msb , Master = yes , Polarity = Low , Phase = 0 , Clockrate = 4 , Noss = 0
spiinit

enable interrupts

Config Tcpip = NOINT , MAC = 00.34.32.13.196.33 , IP = 193.0.161.10 , Submask = 255.255.255.0 , Gateway = 193.0.161.1 , Localport = 1000 , Tx = $55 , Rx = $55 , Chip = W5100 , Spi = 1 , Cs = PortB.4
'
print #1 , "tcpip configured.."

do
'print #1 , "arduino bascom" ' this is only to see its live or not.....
loop

[/code]

---------------------------------------------------------------------------------------------------------------------------------


to compare, here the arduino code:


[code]
#include <SPI.h>
#include <Ethernet.h>
#include <EthernetClient.h>
#include <EthernetServer.h>



byte mac[] = {0x00, 0x22, 0x20, 0x0D, 0xC4, 0x21 }; // MAC Adress
IPAddress ip (193,0,161,10); // address in Cigalhe IP range
EthernetServer server (80);

String HTTP_req = "";


void setup(){
Serial.begin(115200);
Ethernet.begin(mac, ip); // start ethernet connection using fixed IP
server.begin();
}



void loop() {
Serial.print("life");
}[/code]


----------------------------------------------------------------------------------------

best regards
Ingolf
Back to top
View user's profile Visit poster's website
albertsm

Administrator



Joined: 09 Apr 2004
Posts: 5921
Location: Holland

blank.gif
PostPosted: Wed Oct 28, 2015 9:50 am    Post subject: Reply with quote

i do not see a circuit?
the arduino code is not of importance, but the circuit is. the lib was developed for a chip or wiznet module. but as you can see from the sample, it was tested with an arduino board as well.

_________________
Mark
Back to top
View user's profile Visit poster's website
bzijlstra

Bascom Ambassador



Joined: 30 Dec 2004
Posts: 1179
Location: Tilburg - Netherlands

netherlands.gif
PostPosted: Wed Oct 28, 2015 10:18 am    Post subject: Ip settings PC Reply with quote

What are the IP-settings of the PC you are using?

There is something strange, you get something about 193.161.1.5

There is some more info about connecting the W5100 to an Atmega168 on my homepage at

Http://members.home.nl/bzijlstra
Do a search on wiz810mj

Have fun
Ben Zijlstra
Back to top
View user's profile Visit poster's website
uhrmacher

Bascom Member



Joined: 15 Sep 2005
Posts: 60
Location: Donauwoerth

germany.gif
PostPosted: Wed Oct 28, 2015 1:39 pm    Post subject: Reply with quote

Mark: i agree, the schematic is the more important part.....ah, the pdf was gone.....here it is attached..... please rename extension txt to PDF! thanks!

Ben: the IP setting of the PC:

ip adresses are fix....

ip adress = 193.0.161.5
Subnet mask = 255.255.255.0
standard gateway = 193.0.161.1
Back to top
View user's profile Visit poster's website
bzijlstra

Bascom Ambassador



Joined: 30 Dec 2004
Posts: 1179
Location: Tilburg - Netherlands

netherlands.gif
PostPosted: Wed Oct 28, 2015 2:30 pm    Post subject: Reply with quote

Have seen the PDF.

Why are you not using the correct def file
M328pdef.dat should be used.

It is an standard Arduino shield.

If I check you PING attempt your Arduino is not reacting. Do you have a link on your RJ45 connector, and on your switch?

Must be something you are overlooking, I bet there are more than 100.000 Arduino running with a W5100 and perhaps half of them with Bascom software.

And what about a step by step following of the tutorial for the W5100, just to check what is wrong.

Another suggestion, a crosscable from your PC to the Arduino?

Ben Zijlstra
Back to top
View user's profile Visit poster's website
albertsm

Administrator



Joined: 09 Apr 2004
Posts: 5921
Location: Holland

blank.gif
PostPosted: Wed Oct 28, 2015 4:52 pm    Post subject: Reply with quote

'enable interrupts remark that

Config Tcpip = NOINT , MAC = 00.34.32.13.196.33 , IP = 193.0.161.10 , Submask = 255.255.255.0 , Gateway = 193.0.161.1 , Localport = 1000 , Tx = $55 , Rx = $55 , Chip = W5100 , Spi = 1 , Cs = PortB.4

CS should be portb.2 according to the circuit.
you might need to check portd.4 since it appears to be connected to SPI as well for the SD card. So make sure it is not 0.

_________________
Mark
Back to top
View user's profile Visit poster's website
Paulvk

Bascom Member



Joined: 28 Jul 2006
Posts: 1257
Location: SYDNEY

australia.gif
PostPosted: Thu Oct 29, 2015 1:09 am    Post subject: Reply with quote

There is one thong I have found using the Arduino 2560 and the W5100 shield
I need to press the reset button so the W5100 takes the settings
I ran a cable from a port pin with a 100nF capacitor in series to the W5100 reset
I toggle the port pin after sending the settings to the W5100 then it comes to life


Regards Paul
Back to top
View user's profile
Display posts from previous:   
Post new topic   Reply to topic    www.mcselec.com Forum Index -> EASY TCP/IP All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum