Arduino UNO + VMA04 - Example sketch hangs at .begin()

Hi everyone,

I can’t seem to get my Ethernet shield to work. I’ve tried several libraries (from website and forum) and keep getting the same results. The ka04_sample_code.zip version from the website gives compilation errors with prog_char, but I managed to resolve those using the version I found on the forum: viewtopic.php?p=77099#p77099

Using Arduino IDE 1.6.10 and the EtherCard library from above mentioned post, I can compile and upload the example sketch to my Arduino Uno without warnings or errors.
Checking the Serial Monitor gives the following output:

[Starting the Arduino Server]
MAC: 74:69:69:2D:30:31

The code hangs at the statement (since it never prints “Failed to access Ethernet controller” or “Setting up DHCP (this can take a while…)”):

if (ether.begin(sizeof Ethernet::buffer, mymac) == 0)

I have tried to use an older Arduino IDE (1.6.7, since that’s the version used with the post mentioned above), but I have the same result.

Any ideas?

Also, I found some posts about people with the same issues, but they were testing it on an Arduino Mega. For them it seemed to work on Arduino Uno. I am working with the UNO, so I assume nothing needs to be changed to the library itself.

I also want to note that I studied computer science so programming is not a problem. Any help or questions in terms of troubleshooting can be quite in-depth. Next thing I will check is some debugging of the EtherCard library itself and see which sub-function of ether.begin is blocking the call. That might give me insight on what is happening.

Today I found the reason for the sketch hanging at .begin():

Whenever I plug something else on top of the shield in the 5V pin, it hangs at .begin(). If I remove that wire from the 5V pin and reset the board, the shield successfully runs the .begin() statement and gets a IP address from the DHCP server.

Any ideas why connecting something to the 5V pin makes the sketch stall at .begin ? (The part connected is a CNY70 sensor with a 82ohm resistor for the emitter and a 20k ohm resistor for the detector)

You can download the schematics from here.
http://www.vellemanusa.com/downloads/0/illustrated/illustrated_assembly_manual_ka04.pdf

Since I don’t have one so this is just a guess.
It looks like if the 5 volts goes low it activates the reset on the VMA04.
Maybe the other board is pulling the 5volts down.

I did some measuring and the other board takes about 40mA at 5V. Then I tested with an external power source instead of the USB port in my computer and this seems to fix the problem. I guess my USB port in the computer just did not offer enough power :slight_smile:

Thanks for the input Wrong Way!

No problem
Glad you have it sorted out.

replace [color=#800000]if (ether.begin(sizeof Ethernet::buffer, mymac) == 0)[/color] with[color=#00BF00] if (ether.begin(sizeof Ethernet::buffer, mymac, 10) == 0)[/color]