-
Notifications
You must be signed in to change notification settings - Fork 3
Managing multiple Econotags
Modern desktop computers can have 12 or more USB ports, and it can become very confusing if you have a number of econotags connected for programming or monitoring, especially if they include Mobile Econotags. Here are suggestions on how to keep track of the ports and econotags.
On Linux the first econotag connected is called /dev/ttyUSB0
and /dev/ttyUSB1
. USB0 is the JTAG debugging port and USB1 the mc1322x programming and stdin/out port. The second is USB2 and USB3, etc. Any USBx that is already taken is skipped, thus you could end up with USB3/USB4 for a second Econotag. So, make a practice of always using one port for the first Econotag (e.g. the easiest one to reach), another for the second, etc., then you can then label the ports consistently. I label using the second port number because that is what you usually connect to: USB1 USB3, ...
On Windows the serial ports enumerate as COM4/COM5, etc. which is a constant for each physical port. Bring up the device manager, plug the Econotag into each port and find the numbers. You could label the ports COM5, COM7 ... but if using cygwin or other bash shells where case matters you might want to use com5
, com7
,... or ttyS4
, ttyS6
(tty numbering starts at 0).
USB extension cables are needed for the mobile Econotags, and in all cases give easier access to the buttons and LEDs. Become a collector of those.
The main tools used are mc1322x-load.pl
for programming and logging, and tunslip6/wpcapslip6
for SLIP connections. Add aliases to your home directory .bashrc or .profile to build the applications you will be using. A single alias will allow fast iterations on the port usually used:
alias iterateint='make TARGET=redbee-econotag WITH_WEBSERVER=1;~/contiki/cpu/mc1322x/tools/mc1322x-load.pl -a 0 -b 0 -t /dev/com5 -f border-router_redbee-econotag.bin'
but if using multiple ports it is easier to copy everything to a common programming file:
alias makeint='make TARGET=redbee-econotag WITH_WEBSERVER=1;cp border-router_redbee-econotag.bin copy.bin'
alias makenano='make TARGET=redbee-econotag WITH_WEBSERVER=webserver-nano WITH_RPL=1;cp webserver6_redbee-econotag.bin copy.bin'
Then you can use a common set of load, log, and flash commands. To keep track of which command was last used on which port, add (or uncomment) the settitle function first. This version cancels the PS1 string on cygwin, which overrides the title to be the prompt string:
settitle () {
PS1='\n\[\e[32m\]\u@\h \[\e[33m\]\w\[\e[0m\]\n\$ '
echo -ne "\e]2;$@\a\e]1;$@\a";
}
alias load5='settitle ttyS5;~/contiki/cpu/mc1322x/tools/mc1322x-load.pl -a 0 -b 0 -t /dev/ttyS5 -f copy.bin -lr ttys5.log'
alias load8='settitle ttyS8;~/contiki/cpu/mc1322x/tools/mc1322x-load.pl -a 0 -b 0 -t /dev/ttyS8 -f copy.bin -lr ttys8.log'
alias load11='settitle ttyS11;~/contiki/cpu/mc1322x/tools/mc1322x-load.pl -a 0 -b 0 -t /dev/ttyS11 -f copy.bin -lr ttys11.log'
alias load15='settitle ttyS15;~/contiki/cpu/mc1322x/tools/mc1322x-load.pl -a 0 -b 0 -t /dev/ttyS15 -f copy.bin -lr ttys15.log'
alias load19='settitle ttyS19;~/contiki/cpu/mc1322x/tools/mc1322x-load.pl -a 0 -b 0 -t /dev/ttyS19 -f copy.bin -lr ttys19.log'
alias load21='settitle ttyS21;~/contiki/cpu/mc1322x/tools/mc1322x-load.pl -a 0 -b 0 -t /dev/ttyS21 -f copy.bin -lr ttys21.log'
alias log5='settitle logttyS5;~/contiki/cpu/mc1322x/tools/mc1322x-load.pl -a 0 -b 0 -t /dev/ttyS5 -la ttys5.log'
alias log8='settitle logttyS8;~/contiki/cpu/mc1322x/tools/mc1322x-load.pl -a 0 -b 0 -t /dev/ttyS8 -la ttys8.log'
alias log11='settitle logttyS11;~/contiki/cpu/mc1322x/tools/mc1322x-load.pl -a 0 -b 0 -t /dev/ttyS11 -la ttys11.log'
alias log15='settitle logttyS15;~/contiki/cpu/mc1322x/tools/mc1322x-load.pl -a 0 -b 0 -t /dev/ttyS15 -la ttys15.log'
alias log19='settitle logttyS19;~/contiki/cpu/mc1322x/tools/mc1322x-load.pl -a 0 -b 0 -t /dev/ttyS19 -la ttys19.log'
alias log21='settitle logttyS21;~/contiki/cpu/mc1322x/tools/mc1322x-load.pl -a 0 -b 0 -t /dev/ttyS21 -la ttys21.log'
alias flash5='settitle flashttyS5;~/contiki/cpu/mc1322x/tools/mc1322x-load.pl -a 0 -b 0 -f flasher.bin -secondfi copy.bin -t /dev/ttyS5 -la ttys5.log'
alias flash8='settitle flashttyS8;~/contiki/cpu/mc1322x/tools/mc1322x-load.pl -a 0 -b 0 -f flasher.bin -secondfi copy.bin -t /dev/ttyS8 -la ttys8.log'
alias flash11='settitle flashttyS11;~/contiki/cpu/mc1322x/tools/mc1322x-load.pl -a 0 -b 0 -f flasher.bin -secondfi copy.bin -t /dev/ttyS11 -la ttys11.log'
alias flash15='settitle flashttyS15;~/contiki/cpu/mc1322x/tools/mc1322x-load.pl -a 0 -b 0 -f flasher.bin -secondfi copy.bin -t /dev/ttyS15 -la ttys15.log'
alias flash19='settitle flashttyS19;~/contiki/cpu/mc1322x/tools/mc1322x-load.pl -a 0 -b 0 -f flasher.bin -secondfi copy.bin -t /dev/ttyS19 -la ttys19.log'
alias flash21='settitle flashttyS21;~/contiki/cpu/mc1322x/tools/mc1322x-load.pl -a 0 -b 0 -f flasher.bin -secondfi copy.bin -t /dev/ttyS21 -la ttys21.log'
alias webserver='cd ~/contiki/examples/webserver-ipv6'
alias borderrouter='cd ~/contiki/examples/ipv6/rpl-border-router'
Now you can open a command window, type borderrouter
, makeint
, load5
. Another command window, webserver
, makenano
, load11
. A third command window, webserver
, load15
. And so on. If you plug a mobile econotag into 21, log21
to get the serial output, or load21
to download whatever copy.bin
is in the current directory.