Skip to content
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

Motes change names while programming #26

Open
yschroeder opened this issue Oct 28, 2014 · 7 comments
Open

Motes change names while programming #26

yschroeder opened this issue Oct 28, 2014 · 7 comments
Labels

Comments

@yschroeder
Copy link

PR #13 from @comawill introduced a new problem:

After resetting a mote with inga_tool the mote is newly enumerated and may change its name, eg. from ttyUSB1 to ttyUSB0. After that avrdude tries to program ttyUSB1 and fails.

Reproduction:
Plug in 2 motes, they get enumerated as ttyUSB0 and ttyUSB1.
Remove ttyUSB0, only ttyUSB1 remains.
make program.upload, fails as after reset the mote is no longer on ttyUSB1 but on ttyUSB0
make program.upload, works because the mote is now ttyUSB0 before and after reset

I hope this time I found a valid bug in this PR...

@yschroeder yschroeder added the bug label Oct 28, 2014
@comawill
Copy link

this problem also existed before the PR and is not caused by PR #13

@comawill
Copy link

It will also occur if you specify the MOTES value by hand

@yschroeder
Copy link
Author

this problem also existed before the PR and is not caused by PR #13

This is incorrect, I just tested it by checking out one commit before bd53597 and there programming was possible:

~/contiki/examples/inga/demo (git)-[ed75066...] % ll /dev/ttyUSB*
crw-rw---- 1 root uucp 188, 1 28. Okt 12:56 /dev/ttyUSB1
~/contiki/examples/inga/demo (git)-[ed75066...] % make led_demo.upload
[APP.settings_set] loaded
[APP.settings_delete] loaded
INGA revison not set, defaults to REV=1.4
  CC        ../../../platform/inga/apps/settings_set/settings_set.c
  CC        ../../../platform/inga/apps/settings_delete/settings_delete.c
  CC        ../../../platform/inga/./contiki-inga-main.c
  AR        contiki-inga.a
  CC        led_demo.c
  LD        led_demo.inga
avr-objcopy led_demo.inga -j .text -j .data -O ihex led_demo.hex
make[1]: Entering directory '/home/yannic/contiki/tools/inga/inga_tool'
make[1]: Nothing to be done for 'all'.
make[1]: Leaving directory '/home/yannic/contiki/tools/inga/inga_tool'
MOTES: /dev/ttyUSB1
Resetting INGA node...Waiting 0.5s
Uploading...
avrdude -b 230400 -P /dev/ttyUSB0 -c avr109 -p atmega1284p -U flash:w:led_demo.hex& wait 

Connecting to programmer: .
Found programmer: Id = "INGA   "; type = S
    Software Version = 1.4; Hardware Version = 1.4
Programmer supports auto addr increment.
Programmer supports buffered memory access with buffersize=256 bytes.

Programmer supports the following devices:

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.01s

avrdude: Device signature = 0x1e9705 (probably m1284p)
avrdude: NOTE: "flash" memory has been specified, an erase cycle will be performed
         To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: reading input file "led_demo.hex"
avrdude: input file led_demo.hex auto detected as Intel Hex
avrdude: writing flash (58588 bytes):

Writing | ################################################## | 100% 4.36s

avrdude: 58588 bytes of flash written
avrdude: verifying flash memory against led_demo.hex:
avrdude: load data flash data from input file led_demo.hex:
avrdude: input file led_demo.hex auto detected as Intel Hex
avrdude: input file led_demo.hex contains 58588 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 2.99s

avrdude: verifying ...
avrdude: 58588 bytes of flash verified

avrdude done.  Thank you.

Upload done.
rm led_demo.co

@comawill
Copy link

wow, this is really confusing, because it should only use the value $(MOTES) for resetting and flashing. the resetting progress shows the value MOTES: /dev/ttyUSB1 and the flashing progress uses avrdude -b 230400 -P /dev/ttyUSB0. At the moment I can't find an explanation for this behavior in the makefile

@yschroeder
Copy link
Author

I won't blame you, Makefiles are black magic...

But anyway this magic feature was quite useful 😃

@comawill
Copy link

And I think we would need even more black magic, to get this feature back, because it is a bit hard to find the correct device-path after resetting. So from my point of view it was only luck to get a successful run of the programmer (It fails if you use make MOTES=/dev/USB1 led_demo.upload doesn't it?)

@yschroeder
Copy link
Author

Yes that fails as you expected.

Another idea: Can we check if the motes are enumerated in /dev/inga/?
We have a udev rule that puts all INGAs into that folder and sets their serial number as filename:

~/contiki/examples/inga/demo (git)-[ed75066...] % ll /dev/inga/              
insgesamt 0
lrwxrwxrwx 1 root root 10 28. Okt 13:36 node-A502C3ZS -> ../ttyUSB0

Theses names are stable over resetting and this way the feature can be brought back for users that use the udev rule. If there are no motes in that folder then use the default ttyUSB paths.

The longer I think about it, the more useful the old magic feature gets. I think I will personally be annoyed when I have to work with multiple motes and only every other try to program them works.

ejoerns pushed a commit that referenced this issue Nov 11, 2014
Attempt to solve Issue #26 (Motes change names while programming)
gvz pushed a commit to gvz/contiki-inga that referenced this issue Jul 15, 2016
Attempt to solve Issue ibr-cm#26 (Motes change names while programming)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants