i want to use a fix ip when board can’t retrieve ip from dhcp.
so i enable auto-ip to setup a ip if dhcp not found.
but the auto-ip random generate 169.254.x.x for ip address.
i want to indicate a fix ip, for example: 172.16.1.100.
i try to modify the definition in
etos73\src reck\include rmacro.h as below #define TM_IP_LOCAL_NET 0xC0A80000 #define TM_IP_LOCAL_FIRST 0xC0A80164 #define TM_IP_LOCAL_LAST 0xC0A80164 #define TM_IP_LOCAL_SMALLEST_HOST 0x0164 #define TM_IP_LOCAL_BIGGEST_HOST 0x0164
then rebuild… but it doesn’t work
you can’t specify an Auto-IP address, but you can specify a Static IP address. I’d do the following:
setup the module for dhcp / remove autoip (this has to be done programically using the IAM functions, see the API reference if you’re not familiar with it)
set BSP_WAIT_FOR_IP_CONFIG in bsp_net.h to false
do a sleep/check loop at the start of applicationStart (customizeIamGetIfAddrInfo) to see if you’ve gotten an IP address. If you don’t get one by the time you decide to timeout, set a static IP and use naIamDisable / naIamEnable to restart the interface.