Documentation:NGW/FirstSteps
From AVRFreaks Wiki
Contents |
[edit] Supplying power
The NGW100 will accept 9v-15V with either positive or negative centre tipped DC supply. Note there is no power switch.
[edit] Serial interface
Since the NGW100 does not have a screen you will need to use a terminal screen on your PC to see what the NGW100 is doing. To this end you will need a 9 pin serial cable. If you have a serial cable from an STK500 it will work nicely.
Merely connect the cable and before you connect power to the NGW100, start a terminal program such as Windows(tm) Hyperterminal. Connect at 115200 speed. Then power up the NGW100 board and you will see the debug information from the NGW100 in the terminal.
Once the initial start up sequence has completed, the "SYS" LED on the NGW100 board itself will light up red, indicating normal operation.
Once the initialisation has completed you will be presented with a linux shell where you can enter commands as per any other linux shell
[edit] USB
You can easily access an SD Card in the NGW100 via USB.
To connect your PC to the NGW100 via USB you will need a USB-A to USB-B cable.
Assuming you have a serial cable allowing you to access the shell, connect the USB cable and then bring up the terminal.
At the prompt type "usb-mass-storage on" and hopefully your PC will instantly recognise a USB Storage Device.
You cannot access the SD Card whilst the USB access is in progress.
To turn off the USB Mass Storage Device type "usb-mass-storage off" at the terminal.
If you are having issues where files are not being committed to your SD card straight away, try the "sync" command in a terminal. [1]
Please note that NGW100 can't work as a USB host, only as a device.
[edit] Network
In the default mode, the NGW100 wants to act as a DCHP and DNS server. Thus if you plug the NGW100 LAN port to your PC then your PC will likely look to the NGW100 for servicing DNS and DHCP requests.
To create the situation where the NGW100 can be plugged into a spare ethernet port on the PC whilst the PC is also accessing the Internet via a router you can foloow the steps below on a Ubuntu 7.10 box:
- Plug in a serial cable and turn on the NGW100 to establish a serial connection.
- Change directory to /etc/init.d/
- Rename the file S21dnsmasq to something like 'backup_S21dnsmasq'
- Reboot the NGW100 by typing 'reboot'
- On the PC make sure that the ethernet port connected to the NGW100 has a static IP like 10.0.0.50 and that the subnet is 255.255.255.0 (assuming that your network uses that subnet)
- Make sure your firewall allows access.
- You should now be able to point a browser to 10.0.0.1 and get the NGW100 screen as well as point a browser to www.google.com to get Google.
Once you have connected the LAN port to your PC you should be able to access the built in web/ftp/telnet servers. To access the webserver, open Firefox or other selected web browser and type in "10.0.0.1" in the address bar (you could also type "http://ngw.example.net"). You should be presented with a blue website with four options.
FTP As part of the Network, you will probably want to access the NGW100 via ftp. It has a built in FTP server that is activated by default. To access it point an FTP client to "10.0.0.1" (or "ftp.example.net"). If you use anonymous login, you will, use you change it, have access only to /home/ftp. If you login as root with name:"root" and password:"roota" then you will have ftp access to the entire filesystem.
If you login as root, be sure not to change or delete anything that you do not know about, you could remove system files and render the Linux system on the NGW100 inoperable and need to re-flash it.
[edit] Time and Date
By default, the ngw100 is configured to display UTC time only. Setting the proper timezone is different in busy box linux compared to full blown distros.
To have the ngw100 display the time for your location, you just create a /etc/TZ file with the proper string in it. Here are a few examples:
echo EST5EDT > /etc/TZ echo CST6CDT > /etc/TZ
The first example sets the timezone for the Eastern US timezone. The second example is for the Central US timezone.
[edit] SD Card
The easiest way to utilise an SD Card if you are using Windows(tm) is to format it to the FAT filesystem under windows using a card reader and then place it in the NGW100 slot before you turn it on. NGW100's Linux will mount it as part of the start up sequence. IT will be mounted at /media/mmcblk0p1 by default
[edit] Samba (Windows(tm)) network shares
The NGW100 can appear to a network as just another shared harddrive. The protocol is SMB and hence referred to as Samba. The default Samba share is not set to share /media/mmcblk0p1 where the SD Card is mounted.
The functionality overlaps with FTP quite a bit so it is a matter of personal preference as to which one you want to use. Although as a Windows(tm) share you can treat files as if they were local (ie play mp3s by double clicking them in Explorer)
The easiest way to fix this I suggest is to use SWAT (Samba Web Admin Tool). Thankfully Atmel have built this is too. As it is web based, navigate to 10.0.0.1 or ngw.example.net and select the third option "Samba Web Administration Tool". Use "root" and "roota" to login with.
Once logged in, select "Shares" from the menu and then alter the default share's path to /media/mmcblk0p1 as opposed to /media/sdcard. Then select "Commit Changes".
It is well worth going back through the menu to check that your changes have been accepted.
Then it is a matter of pointing windows Explorer to "\\samba\netdisk" (if you changed the name of the share from netdisk, use that instead)
You should have full read and write access as if it was another network share.
Note, Samba is not limited to Windows, most modern Linux distributions have a Samba client and will share harddrives and printers using Samba quite happily. Of course there are more powerful networking solutions in a Linux environment such as NFS etc.
[edit] Random extra (LEDS)
Just as a little extra I thought I throw in how to make one of the two (three?) user configurable LEDs to flash randomly.
In the serial terminal, type "cat /dev/urandom >/dev/gpio2"
LED "B" should start flickering like it is going out of fashion.
This sends the output of urandom device to the gpio2 device register which controls the LED. If you change gpio2 to gpio1, you'll affect LED "A" instead.
Ctrl-Z will suspend the command
Ctrl-C will end the command
More NGW information can be found at: NGW100_LEDs
More information can be found at: How to make leds flash (stk1000)
[edit] Command Set
[ flash_info mknod smbclient [[ flash_lock mkswap smbd addgroup flash_otp_dump mktemp smbpasswd adduser flash_otp_info modprobe smbstatus arping flash_unlock more smbtar ash flashcp mount sntp automount.sh fold mtd_debug sort awk free mv stat basename fsck nanddump strings bunzip2 ftl_check nandwrite su busybox ftl_format netstat sum bzcat ftpd nftl_format sumtool cal gawk nftldump swapoff cat gawk-3.1.5 nice swapon chgrp getopt nmbd swat chmod getty nmblookup sync chown grep nohup sysctl chroot gunzip nslookup syslogd chvt gzip ntp-keygen tail cksum halt ntp-wait tar clear haserl ntpd tdbbackup cmp head ntpdate tdbdump cp hexdump ntpdc tdbtool crond hostname ntpq tee crontab httpd ntptime telnet cut id ntptrace telnetd date ifconfig openvt test dbclient ifdown passwd tickadj dd ifup patch time deallocvt igawk pdbedit top delgroup inetd pgawk touch deluser init pgawk-3.1.5 tr df insmod pidof true diff install ping tty dirname ip pivot_root udhcpc dmesg iptables poweroff umount dnsmasq iptables-restore printenv uname doc_loadbios iptables-save ps uniq docfdisk jffs2dump pwd unix2dos dos2unix kill readlink unzip dropbear killall reboot uptime dropbearconvert klogd renice usb-mass-storage dropbearkey last reset usleep du ldconfig rfddump vi echo ldd rfdformat watch egrep less rm wc eject ln rmdir webif-page env logger rmmod wget expr login route which false ls run-parts who fdisk lsmod rx whoami fgrep md5sum sed winbindd find mdev setconsole xargs findsmb mkdir setsid yes flash_erase mkfs.jffs sh zcat flash_eraseall mkfs.jffs2 sleep
