cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F1 LWIP netif link doesn't set up

Romano1
Associate III

Hello,

I need some help about using LWIP on STM32F107VCT6 without RTOS using RAW API.

For the moment I just want to ping my board with a computer but the problem is that if I make an arp command my computer doesn't see my board. I have enable ICMP, TCP, ARP on LWIP configuration on my generated CubeMX project.

I have debug my project and in the fucntion ethernetif_set_link it says me that the netif set link is down. I think that the problem of LWIP configuration come frome here and more precisely from my varaible reg_value wich is equal to 0 so the netif link can't set up. My variable regvalue get is value from the function HAL_ETH_ReadPHYRegister.

So I think the problem is link to the register configuration of my ethernet controller (LAN8720A).

Is there anybody who know why my regvalue is never equal to 1 after the excution of this line in ethernetif.c :

regvalue &= PHY_LINKED_STATUS;

Here is the configuration register on my LAN8720A in LWIP:

/* Section 3: Common PHY Registers */
 
#define PHY_BCR                         ((uint16_t)0x00)    /*!< Transceiver Basic Control Register   */
#define PHY_BSR                         ((uint16_t)0x01)    /*!< Transceiver Basic Status Register    */
 
#define PHY_RESET                       ((uint16_t)0x8000)  /*!< PHY Reset */
#define PHY_LOOPBACK                    ((uint16_t)0x4000)  /*!< Select loop-back mode */
#define PHY_FULLDUPLEX_100M             ((uint16_t)0x2100)  /*!< Set the full-duplex mode at 100 Mb/s */
#define PHY_HALFDUPLEX_100M             ((uint16_t)0x2000)  /*!< Set the half-duplex mode at 100 Mb/s */
#define PHY_FULLDUPLEX_10M              ((uint16_t)0x0100)  /*!< Set the full-duplex mode at 10 Mb/s  */
#define PHY_HALFDUPLEX_10M              ((uint16_t)0x0000)  /*!< Set the half-duplex mode at 10 Mb/s  */
#define PHY_AUTONEGOTIATION             ((uint16_t)0x1000)  /*!< Enable auto-negotiation function     */
#define PHY_RESTART_AUTONEGOTIATION     ((uint16_t)0x0200)  /*!< Restart auto-negotiation function    */
#define PHY_POWERDOWN                   ((uint16_t)0x0800)  /*!< Select the power down mode           */
#define PHY_ISOLATE                     ((uint16_t)0x0400)  /*!< Isolate PHY from MII                 */
 
#define PHY_AUTONEGO_COMPLETE           ((uint16_t)0x0020)  /*!< Auto-Negotiation process completed   */
#define PHY_LINKED_STATUS               ((uint16_t)0x0004)  /*!< Valid link established               */
#define PHY_JABBER_DETECTION            ((uint16_t)0x0002)  /*!< Jabber condition detected            */
 
/* Section 4: Extended PHY Registers */
#define PHY_SR                          ((uint16_t)0x1FU)    /*!< PHY status register Offset                      */
 
#define PHY_SPEED_STATUS                ((uint16_t)0x0004U)  /*!< PHY Speed mask                                  */
#define PHY_DUPLEX_STATUS               ((uint16_t)0x0010U)  /*!< PHY Duplex mask                                 */
 
#define PHY_ISFR                        ((uint16_t)0x001DU)    /*!< PHY Interrupt Source Flag register Offset   */
#define PHY_ISFR_INT4                   ((uint16_t)0x0010U)  /*!< PHY Link down inturrupt       */

Here is my main code :

int main(void)
{
 
  HAL_Init();
 
  SystemClock_Config();
 
  MX_GPIO_Init();
  MX_LWIP_Init();
 
  /* tcp echo server Init */
   tcp_echoserver_init();
 
  while (1)
  {
	  ethernetif_set_link(&gnetif);
	  MX_LWIP_Process();
  }
}

Here is my config :

STM32CubeIDE version : 1.11.2

STM32CubeMX version : 6.7.0

MCU : STM32F107VCT6

STM32F1 firmware : 1.8.4

Board : EasyMx PRO v7

Ethernet Controller : LAN8720A

0 REPLIES 0