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.
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?
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.
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?
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
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.
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”.
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.