Rowley LPC2368 on MCB2360 demo problem

deeaitch wrote on Tuesday, February 24, 2009:

Dear FreeRTOS users

I got the demo, mentioned in the subject, to work but I experience a strange problem…

When I have started the debugging process as described on the demo web page, it should be possible to enter the web server page to view the contents. But I cannot get the etnernet connection to work. What happens is that the LINK LED on the development board blinks now and then and the PC shows "100Mbit connection established" for a second. Then the connection is lost again. This repeats over and over again.

Now. If I halt the debugger for a few seconds and then continue the dugging, the LINK LED stays litten and I can connect to the web server via IE.

So, it is only possible to establish ethernet connection if I first start the debugging, then pause it, then continue it again.

After a closer look, I see that the problem starts when the vTaskStartScheduler() is called. If I pause the debugger for a short while, then the connection works.

What is the reason, and possible solution, for this problem?

/Dee

davedoors wrote on Tuesday, February 24, 2009:

The hardware you are using is not quite the same as used by the standard demo. Is the PHY used on the MCB2360 the same as the one used on the MCB2368?

davedoors wrote on Tuesday, February 24, 2009:

Also the code contains some delays used to wait for the ethernet link to be established. Maybe the delays need to be longer on your hardware or network.  Search for vTaskDelay in the ethernet source code and increase the times a bit.

ringzro wrote on Tuesday, February 24, 2009:

Don’t know anything about your board, but the “This repeats over and over again” phrase sounds like a reset from some reason. Is your debugger stopping some timers/watchdogs/etc?

deeaitch wrote on Tuesday, February 24, 2009:

Hi davedoors.

Your idéa is correct!
I had a look in emac.c and notice the hardware init function. Inside I changed the delay time in the following part:

  /* Wait for hardware reset to end. */
  for (tout = 0; tout < 100; tout++) {
    vTaskDelay( 1000 );
    regv = read_PHY (PHY_REG_BMCR);
    if (!(regv & 0x8000)) {
      /* Reset complete */
      break;
    }
  }

I changed vTaskDelay( 1 ); to vTaskDelay( 1000 );

Now it works!

Thanks a bunch.

/Dee

deeaitch wrote on Tuesday, February 24, 2009:

Hello again…

I would like to add that this part is perhaps more interesting

  /* Check the link status. */
  if( xReturn == pdPASS )
  {
    xReturn = pdFAIL;
    for (tout = 0; tout < 10; tout++) {
      vTaskDelay( 1000 );
      regv = read_PHY (PHY_REG_STS);
      if (regv & 0x0001) {
        /* Link is on. */
        xReturn = pdPASS;
        break;
      }
    }
  }

I changed vTaskDelay( 100 ); to vTaskDelay( 1000 );

This solution works also. =)

/Dee