cancel
Showing results for 
Search instead for 
Did you mean: 

LwIP: set IP address, mask, and Gateway address of stm32 remotely

abeba.1
Associate III

hii every one 

 

i have a question about setting up the ip of the STM32 MCU remotely 

 

when we want to do client server in udp or tcp on stm32 controller , we are used to set the ip address manually in the ioc file in general settings in the lwip section in the middleware tab .

 

and i was wondering if there is a way to set up any default ip of mine , and is there a way to change this ip remotly after i am connected to the stm32 .

 

my goal is to design an application that can give me the ability to access and change the ip and mask and gateway of my stm32 controller , i be very thankful for help and to know if there is a method to do that  

1 ACCEPTED SOLUTION

Accepted Solutions

You said, "we are used to set the ip address manually in the ioc file in general settings in the lwip section in the middleware tab" - so you already have this working?

So that code is your example!

That is the code that you browse, find the settings, then modify...

Did you try the internet search?

eg, https://www.google.com/search?q=LwIP+set+IP+address

View solution in original post

6 REPLIES 6
Javier1
Principal

The ioc file from cubeMx as i understood is just a point and click User Interface that generates code.

Here is what i would do:

  1. Just put your project inside the version control of your choice (git?)
  2. Change the ip and generate code with cubeMx
  3. do a git diff and take a look what cubeMx actually changed in your sourcefiles
  4. Now you know what file/s you should go to for changing the ip yourself :D
Available for consulting/freelancing , hit me up in https://github.com/javiBajoCero

This is going to be more down to the IP stack that you use (LwIP) rather than specific to STM32 - so try searching in general for "LwIP set IP address" and similar ...

 

Also, as @Javier1 said, browse the generated code to see where these things get set - then change them from compile-time constants to run-time settings ...

can yo guys give an example code where to look for thanks 

 

You said, "we are used to set the ip address manually in the ioc file in general settings in the lwip section in the middleware tab" - so you already have this working?

So that code is your example!

That is the code that you browse, find the settings, then modify...

Did you try the internet search?

eg, https://www.google.com/search?q=LwIP+set+IP+address


@Javier1 wrote:
  1. Just put your project inside the version control of your choice (git?)

@abeba.1 If you don't already have version control, then I would certainly recommend that you should.

But you don't actually need it to do this - you can just use a simple copy:

  1. Generate your code in the normal way, with a fixed IP address specified via CubeMX
  2. Copy your entire project so a separate folder - where it will not get overwritten by re-generating.
  3. Now modify your project, via CubeMX, for a different IP address, and re-generate
  4. Now perform a diff between this project, and the copy of your original project

If you don't already have a diff utility, try WinMerge: https://winmerge.org/?lang=en

A diff utility is an invaluable tool.

 

abeba.1
Associate III

hii guyes thanks for help :)