Change IP setting on fly for NXP RT1170 with freeRTOS

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

Change IP setting on fly for NXP RT1170 with freeRTOS

Jump to solution
338 Views
ping1
Contributor V

Dear all

I just started learning RTOS with RT 1170 DEV board, and would like to change IP address while it is running, I am able to change it from DHCP to static, but struggling to change it from static to DHCP, I believe I still need to call do it like it is starts up: 

 

 

        netifapi_dhcp_start(&netif);
        while (ethernetif_wait_linkup(&netif, 5000) != ERR_OK)
        {
            PRINTF("PHY Auto-negotiation failed. Please check the cable connection and link partner setting.\r\n");
        }
        (void)ethernetif_wait_ipv4_valid(&netif, ETHERNETIF_WAIT_FOREVER);

 

 But it is not running and stuck somewhere, I am new to freeRTOS. Please advise what I did wrong.

Thank you!

Ping

Tags (2)
0 Kudos
1 Solution
318 Views
ping1
Contributor V

Hi, Edwin

It does need a thread to change to DHCP just as if it starts up, and delete the thread after finished changing. It is working now.

Ping

View solution in original post

0 Kudos
4 Replies
319 Views
ping1
Contributor V

Hi, Edwin

It does need a thread to change to DHCP just as if it starts up, and delete the thread after finished changing. It is working now.

Ping

0 Kudos
320 Views
ping1
Contributor V

sorry, there is a mistake in my reply, below is what I wanted to say:

I wonder whether it needs to be done in a new thread when start DHCP again? in non OS system I just done with RT1024, change to static IP don't need to call netif_add() again, there is another api netif_set_addr(). I wonder whether there is another set of similar API to call when change to DHCP from static? 

Ping

0 Kudos
324 Views
EdwinHz
NXP TechSupport
NXP TechSupport

Hi @ping1,

It might be worth looking into the place in the code where the the execution halts to get a better insight on what the specific issue might be. That said, the most straightforward recommendation would still be to de-initialize and reinitialize the stack anyways, so I would advice you to do so and let me know if the issue persists.

BR,
Edwin.

0 Kudos
321 Views
ping1
Contributor V

Thanks for reply, Edwin

I wonder whether it needs to be done in a new thread when start DHCP again? in non OS system I just done with RT1024, change to DHCP don't need to call netif_add() again, there is another api netif_set_addr(). I wonder whether there is another set of similar API to call when change to DHCP from static? 

BR

Ping

0 Kudos