Microchip-MPLAB-Harmony / bootloader_apps_ethernet

Harmony 3 Bootloader Ethernet examples
https://microchip-mplab-harmony.github.io/bootloader_apps_ethernet/
Other
4 stars 1 forks source link

Bootloader firmware does not respond to Unified Bootloader Host App v1.16.2 #2

Open rockwarrior opened 3 years ago

rockwarrior commented 3 years ago

Using the sam_v71_xult.X project I've made the following modifications.

  1. Changed the target device to SAME70Q21B
  2. Upgraded the Harmony frameworks to:
    • {name: "csp", version: "v3.8.1"}
    • {name: "core", version: "v3.8.1"}
    • {name: "dev_packs", version: "v3.8.0"}
    • {name: "bootloader", version: "v3.4.1"}
    • {name: "mhc", version: "v3.5.1"}
    • {name: "net", version: "v3.6.2"}
  3. Changed the Ethernet PHY to DP83848
  4. Changed the static IP address to 169.254.0.2
  5. Used TC0 to drive the Time System Service in order to blink a status LED

Observations

  1. The Unified Bootloader Host App v1.16.2 is not able to communicated with the firmware. The console window reports: 15:08:26.278 > Device: 169.254.0.2 Bootloading started 15:08:26.385 > Hex File (re)loaded... 15:08:26.386 > Reading Version ... 15:08:46.403 > Device Failed to respond to command...
  2. Wireshark shows that a UDP packet was transmitted to 169.254.0.2 port 6234 with len=7, but no other packets are shown.
  3. The firmware application builds and runs on the target hardware. LED blinks indicating firmware is running.
  4. The firmware responds to "ping 169.254.0.2" from the command line. Response stops if the power to the target is removed.
  5. The firmware responds to "nc -vnzu 169.254.0.2 6234" with "Connection to 169.254.0.2 port 6234 [udp/*] succeeded!"
  6. The same modifications were made to the berkeley_tcp_server Harmony application and the application works as expected.
  7. I set a breakpoint in DATASTREAM_Open() at udpData.connected = true; (bootloader_udp.c, line 139), which never gets hit
  8. I set a breakpoint in DATASTREAM_Tasks() at avlBytes = TCPIP_UDP_GetIsReady(udpData.udpSocket); (bootloader_udp.c, line 87) which never gets hit.

Any help debugging this issue would be appreciated. I can zip up and share the entire application if needed, but the steps above should be pretty easy to reproduce (except maybe the LED blinking).

rockwarrior commented 3 years ago

I've made some progress on this issue by debugging the bootloader firmware application. It appears that the bootloader application actively rejects any IP address of the form 169.xx.xx.xx.

datastream_udp.c, line 126 DATASTREAM_Open() 126: --> if (ipAddr.v[0] != 0 && ipAddr.v[0] != 169) // Wait for a Valid IP

Is this behavior absolutely necessary?

Hrisikeshsahu commented 3 years ago

In RFC 3927, the Internet Engineering Task Force (IETF) has reserved the IPv4 address block 169.254.0.0/16 (169.254.0.0 – 169.254.255.255) for link-local addressing. Link-local addresses are assigned to interfaces by host-internal. Link-local addresses are most often assigned automatically with a process known as stateless address autoconfiguration or link-local address.Routers do not forward packets with link-local source or destination addresses. This Link local address is auto configured address by the host after detecting IP address conflict or DHCP Discovery/Request fails.

To avoid Link local address configuration, this check is provided.

We are looking into this check if the check is required for ethernet bootloader or not.

I will update more on this.

KiranFaststream commented 2 years ago

We also faced same problem and it solved after many research, Please check the your LAN physical driver. In the demo code harmony 3 they used different physical LAN driver. We have changed that driver LAN and generated the code and its worked fine. As per the ATSAME70Q21B development board the LAN physical driver is LAN8740.