RNDIS IP address not coming

Hi,

I am trying to enable RNDIS protocol on stm32h7xx processor. I can see the host computer win 10 is detecting the rndis board.
But, i always get the ip address as 169.254.xxx.xxx. With this IP i am not able to access the webpages.

I can see the mac address and some of the other information received from stm controller but ip is dead with 169.254.xxx.xxx.

My expected ip is 192.168.2.1 because if turned off dhcp and manually configured static ip.

Where do you see this IP address assigned?

Where do you see the mac address information?

Where did you configure this IP? Which TCP IP stack are you using?

  1. I see IP address on my host computer. Network settings and details.
  2. Even MAC address is also coming there which i configured.
  3. I am using Freertos plsu TCP stack

in Windows 10, network manager, properties shows the information of my stm controller details.

Alternatively, i can see in the command window in host computer, ipconfig gives the same

Hi @mbr413,

Could you share your use case with more detail?
Are you using stm32h7xx processor as network interface that provides your windows PC network capability?

Is my understanding correct? Like below chart?
PC -RNDIS-> stm32h7xx processor -Ethernet/WiFi-> Router → Internet

BTW, do you enable configASSERT on the device? And any device output can be shared?

Thanks.
BR,
Actory

No,
I enabled RNDIS protocol on stm32h7xx processor, it has a webpages inside the stm code which can be accessed with ip 192.168.2.1 (ip given by stm controller)

So now the connection to stm from win 10 Pc is through usb c type cable.

flow is STM-> rndis-> usb c → Win 10 PC

Now, problem is when i connect to PC i only see 169.254.xxx.xxx

Yes, i enabled configASSERT but i dont see any crash happening.

I am able to see physical address getting exchanged but no ip.

You are connecting STM32 device to the PC and the STM32 device makes an Ethernet port available to the PC. The PC assigns an IP address (169.254.107.173) to this port. Now, when you send any data using this port, it will reach the STM32 device. Is the STM32 device connected to LAN/internet? In other words, if you disconnect every other network connection from the PC (WiFi or Ethernet), are you able to access internet?

Next, you are running a network stack (FreeRTOS-Plus-TCP) on the STM32 device. Are you able to reach the internet from the STM32 device? What IP is getting assigned to the STM32 device?

Once, the above 2 things are confirmed, we should look into who is starting the web server and if is accessible from a device on the same network.

Thankyou.

  1. If I disconnect everything from my PC like WIFI, ethernet. Still I get the same IP from STM device 169.255.xxx.xxx.

STM device is not connected to LAN/internet. I am using only usb c type to connect PC

  1. My stm device doesnt have any network connection. so no point of getting ip for the device.

I am posting some images for more understanding.

image

All I want to know why I am not getting the ip 192.168

This IP is assigned by your PC using DHCP as can be seen in the image that you shared above? Can you try to configure static IP for this interface in your PC?

Yes tried but it didnt worked. Let me know if more i can do on this to get this fixed

Would you please tell what did you try?

I opened network settings in PC where my stm is showing.
Opened Ethernet status.
Opened Ethernet Properties.
Opened Properties of Internet Protocol Version 4 (TCP/IP4)
Changed the option from Obtaining auto address to Manual setting by keeping 192.168.2.1
Subnet 255.255.255.0

I would expect that to work. As this is more specific to the ST part, I’d recommend checking with ST to find if something else is needed.

I have a doubt here. If the main code is written in C++ and mix of C and C++ will rndis freertos works?

Hi @mbr413
Many people have used FreeRTOS successfully in their C++ applications - Can I use C++ while using FreeRTOS? Is there any impediment? - #11 by richard-damon
If there is anything specific to RNDIS, ST should be able to tell that.

Hi,

Thanks for replying.
Let me explain more. The rndis freertos code with C code base working fine with ST controller and ip address is good like 192.168.2.1. I can access rndis webpages too.

When I change the project main file from C to C++ in stm ide without any changes to actual code, the ip address is not coming or going to 169.254.

All i did is added #ifdef __cplusplus extern “c” { #endif where ever necessart in header files. Code compiled and no issues or crashes after several testing. Only thing bothering is the ip.

IF you have any idea on this let me know, it will help me great, and i can try.

Thanks

One possibility is that some (optional) callback function you are providing isn’t marked as extern “C”, so isn’t being given the correct name to override the default function.

All functions called “by name” from C code need to be marked as extern “C”.

2 Likes

The suggestion from @richard-damon is good. Can you compare the symbol tables in the complied main.o in both the cases (main.c and main.cpp)? You can use nm tool (arm-none-eabi-nm) to find out the symbol table.

1 Like