using the Ethernet library from libstock, can anyone share a working DHCP client init procedure ?
i don't understand whats wrong on my side, but on a new board i use, static IP work as epxected, but no way to get DHCP IP !
can't find any example on the forum or libstock, with this library ?
thanks, best regards all
Code: Select all
DebugString_UART("Run Network ...")
Net_Ethernet_Intern_stackInitTCP()
Net_Ethernet_Intern_Init(@myMacAddr, @myIpAddr, Net_Eth_Int_AUTO_NEGOTIATION and Net_Eth_Int_CUSTOM_MAC ) 'init ethernet board
DebugString_UART("DHCP mode selected")
if Net_Ethernet_Intern_initDHCP(20) = 1 then ' get network configuration from DHCP server, wait 10 sec for the response
memcpy(@myIpAddr, Net_Ethernet_Intern_getIpAddress(), 4) ' fetch IP address
memcpy(@gwIpAddr, Net_Ethernet_Intern_getGwIpAddress(), 4) ' fetch gateway IP address
memcpy(@dnsIpAddr, Net_Ethernet_Intern_getDnsIpAddress(), 4) ' fetch DNS server address
memcpy(@ipMask, Net_Ethernet_Intern_getIpMask(), 4) ' fetch IP subnet mask
bDHCPserverFind = true
else
DebugString_UART("NO reply from any DHCP server - SET fixed IP")
bDHCPserverFind = false
end if
Net_Ethernet_Intern_confNetwork(@ipMask, @gwIpAddr, @dnsIpAddr)
i always go to 'set fixed ip' .. and wireshark don't show me any DHCP request !
YES, my DHCP server is right working ;o)