# Ethernet is not working with BL4S200 board.

**URL:** <https://forums.digi.com/t/ethernet-is-not-working-with-bl4s200-board/11571>\
**Category:** Rabbit\
**Tags:** ehternet\
**Created:** [June 10, 2013, 1:21am UTC](https://forums.digi.com/t/ethernet-is-not-working-with-bl4s200-board/11571 "2013-06-10T01:21:28Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![spprem.6](https://avatars.discourse-cdn.com/v4/letter/s/73ab20/32.png) [@spprem.6](https://forums.digi.com/u/spprem.6)\
**Post date:** [June 10, 2013, 1:21am UTC](https://forums.digi.com/t/ethernet-is-not-working-with-bl4s200-board/11571/1 "2013-06-10T01:21:28Z")

</div>

Hi  
I had a problem with BL4S200 board. I disconnected ethernet cable from board and left it disconnected for 6 minutes. After that I connected cable but I could not received any packets and ethernet socket leds were not blinking. I thought it is because of sleep feature of ethernet controller ic(AX88796BLI). Then I commented code that is forcing ic to go to D2 sleep mode but it didn’t help me much.  
Any ideas…  
Thanks in advance.

---

<div class="post-metadata">

**Author:** ![trooper2](https://avatars.discourse-cdn.com/v4/letter/t/edb3f5/32.png) [@trooper2](https://forums.digi.com/u/trooper2)\
**Post date:** [June 25, 2013, 1:00pm UTC](https://forums.digi.com/t/ethernet-is-not-working-with-bl4s200-board/11571/2 "2013-06-25T13:00:29Z")

</div>

You can use pd\_havelink() to test the cable and close the connection if no cable is detected:

/\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
CABLE\_DETECT.C  
Puck Curtis  
May 18, 2007

```
This is an easy way to test whether an Ethernet cable is connected.

```

1. Run the program.
2. Ping the device to validate the connection.
3. Remove the Ethernet cable from the Rabbit.
4. The Ethernet connection will close and then attempt to reopen.
5. Plug the Ethernet cable back in.
6. The connection should come back up and you can ping it.

\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*/

/\*

- NOTE: Since we are manually configuring the device, we are
- intentionally NOT using the TCP\_CONFIG.LIB setup. This means that
- you will need to set your default network configuration in the LOCAL\_\*
- macros below.  
\*/  
#define TCPCONFIG 0

/\*

- USE\_ETHERNET must be defined. This definition simply means that we are
- using the first (and probably only) physical Ethernet interface.  
\*/  
#define USE\_ETHERNET 0x01

/\*

- The following macros define the network setup of the physical Ethernet
- interface. The virtual Ethernet interfaces will be the subsequent IP
- addresses (e.g., “10.10.6.113”, “10.10.6.114”, “10.10.6.115”).  
\*/  
#define LOCAL\_IP “192.168.1.197”  
#define LOCAL\_NETMASK “255.255.255.0”  
#define LOCAL\_GATEWAY “192.168.1.1”

#memmap xmem  
#use “dcrtcp.lib”

void main(void)  
{  
char Connected\_Flag; //Flag variable wsed to store the state of the cable

// Initialize the TCP/IP stack  
sock\_init();

while (1)  
{  
// Perform network configuration on the Ethernet ineterface  
printf("Bringing up Main Interface  
");  
ifconfig(IF\_ETH0,  
IFS\_IPADDR, aton(LOCAL\_IP),  
IFS\_NETMASK, aton(LOCAL\_NETMASK),  
IFS\_ROUTER\_SET,aton(LOCAL\_GATEWAY),  
IFS\_UP,  
IFS\_END);

```
// Wait for the interface to come up
while (ifpending(IF_ETH0) == IF_COMING_UP) {
		tcp_tick(NULL);
	}
printf("Interface is up!!

```

");  
Connected\_Flag = 1;

```
	while(Connected_Flag)	//Loop while the cable is plugged in
	{
		costate
		{
        tcp_tick(NULL);	//Drive the TCP stack
		}

		costate
		{
        // Test the cable and close the connection if no cable is detected
        if (pd_havelink(IF_ETH0) == 0)
			{
				Connected_Flag = 0;
				printf("Cable unplugged!!

```

");  
}  
}  
}

```
// Bring down the main Ethernet interface
printf("Bringing down Main Interface!!

```

");  
ifconfig(IF\_ETH0,  
IFS\_DOWN,  
IFS\_END);

```
// Wait for the interface to come down
while (ifpending(IF_ETH0) != IF_DOWN) {
		tcp_tick(NULL);
	}
printf("Interface is down!!

```

");  
}  
}
