We strongly encourage users to use Package manager for sharing their code on Libstock website, because it boosts your efficiency and leaves the end user with no room for error. [more info]
posted on 2022/08/07 12:22:30 PM CEST
Unable to get server dns in STM32F407VGT6 with LAN8720A(Ethernet).
Always return 252.255.1.32.
code snippet:
void InitTimer2(){
RCC_APB1ENR.TIM2EN = 1;
TIM2_CR1.CEN = 0;
TIM2_PSC = 2999;
TIM2_ARR = 49999;
NVIC_IntEnable(IVT_INT_TIM2);
TIM2_DIER.UIE = 1;
}
void Timer2_interrupt() iv IVT_INT_TIM2 {//1sec
TIM2_SR.UIF = 0;
Net_Ethernet_Intern_userTimerSec++ ; // Increment ethernet library counter
//GPIOD_ODR = ~GPIOD_ODR;
b++;
}
GPIO_Alternate_Function_Enable(&_GPIO_MODULE_MCO1);
/*GPIO_Clk_Enable(&GPIOA_BASE);
GPIO_Config(&GPIOA_BASE, _GPIO_PINMASK_8, (_GPIO_CFG_MODE_ALT_FUNCTION | _GPIO_CFG_SPEED_50MHZ |_GPIO_CFG_OTYPE_PP));*/
InitTimer2();
//Internet Settings
//Net_Ethernet_Intern_stackInitTCP();
Net_Ethernet_Intern_Init(myMacAddr, myIpAddr, _ETHERNET_FULLDUPLEX, &_GPIO_MODULE_ETHERNET);
Net_Ethernet_Intern_confNetwork(ipMask, gwIpAddr, dnsIpAddr);
// Wait for active link
while(!(regValue & 0b100)) {
Net_Ethernet_Intern_PHY_Read(_PHY_BSR, ®Value);
}
TIM2_CR1.CEN = 1;
IntToStr(regValue, ssr);
TFT_Write_Text(ssr, 50, 200);
memcpy(temp_serverIP, Net_Ethernet_Intern_dnsResolve("weldvisor.com", 25), 4);
Also attached project configuration
<?xml version="1.0"?>
<MCU_DEVICE_FLAGS>
<DEVICE>
<DEVICE_NAME>STM32F407VG</DEVICE_NAME>
<DEVICE_CLOCK>150</DEVICE_CLOCK>
<SETTINGS>
<COUNT>22</COUNT>
<SETTING0>
<NAME>Internal high-speed clock enable</NAME>
<DESCRIPTION>HSI oscillator OFF</DESCRIPTION>
</SETTING0>
<SETTING1>
<NAME>External high-speed clock enable</NAME>
<DESCRIPTION>HSE oscillator ON</DESCRIPTION>
</SETTING1>
<SETTING2>
<NAME>External high-speed clock bypass</NAME>
<DESCRIPTION>HSE oscillator not bypassed</DESCRIPTION>
</SETTING2>
<SETTING3>
<NAME>Clock security system enable</NAME>
<DESCRIPTION>Clock detector OFF</DESCRIPTION>
</SETTING3>
<SETTING4>
<NAME>Main PLL (PLL) enable</NAME>
<DESCRIPTION>PLL ON</DESCRIPTION>
</SETTING4>
<SETTING5>
<NAME>PLLI2S enable</NAME>
<DESCRIPTION>PLLI2S OFF</DESCRIPTION>
</SETTING5>
<SETTING6>
<NAME>Division factor for the main PLL (PLL) and audio PLL (PLLI2S) input clock</NAME>
<DESCRIPTION>PLLM = 25</DESCRIPTION>
</SETTING6>
<SETTING7>
<NAME>Main PLL (PLL) multiplication factor for VCO</NAME>
<DESCRIPTION>PLLN = 336</DESCRIPTION>
</SETTING7>
<SETTING8>
<NAME>Main PLL (PLL) division factor for main system clock</NAME>
<DESCRIPTION>PLLP = 2</DESCRIPTION>
</SETTING8>
<SETTING9>
<NAME>Main PLL(PLL) and audio PLL (PLLI2S) entry clock source</NAME>
<DESCRIPTION>HSE oscillator clock selected as PLL and PLLI2S clock entry </DESCRIPTION>
</SETTING9>
<SETTING10>
<NAME>Main PLL (PLL) division factor for USB OTG FS, SDIO and random number generator clocks</NAME>
<DESCRIPTION>PLLQ = 6 </DESCRIPTION>
</SETTING10>
<SETTING11>
<NAME>System clock switch</NAME>
<DESCRIPTION>PLL selected as system clock</DESCRIPTION>
</SETTING11>
<SETTING12>
<NAME>Set and cleared by software to control the division factor of the AHB clock</NAME>
<DESCRIPTION>SYSCLK not divided</DESCRIPTION>
</SETTING12>
<SETTING13>
<NAME>APB low-speed prescaler (APB1)</NAME>
<DESCRIPTION>HCLK divided by 4 </DESCRIPTION>
</SETTING13>
<SETTING14>
<NAME>APB high-speed prescaler (APB2)</NAME>
<DESCRIPTION>HCLK divided by 2 </DESCRIPTION>
</SETTING14>
<SETTING15>
<NAME>HSE division factor for RTC clock</NAME>
<DESCRIPTION>no clock</DESCRIPTION>
</SETTING15>
<SETTING16>
<NAME>Microcontroller clock output 1</NAME>
<DESCRIPTION>PLL clock selected </DESCRIPTION>
</SETTING16>
<SETTING17>
<NAME>I2S clock selection</NAME>
<DESCRIPTION>PLLI2S clock used as I2S clock source </DESCRIPTION>
</SETTING17>
<SETTING18>
<NAME>MCO1 prescaler</NAME>
<DESCRIPTION>division by 3 </DESCRIPTION>
</SETTING18>
<SETTING19>
<NAME>MCO2PRE</NAME>
<DESCRIPTION>division by 5 </DESCRIPTION>
</SETTING19>
<SETTING20>
<NAME>Microcontroller clock output 2</NAME>
<DESCRIPTION>PLL clock selected </DESCRIPTION>
</SETTING20>
<SETTING21>
<NAME>Voltage range</NAME>
<DESCRIPTION>Voltage range = 2.7 to 3.6 V</DESCRIPTION>
</SETTING21>
</SETTINGS>
</DEVICE>
</MCU_DEVICE_FLAGS>