Problem during initialization
Ethernet Chips
No replies yet. Be the first to reply.
Join the discussion.
Ethernet Chips
No replies yet. Be the first to reply.
Join the discussion.
Share projects and connect with makers.
Joined before the site update? first.
New to WIZnet Makers?
We sent a verification link to your address. Open it to activate your account, then log in.
Accounts from this email provider are reviewed by an administrator after verification. Approval usually takes one business day.
Already have an account?
Enter your email address. If it belongs to an account, we'll send a link to set a new password. Members who joined before the site update use this to set their password.
If an account uses that address, we sent a link to set a new password. The link works once and expires in 30 minutes.
Know your password?
Need an account?
RE: Problem during initialization
by Eugeny ·
Do you have only one device, or several behaving the same way?
From my experience ACT LED is being flashed if there’s any activity on the network, not just an activity for the chip’s sockets. Anyway, the fact that LED flashes shows that PHY works and W5500’s network capture part also functional.
I think it may be a good idea to use Wireshark to see what is going on between W5500 and the host, if there’re any packets sent by W5500 (e.g. maybe invalid ones or targeted for another network node). The best you put host with Wireshark running between W5500 and router (e.g. configuring Windows or Linux machine as bridge) so that you see activity from the “first hands” (without any filtering at the router side).
You also need to set IP mask. What MAC address you set?
This means that MCU side of W5500 also functions properly.
Can you share circuit diagram, including MCU side?
I am looking into the sources related to ctlwizchip, and see it invokes wizchip_sw_reset.
I am astonished to see how it handles end of software reset. It just introduces delay using getMR(), hoping that chip finishes its software reset during its execution. That should not be the right thing to do. The right way would be reading MR until its MR_RST bit is reset, in other words
Please modify this routines in your project and see if it helps.
RE: RE: Problem during initialization
by somnatic ·
Eugeny, thanks for replying, I’ll try to post the schematics tomorrow when I have access to them.
As for your questions/suggestions:
Thanks for your suggestions so far - I’ll try to come up with schematics and maybe more news tomorrow.
RE: Problem during initialization
by Eugeny ·
One more thing then - use scope to prove that you comply to reset timing (5 ms low then 5 ms high as you say, see 5.5.1 in datasheet). The reason is your MCU not starting programming W5500 before it is ready, that’s why software reset, after power on, with checking MR_RST flag to turn off is a good idea in general.
RE: Problem during initialization
by somnatic ·
Eugeny, I tried some of your ideas:
BUT
The idea of trying to get some information using Wireshark was a good one. I didn’t mention that except from the main TCP communications the device uses UDP packets to announce itself to whoever is listening on the network (broadcast). Within this broadcast, it also explicitly specifies its IP settings.
When looking at those, I could determine that those were set to 0.0.0.0 for IP, Netmask, Gateway; yet, DNS was set correctly. Further debugging showed that whenever the values were set in such way, it couldn’t be pinged (I do a write and then a readback but no explicit checking as I assumed that this works). That makes sense, pinging was impossible, the UDP broadcast worked as it doesn’t really require a valid source address.
I then added a 100ms delay before calling ctlnetwork (the call where I setup IP, …). Using this approach, I wasn’t able to reporoduce the problem, yet this seems like a bad solution to me. I reduced it to 10ms and the problem re-appeared (only very seldom, but it did). I have now added a while loop to continuously set the ip address (and also state the number of tries) and am currently trying to reproduce the behaviour or to get a readout of more than 1.
Now the main question: Can anyone give me an indication why a delay of 100ms could be of use before ctlnetwork? Does the device perform any initialization; Why would IP, SN, GW invalid but DNS ok?
RE: Problem during initialization
by Eugeny ·
I did not run in such problems most probably for simple reason - never started initialization just after power up. But I had similar issue with Altera FPGAs, when one of its IP blocks did not function properly just after power up, and their support and engineering was unable to answer what to do to make it operational so that I can start configuring it just after power on. The workaround was doing some actions several times, and wait some time, which I was also uncomfortable with, however it seemed to work.
You case may be the same. If you find 100 ms delay working, and you really do not need to initialize and use W5500 just after power up, stick to it until you find the good solution. For example, if I would be designing W5500, I would still have bit 7 of the MR set during its hard initialization after hardware reset or power up, e.g. code would look this way:
I would not use ctlnetwork procedure at all because it performs wrong and unneeded tasks for the power up/initial configuration moment - reads SHAR, GAR, SUBR and SIPR when it is not needed. Probably doing it while chip is not ready yet makes it crazy.
DNS information is NOT a part of chip configuration, and will not affect chip’s functionality. It is needed to perform DNS request using UDP socket type.
RE: Problem during initialization
by somnatic ·
Hi Eugeny
Regarding DNS you’re right - it’s also the only register which is not written during wizchip_sw_reset. I have now changed the code to what you’re suggesting, let’s see how it turns out.
In the meanwhile, I was able to catch a single happening where it couldn’t write the registers. It took the controller 647 tries (no wait time in between) until it was successful. I’ll have to check which time duration we’re talking about here. I then turned off power, and turned it back on and the device was able to write the data on the first try again (as is the usual case).
It would be nice if someone from Wiznet could comment this issue. Specifying a reset duration of 1ms which sometimes works but sometimes doesn’t is just not right.
RE: Problem during initialization
by somnatic ·
Alright; apparently your code didn’t really help - the issue just appeared again; this is time I measured the duration and it was around 18ms. Any info what that could be?