adding lwip on a existent project

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

adding lwip on a existent project

946 Views
alfredos
Contributor I

Hi!

I'm trying to add lwip support to a existent project on FRDM-K66F

First I've created a new project (freeRTOS) with lwip support (and manny others supported devices), then I've created a other project from NXP example (dhcp_lwip_freeRTOS).

Both of then are working ok, but if I try to copy the contents of the lwip_dhcp_freertos.c to the main c file into my project it can't initialize the device:

Initializing PHY...

Cannot initialize PHY.


Another problem: If I copy the files freeRTOSConfig.h and lwipopts.h from nxp example to my source folder and delete the templete folders under freertos folder and lwip folders it don't compile anymore.

Is there a tutorial or something like that on how I can add lwip with dhcp support on a existent project?

 

Thank you!

 

--- UPDATE ---

Debbuging my project I found that the code fails here:

 

//File:fsl_phyksz8081.c
    /* Check PHY ID. */
    do
    {
        result = MDIO_Read(handle->mdioHandle, handle->phyAddr, PHY_ID1_REG, &regValue);
        if (result != kStatus_Success)
        {
            return result;
        }
        counter--;
    } while ((regValue != PHY_CONTROL_ID1) && (counter != 0U));

    if (counter == 0U)
    {
        return kStatus_Fail;
    }

 

 

The variable regValue aways had 0x00.

On the example project the regValue had 0x22

 

--- UPDATE ---

A very strange thing happen, when it reads the current regValue it was 0x00 on example:

alfredos_0-1617657260360.png

regVallue are the last signaficative bits of mmfr

But when the function returns it had 0x22:

alfredos_1-1617657532080.png

The same didn't happen on my project:

alfredos_2-1617657915517.pngalfredos_3-1617657971461.png

 

Somebody can help me?

 

But when 

0 Kudos
2 Replies

287 Views
GanesanGuru
Contributor IV

Hi @alfredos @danielchen ,

 

Actually I'm too facing the same issue, rather for me I created a new project from scratch - for c++

The current values before system assert happens are as follows:

  1. Counter =0  (decremented from 1000)
  2. regValue = 65535

Since regValue hasn't reached and the Counter/PHY_READID_TIMEOUT_COUNT haven't satisfied the while loop condition - The status turns into kStatus_Fail. 

How does the things work under this hood ?

Any help is appreciated. 

0 Kudos

864 Views
danielchen
NXP TechSupport
NXP TechSupport

Hi alfredos:

 

Just an information: when you copy another folder into your MCUXpresso project, the default behavior is: this folder will be excluded from build. you need to uncheck "exclude resource from build".

danielchen_0-1622451093788.png

 

 

Regards

Daniel

0 Kudos