New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Final FMUv5X Netman using the NuttX network monitor and a single rejected App commit. #16330
Conversation
fyi @TSC21 |
Awesome stuff! |
@hamishwillee we might want to document this! |
px4_fmu-v5x:Use Bin Net settigns
This system command will display, set and save the network settings. netman show - Displays the current settings. netman update - Will check for a net.cfg file on the SD card. If present, it will update the paramaters, delete the file, and reboot. Using the new settings. netman save - Saves the current settings to net.cfg on the SD card. This file shoulf be renamed to preserver it across reboots or editited to chech networkin paramates. File format is name<space>value: echo DEVICE=eth0 > /fs/microsd/net.cfg echo BOOTPROTO=fallback >> /fs/microsd/net.cfg echo IPADDR=192.168.0.4 >> /fs/microsd/net.cfg echo NETMASK=255.255.255.0 >>/fs/microsd/net.cfg echo ROUTER=192.168.0.254 >>/fs/microsd/net.cfg echo DNS=192.168.0.254 >>/fs/microsd/net.cfg Valid values for `proto` are `dhcp`, `static`, `falback` Both will try dhcp for CONFIG_NETINIT_FALLBACK times and fall back to the static address. NETMASK - is the network mask. IPADDR - this nodes ip address for static or fall back. ROUTER - The default route. DNS - The address of the dns server.
Co-authored-by: Beat Küng <beat-kueng@gmx.net> Apply suggestions from code review use stdout Co-authored-by: Beat Küng <beat-kueng@gmx.net>
@bkueng - Thank you for the thorough review! All your suggestions are done and debased on current master. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good to merge
@davids5 on host machine I have to have ROUTES and DNS defined also, right? |
@farhangnaderi - The only params needed by NuttX are set by netman. I have a router at 192.168.0.254, I set the nuttx node to 192.168.0.4. The DNS and ROUTER of the address of the router. The linux side would have it's own network configuration, dns server and routes but not set by the same way as in nuttx. echo DEVICE=eth0 > /fs/microsd/net.cfg |
thanks,since am bringing this on docs. |
@farhangnaderi I believe this was covered on our docs wasn't it? |
Alternatively, if you only want to change one setting you can try with only one arrow, this will replace the whole file, I have tried this!
|
Thanks @mrpollo for the reply. I meant on host side. Figured out everything anyway. We better discuss over the PR when I make it. |
Thanks @farhangnaderi |
@davids5 Just helping with some doc s on this.
What then does "> Both will try dhcp for CONFIG_NETINIT_FALLBACK times" mean - there are three things, so you can't have "both". What I think it means is that if you set dhcp or fallback it will try DHCP in either case and then fallback. But then what is the point of having the two types? |
static is static and nothing changes. System boots with that IP address. Both refers to DHCP and fallback. DHCP will just keep trying and will NOT provide an IP until it gets one from the DHCP server. Fallback will time out and use the static IP that is configured. Fallback works in a way that lets you connect the FMU to a network and get IP from it. Or connect the FMU to a PC (not not running a DHCP server) and connect to it at a known address. |
Now that the NuttX upgrade and the mtd work are on master, this is the final Netman
The netman system command will display, set and save the network
settings.
netman show
- Displays the current settings.netman update
- Will check for a net.cfg file on the SD card.If present, it will update the paramaters,
delete the file, and reboot. Using the new settings.
netman save
- Saves the current settings to net.cfg on the SD card.This file shoulf be renamed to preserver it across
reboots or editited to chech networkin paramates.
File format is namevalue:
Valid values for proto are dhcp, static, falback
Both will try dhcp for CONFIG_NETINIT_FALLBACK times
and fall back to the static address.
NETMASK - is the network mask.
IPADDR - this nodes ip address for static or fall back.
ROUTER - The default route.
DNS - The address of the dns server.
Background
5 Networking configuration deficits exist in NuttX
NuttX only supported compile time DHCP or STATIC IP addressing.
The static setting are not human readable ip format.
If DHCP was chosen the lease would not be renewed.
If the connected network was powered on after the nuttx node (FMU) booted, the netinit would time out and not bring up the network.
The ability to signal PHY state changes to use the Nuttx Net Monitor was dependent on an IRQ line from the PHY to the CPU.
The nuttx backports fix 4. The Apps rejected backport fixes 1,2,3
The Upstream ipcfg non binary solution is dependent on a writable FS. It has no way to default it's setting. The pathing is rather deep to follow in a Linux like way.
There are some issue with this approach on an FMU.
We can not use this on system without a SD card or EMMC FS.
Networking will not work if the SD card is not inserted.
Greg did a great job in adding a binary solution as well. But we either need to
a) repartition the FRAM
b) Uses a eeprom
c) Write a character driver the to read/write the date in the param system.
All of theses choices have consequences we should discuss.
The network Netman add a way to default the setting, Change the setting and ensure an atomic update.