View previous topic :: View next topic |
Author |
Message |
krolikbest
Joined: 02 Jan 2017 Posts: 112
|
Posted: Sun Apr 05, 2020 8:42 pm Post subject: Arduino and w5100 |
|
|
Hello,
below my code
Code: |
$regfile = "m328pdef.dat"
$crystal = 16000000
$baud = 19200 ' use baud rate
$hwstack = 128 ' default use 32 for the hardware stack
$swstack = 128 ' default use 10 for the SW stack
$framesize = 128 ' default use 40 for the frame space
config portd.3 = output : W5100rst Alias portd.3
Config Spi = Hard , Interrupt = Off , Data_order = Msb , Master = Yes , Polarity = Low , Phase = 0 , Clockrate = 4 , Noss = 0
'Init the spi pins
Spiinit
wait 500
reset w5100rst
Waitms 500
Set W5100rst
Print "Init TCP"
Enable Interrupts
Config Tcpip = Int1 , Mac = 0.128.12.34.56.78 , Ip = 192.168.1.70 , Submask = 255.255.255.0 , Gateway = 192.168.1.1 , Localport = 5000 , Tx = $55 , Rx = $55 , Chip = W5100 , Spi = 1
Print "Init done"
do
loop
|
Something i'm doing wrong , because I can't ping arduino shield W5100 from my pc-machine. Can someone explaint what is wrong?
Do I think correctly that Int1 for 328 is portd.3, so reset it and then set it as I do is correct?
When i ping this shield i see that diode rx is blinking but nothing seen in the prompt window of pc-machine. |
|
Back to top |
|
|
albertsm
Joined: 09 Apr 2004 Posts: 5913 Location: Holland
|
Posted: Mon Apr 06, 2020 1:28 pm Post subject: |
|
|
you best have a look at the samples from the W5100 folder.
Code: |
Config Spi = Hard , Interrupt = Off , Data_order = Msb , Master = Yes , Polarity = Low , Phase = 0 , Clockrate = 4 , Noss = 0
'Init the spi pins
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.2
|
noint is used.
then, when you connect to your network you must pay attention : is your gateway actually 192.168.1.1 as in the example?
or does it have a different IP ?
then also check if the IP you assign to your w5100 does not exist already.
and last. do not start MAC address with a zero. _________________ Mark |
|
Back to top |
|
|
krolikbest
Joined: 02 Jan 2017 Posts: 112
|
Posted: Mon Apr 06, 2020 1:57 pm Post subject: |
|
|
Thanks for your reply, in few hours will test it. |
|
Back to top |
|
|
krolikbest
Joined: 02 Jan 2017 Posts: 112
|
Posted: Tue Apr 07, 2020 9:14 am Post subject: |
|
|
Hello
definitely something is wrong with w5100. checked examples from directory /samples/w5100/ping_spi.bas (changed regfile and crystal - Arduino and
Code: | Config Tcpip = Noint |
) and couldn't get it to work .My suspicion is that perhaps some internal registry of W5100 should be changed? I see this IP's device in scanning program but ping try return that is blocked or time elapsed. If someone has any idea according this subject...
Afret some time:
i left only this code:
Code: |
$regfile = "m328pdef.dat"
$crystal = 16000000 ' used crystal frequency
$baud = 19200 ' use baud rate
$hwstack = 128 ' default use 64 for the hardware stack
$swstack = 128 ' default use 64 for the SW stack
$framesize = 128 ' default use 80 for the frame space
Const Cdebug = 1
Config Com1 = Dummy , Synchrone = 0 , Parity = None , Stopbits = 1 , Databits = 8 , Clockpol = 0
'Configuration Of The SPI bus
Config Spi = Hard , Interrupt = Off , Data Order = Msb , Master = Yes , Polarity = Low , Phase = 0 , Clockrate = 4 , Noss = 0
'Init the spi pins
Spiinit
'we do the usual
Print "Init TCP" ' display a message
Enable Interrupts ' before we use config tcpip , we need to enable the interrupts
Config Tcpip = Noint , Mac = 12.128.12.34.56.78 , Ip = 192.168.115.170 , Submask = 255.255.255.0 , Gateway = 192.168.115.200 , Localport = 1000 , Tx = $55 , _
Rx = $55 , Chip = W5100 , Spi = 1 , Cs = Portb.2
Print "Init done"
|
and it started ping-ing, but some ping are lost. |
|
Back to top |
|
|
albertsm
Joined: 09 Apr 2004 Posts: 5913 Location: Holland
|
Posted: Tue Apr 07, 2020 1:56 pm Post subject: |
|
|
you best start with checking the circuit. maybe a buffer is used or the CS pin is not connected to the SPI CS pin?
Or there is some reset line connected.
i have no idea if you checked my earlier comments and what your knowledge about IP is.
i used w5100 for a long time but not especial with arduino. so at least post a circuit of the shield you use. and info about your gateway. using IPCONFIG /ALL will give info about thegateway. that should match the gateway in the config tcpip. _________________ Mark |
|
Back to top |
|
|
EDC
Joined: 26 Mar 2014 Posts: 971
|
Posted: Tue Apr 07, 2020 4:16 pm Post subject: |
|
|
I can tell that there is no problem for me to ping in my home network my two currently online devices like W5100 and Wiz850io.
Look at the screens. They both appear in the WNetWatcher from Nirsoft and PING straight from Windows console so I think problem is not in the Wizznet registers Even MAC can start with zeros
My Wizznets working with parameter "NOINIT" in the TCPIP CONFIG so I can compile one soft for all my devices like W5100 and after programming I set them (IP, GATE, MASK, PORT etc.) with my software and store config in the eeprom.
So at the end -> to the point.
Try use Noinit and then config Wizz with SETTCP
I think I will share my API for Bascom that work together with that PC software if I find some time... |
|
Back to top |
|
|
krolikbest
Joined: 02 Jan 2017 Posts: 112
|
|
Back to top |
|
|
krolikbest
Joined: 02 Jan 2017 Posts: 112
|
Posted: Wed Apr 08, 2020 7:47 pm Post subject: |
|
|
Ok, have found the cause why doesn't it work at home - ethernet cable. Despite other devices work on this one, my Uno with W5100 didn't. After changing to brand new is fine it took me only 20 hours to discover that |
|
Back to top |
|
|
albertsm
Joined: 09 Apr 2004 Posts: 5913 Location: Holland
|
Posted: Wed Apr 08, 2020 7:52 pm Post subject: |
|
|
ha, yes that happened to me too. crazy.
also had broken wire inside new connector cables. but that was relatively simple to find.
while i do a lot of analyzing of problems, once in a while there is a problem that eats time. and often i feel stupid when i find the cause.
glad you found the problem _________________ Mark |
|
Back to top |
|
|
|
|
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
|
|