lwIP: S32 design studio-netifadd()

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

lwIP: S32 design studio-netifadd()

719 Views
saad_saeed
Contributor III

Hello,

Before telling you about my problem. I will provide you with an example code that is present in MCU expresso design studio SDK example frdmk64_lwip_tcp_echo_freertos

"

int main(void)
{

SYSMPU_Type *base = SYSMPU;
//COnfigure pin routing features
BOARD_InitPins();
//Initilize boot clock configration
BOARD_BootClockRUN();
//Initilze debug console
BOARD_InitDebugConsole();
base->CESR &= ~SYSMPU_CESR_VLD_MASK;
static struct netif fsl_netif0;
strcpy(fsl_netif0.name,"en");
ip4_addr_t fsl_netif0_ipaddr, fsl_netif0_netmask, fsl_netif0_gw;
ethernetif_config_t fsl_enet_config0 = {.phyAddress = TL_PHY_ADDRESS, .clockName = TL_CLOCK_NAME, .macAddress = TL_MAC_ADDR,};
IP4_ADDR(&fsl_netif0_ipaddr, TL_IP_ADDR0, TL_IP_ADDR1, TL_IP_ADDR2, TL_IP_ADDR3);
IP4_ADDR(&fsl_netif0_netmask, TL_NET_MASK0, TL_NET_MASK1, TL_NET_MASK2, TL_NET_MASK3);
IP4_ADDR(&fsl_netif0_gw, TL_GW_ADDR0, TL_GW_ADDR1, TL_GW_ADDR2, TL_GW_ADDR3);
tcpip_init(NULL, NULL);
netifapi_netif_add(&fsl_netif0, &fsl_netif0_ipaddr, &fsl_netif0_netmask, &fsl_netif0_gw, &fsl_enet_config0,ethernetif0_init, tcpip_input);
netifapi_netif_set_default(&fsl_netif0);
netifapi_netif_set_up(&fsl_netif0);
//Main function of my application. After that freeRTOS tasks get created and my application starts
transport_main_freertos();
return 0;
}

"

Here you can clearly see, that my network interface are getting initialised in non-freeRTOS task.As soon as the network interface are initialised. My library function transport_main_freertos() is executed which consist of three task that have priority 3, 4, 4 respectively are created ans everything works fine

Now lets come to my problem

I have to shift my whole code to s32DesignStudio because of the hardware requirements (Previously, I was using FRDMK64. Now, I am using S32K148). The problem I am facing is that the functions which were executing in nonFreeRtos threads are now getting executed in FreeRTOS  threads. My requirement is that I want to execute these functions in nonFreeRTOS threads. 

An example of my code is

static struct netif fsl_netif0;
strcpy(fsl_netif0.name,"en");
ip4_addr_t fsl_netif0_ipaddr, fsl_netif0_netmask, fsl_netif0_gw;

//This function is not present is s32Design studio. What should I use here ?
//ethernetif_config_t fsl_enet_config0 = {.phyAddress = TL_PHY_ADDRESS, .clockName = TL_CLOCK_NAME, .macAddress = TL_MAC_ADDR,};
IP4_ADDR(&fsl_netif0_ipaddr, TL_IP_ADDR0, TL_IP_ADDR1, TL_IP_ADDR2, TL_IP_ADDR3);
IP4_ADDR(&fsl_netif0_netmask, TL_NET_MASK0, TL_NET_MASK1, TL_NET_MASK2, TL_NET_MASK3);
IP4_ADDR(&fsl_netif0_gw, TL_GW_ADDR0, TL_GW_ADDR1, TL_GW_ADDR2, TL_GW_ADDR3);
tcpip_init(NULL, NULL);
netif_set_default(netif_add(&fsl_netif0, &fsl_netif0_ipaddr, &fsl_netif0_netmask, &fsl_netif0_gw, NULL,enet_ethernetif_init, tcpip_input));
netif_set_up(&fsl_netif0);
while(1){}

As you can see, 

The struct fsl_enet_config0  present in the above code is not present in the s32 design studio example lwips32k148 Currently I am passing NULL but what should I use here?

The problem I am facing is that the network interface are initialized inFreeRTOS task with priority 1.  The application I am working has three threads which are working on priority >=3. As soon my application tasks are created the mainLoopTask() is preempted with higher priority tasks and my pings stop working.

I hope that you have a good idea about my problem.

Kind Regards,

Saad 

Labels (1)
0 Kudos
0 Replies