Skip to main content
Graduate II
July 20, 2023
Solved

stm32f767zi nucelo ethernet hardware setup : Can we use our laptop as a router for testing?

  • July 20, 2023
  • 4 replies
  • 4755 views

Hello  everyone,

It is a quite basic question, I have this stm32767zi nucleo board with a LAN driver and rj45 connector, and I intend to test the basic ping/web server examples.So for now, I do not have a router with me, so I was wondering, if I could use my laptop as a router itself , if it is connected to the WiFi and connect my board to laptop using an Ethernet cable.

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

    I'm not sure if I understand correctly...

    If you just ask: can I connect Nucleo to laptop via ethernet jack and check the Nucleo's webserver?

    Then the answer is: yes!
    I recently did that while travelling on a train

    But you either need some PC app to run it as a DHCP server, or you have to give the Nucleo a static IP address, with most parts matching that of your PC's.
    subnet mask and gateway must be identical, IP4 address itself has to match the first 3 (or 2?) bytes.

    Example:

     

     

    laptop's address (find out via cmd / ipconfig)
    IP4 address: 169.254.111.7
    SubNet: 255.255.0.0
    GateWay: 169.254.111.1
    
    then your Nucleo's address should be set to:
    IP4 address: 169.254.111.x
    SubNet: 255.255.0.0
    GateWay: 169.254.111.1
    
    with x any 8 bit value except the laptop's (7 here)

     

     

    I just tested that (but with a USB-ethernet bridge adapter with a Microchip LAN9512), it's working here.

    Edit:
    It will probably 169.254.x.y

    wikipedia says:

    169.254.0.0/16169.254.0.0–169.254.255.25565536SubnetUsed for link-local addresses[10] between two hosts on a single link when no IP address is otherwise specified, such as would have normally been retrieved from a DHCP server.

    4 replies

    Super User
    July 20, 2023

    You can't plug in the board and expect the board to show up as a device on the network via your laptop.

    You can communicate directly with the laptop via an ethernet cable, but setup is a bit of a mess.

    A WiFi to ethernet adapter can provide the setup you want.

    Anare.1Author
    Graduate II
    July 21, 2023

    Thank you for the response and time, But is it possible to run a web server using fixed.static ip addresses?

    Super User
    July 21, 2023

    Possible, yes, but not very practical to run a web server from a microcontroller due to the low onboard memory and relatively slow processing speed. A raspberry Pi or similar would be much better suited and much easier to put together.

    Anare.1Author
    Graduate II
    July 21, 2023

    Thank you again, I do understand the code constraints on this design of writing a web server in a uC.So all I have to do is run the webserver/html page on raspberry pi and communicate to the IP of raspberry pi using the wifi to ethernet adapter from my board(IP of the uC board). Please feel to correct me, if I am wrong.

    LCEAnswer
    Graduate II
    July 21, 2023

    I'm not sure if I understand correctly...

    If you just ask: can I connect Nucleo to laptop via ethernet jack and check the Nucleo's webserver?

    Then the answer is: yes!
    I recently did that while travelling on a train

    But you either need some PC app to run it as a DHCP server, or you have to give the Nucleo a static IP address, with most parts matching that of your PC's.
    subnet mask and gateway must be identical, IP4 address itself has to match the first 3 (or 2?) bytes.

    Example:

     

     

    laptop's address (find out via cmd / ipconfig)
    IP4 address: 169.254.111.7
    SubNet: 255.255.0.0
    GateWay: 169.254.111.1
    
    then your Nucleo's address should be set to:
    IP4 address: 169.254.111.x
    SubNet: 255.255.0.0
    GateWay: 169.254.111.1
    
    with x any 8 bit value except the laptop's (7 here)

     

     

    I just tested that (but with a USB-ethernet bridge adapter with a Microchip LAN9512), it's working here.

    Edit:
    It will probably 169.254.x.y

    wikipedia says:

    169.254.0.0/16169.254.0.0–169.254.255.25565536SubnetUsed for link-local addresses[10] between two hosts on a single link when no IP address is otherwise specified, such as would have normally been retrieved from a DHCP server.
    Anare.1Author
    Graduate II
    July 31, 2023

    Thank you for your time and efforts to answer my queries, I really appreciate it.

    Graduate II
    July 31, 2023

    Actually try what @Piranha told us about, it's called AutoIP in lwIP, activated by the #define LWIP_AUTOIP 1 in opt.h.

    I didn't know about that, I'm still an ethernet beginner, but included AutoIP last week.
    It's working great!
    So now my application starts with DHCP, when that times out it starts AutoIP, if that fails it uses a static IP.

    Thanks @Piranha !