Skip to main content
Graduate
May 22, 2024
Solved

can only ping one IP address after creating two using NetX nx_ip_create

  • May 22, 2024
  • 2 replies
  • 3780 views

We have a STM32F7 with LAN9354 3-port switch on our board.  I created a custom PHY driver for the LAN device based off a similar LAN chip.  In general, networking works.  We can setup static IP, ping both to and from the board, also UDP connection is good.   

We're using ThreadX and NetX Duo from https://github.com/STMicroelectronics/x-cube-azrtos-f7

When I add a second IP instance using nx_ip_create, only the second IP address is accessible.  If I swap the code around (create ip1 before ip0), then the second IP address is only available.   When I say 'available', I mean through ping.  If I use arp command on my Raspberry PI, I can see both IP addresses with the same MAC address.  

This is not the exact code, just a portion.  The remainder of the code properly sets up pointer allocated from byte pool, enabled icmp for both instances, arp, etc. without errors.

 ret = nx_ip_create(&IpInstance0, "NetX IP Instance 0", IP_ADDRESS(10,24,129,49), 0xFFFFF000,
 &EthPool, nx_stm32_eth_driver, 
 pointer, 2 * DEFAULT_MEMORY_SIZE, DEFAULT_PRIORITY);

 ret = nx_ip_create(&IpInstance1, "NetX IP Instance 1", IP_ADDRESS(10,24,129,50), 0xFFFFF000,
 &EthPool, nx_stm32_eth_driver, 
 pointer, 2 * DEFAULT_MEMORY_SIZE, DEFAULT_PRIORITY);

 

 

 

    This topic has been closed for replies.
    Best answer by jerry_sandc

    I found that nx_stm32_ethernet_driver.c itself doesn't support multiple IP instances.  There's no error if you initialize the driver a second time with a new IP instance, and when packets are received, it doesn't try to do any routing to the IP threads.  Either I have to do major surgery myself on this module, or somehow create two instances of the driver attached to two different MAC addresses.  

    2 replies

    Graduate
    May 22, 2024

    morrow@raspberrypi:~ $ arp -a

    ? (10.24.128.1) at <incomplete> on eth0

    ? (10.24.129.49) at <incomplete> on eth0

    ? (10.24.129.50) at 00:19:c9:12:34:56 [ether] on eth0

    ? (10.24.129.47) at 5c:60:ba:56:dd:52 [ether] on eth0

    ? (10.24.129.51) at 00:19:c9:12:34:56 [ether] on eth0

    You can see both IPs with ARP, so something it working.

     

    jerry_sandcAuthorAnswer
    Graduate
    May 29, 2024

    I found that nx_stm32_ethernet_driver.c itself doesn't support multiple IP instances.  There's no error if you initialize the driver a second time with a new IP instance, and when packets are received, it doesn't try to do any routing to the IP threads.  Either I have to do major surgery myself on this module, or somehow create two instances of the driver attached to two different MAC addresses.