Hello,
I'm trying to get running webserver with uVision5 (compiler version 5) but get stuck with CubeMX/Classic-Configurations for old MDK with ARM Compiler V5.06 (update6 build750). After I used Classic version my Ethernet Link was permanently down, althought the PHY_ID-Registers are readed correct. After I read the instructions in file EMAC_STM32F7xx.c, I'm very confused, because the usage of cubeMX can not be the solution for get Ethernet Link up, because the Middleware used somehow classic edition not CubeMX version.
So my question is: how to get Ethernet Link up with old MDK?
I'm currently using Network version 7.11.0
Hi,
You have provided little information about what you are doing. Please provide more code and technical data. This page can be helpful:
www.keil.com/.../network_create_app.html
Hello, I'm using the same basis like you suggested. For example I have used followed code:
/* The following values are read from EEPROM */ const char mac_addr[] = { "4c-52-62-32-3c-46" }; const char ip_addr[] = { "192.168.1.250" }; const char def_gw[] = { "192.168.1.1" }; const char net_mask[] = { "255.255.255.0" }; const char pri_dns[] = { "8.8.8.8" }; const char sec_dns[] = { "8.8.4.4" }; const char host_name[] = { "Keil_MCB" }; bool DHCP_enabled = false; uint32_t tcp_cb_func (int32_t socket, netTCP_Event event, const NET_ADDR *addr, const uint8_t *buf, uint32_t len) { switch (event) { case netTCP_EventConnect: // Connect request received in server mode if (addr->addr_type == NET_ADDR_IP4) { // IPv4 client // if (addr->addr[0] == 192 && // addr->addr[1] == 168 && // addr->addr[2] == 0 && // addr->addr[3] == 1) { // Accept connection from client at 192.168.0.1 return (1); } } // else { // // IPv6 client // const uint8_t ip6_addr[NET_ADDR_IP6_LEN] = { // 0xfe, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x1c, 0x30, 0x6c, 0xff, 0xfe, 0xa2, 0x45, 0x5e }; // if (memcmp (addr->addr, ip6_addr, NET_ADDR_IP6_LEN) == 0) { // // Accept connection from client at [fe80::1c30:6cff:fea2:455e] // return (1); // } // } // Deny connection. return (0); case netTCP_EventEstablished: // Connection established break; case netTCP_EventClosed: // Connection was properly closed break; case netTCP_EventAborted: // Connection is for some reason aborted break; case netTCP_EventACK: // Previously sent data acknowledged break; case netTCP_EventData: // Data received if ((buf[0] == 0x01) && (len == 2)) { // Switch LEDs on and off // LED_SetOut (buf[1]); } break; } return (0); } int main(void) { /* USER CODE BEGIN 1 */ SystemCoreClock = 200000000; SystemCoreClockUpdate(); /* USER CODE END 1 */ /* MCU Configuration--------------------------------------------------------*/ /* Reset of all peripherals, Initializes the Flash interface and the Systick. */ HAL_Init(); SystemClock_Config(); HAL_SYSTICK_CLKSourceConfig(SYSTICK_CLKSOURCE_HCLK); uint8_t buf[28]; netInitialize (); extern ARM_DRIVER_ETH_PHY Driver_ETH_PHY0; static ARM_DRIVER_ETH_PHY *phy; phy = &Driver_ETH_PHY0; phy->SetMode (ARM_ETH_PHY_SPEED_100M | ARM_ETH_PHY_ISOLATE | ARM_ETH_PHY_AUTO_NEGOTIATE | ARM_ETH_PHY_DUPLEX_FULL); /* Change host name */ netSYS_SetHostName (&host_name[0]); /* Change MAC address */ netMAC_aton (mac_addr, &buf[0]); netIF_SetOption (NET_IF_CLASS_ETH | 0, netIF_OptionMAC_Address, &buf[0], NET_ADDR_ETH_LEN); if (DHCP_enabled == false) { /* Static configuration mode */ netDHCP_Disable (NET_IF_CLASS_ETH | 0); /* Change IP address */ netIP_aton (ip_addr, NET_ADDR_IP4, &buf[0]); netIF_SetOption (NET_IF_CLASS_ETH | 0, netIF_OptionIP4_Address, &buf[0], NET_ADDR_IP4_LEN); /* Change Network mask */ netIP_aton (net_mask, NET_ADDR_IP4, &buf[0]); netIF_SetOption (NET_IF_CLASS_ETH | 0, netIF_OptionIP4_SubnetMask, &buf[0], NET_ADDR_IP4_LEN); /* Change Default Gateway address */ netIP_aton (def_gw, NET_ADDR_IP4, &buf[0]); netIF_SetOption (NET_IF_CLASS_ETH | 0, netIF_OptionIP4_DefaultGateway, &buf[0], NET_ADDR_IP4_LEN); /* Change Primary DNS Server address */ netIP_aton (pri_dns, NET_ADDR_IP4, &buf[0]); netIF_SetOption (NET_IF_CLASS_ETH | 0, netIF_OptionIP4_PrimaryDNS, &buf[0], NET_ADDR_IP4_LEN); /* Change Secondary DNS Server address */ netIP_aton (sec_dns, NET_ADDR_IP4, &buf[0]); netIF_SetOption (NET_IF_CLASS_ETH | 0, netIF_OptionIP4_SecondaryDNS, &buf[0], NET_ADDR_IP4_LEN); int32_t tcp_sock; // Initialize TCP Socket and start listening on port 2000 tcp_sock = netTCP_GetSocket (tcp_cb_func); if (tcp_sock >= 0) { netTCP_Listen (tcp_sock, 2000); } } else { netDHCP_Enable (NET_IF_CLASS_ETH | 0); int32_t tcp_sock; // Initialize TCP Socket and start listening on port 2000 tcp_sock = netTCP_GetSocket (tcp_cb_func); if (tcp_sock >= 0) { netTCP_Listen (tcp_sock, 2000); } } uint32_t tick; while (1) { // Run main Network Core 'thread' tick = HAL_GetTick(); } }
Hi, first, you should start a simple Network program.
1)Did you run RTOS in your mentioned code? Before netInitialize (); you should start RTOS for the OS can handle the network PHY.
2)Please disable DHCP and set a static IP to check the ping command. via Net_Config_ETH_0.h file.
3)Disable all configuration network settings that you have set by netIP_aton and netIF_SetOption.
Something like this:
__NO_RETURN static void app_main (void *argument){ int32_t Socket; netInitialize(); Socket = netUDP_GetSocket (udp_cb_func); if (Socket>= 0) { netUDP_Open(Socket,54321); } while(1) { } } int main (void){ osKernelInitialize(); // Initialize CMSIS-RTOS osThreadNew(app_main, NULL, NULL); // Create application main thread osKernelStart(); while(1); }
My collegs want to have a solution without RTOS. Is it possible to get running without RTOS usage?
Please read this page:www.keil.com/.../nw_resource_requirements.html
That means that we should apply RTOS functionality and thus we can not use that - meanly due to memory fragmentation.
Hi again,
You can use old version of Network( I don't recommend) or use LWIP.