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

Redwire IO Configuration #48

Closed
EmbeddedDesign opened this issue Jun 23, 2014 · 15 comments
Closed

Redwire IO Configuration #48

EmbeddedDesign opened this issue Jun 23, 2014 · 15 comments

Comments

@EmbeddedDesign
Copy link

Greetings!

We seem to be having a bit of trouble getting 6lbr up and running on a few Redwire IO's. (i.e. - these: https://redwire.myshopify.com/products/io-embedded-router-contiki-based)

We have followed the directions found here: https://github.com/cetic/6lbr/wiki/Redwire-IO-Configuration

The host OS is Ubuntu 13.04.

Though a bit rocky at first, it appears as though we have managed to successfully build everything.

These are the results of using the loader to upload the "router" image:

user@host:~/git/6lbr/cpu/mc1322x/tools$ ./mc1322x-load.pl -t /dev/ttyUSB1 -f ~/git/6lbr/examples/6lbr/tools/econotag/flasher_m12.bin -s ~/git/6lbr/examples/6lbr/bin_red-io/cetic_6lbr_router -c 'sudo bbmc -l redbee-econotag reset' -b 200
Found 1 devices with vendor id 0x0403 product id 0x6010
Opening device 0 interface 1 using layout redbee-econotag
toggle reset
done.
.CONNECT
Size: 11420 bytes
Sending /home/user/git/6lbr/examples/6lbr/tools/econotag/flasher_m12.bin
secondary send...
.Detecting internal nvm
nvm_detect returned: 0x00 type is: 0x00000001
nvm_erase returned: 0x00
ready
Size: 72904 bytes
Sending /home/user/git/6lbr/examples/6lbr/bin_red-io/cetic_6lbr_router
done sending files.
write_len: 0x00011cc8
write successfully done
prog_len: 0xea0001ff
flasher done

So, fantastic, it looks as though everything was flashed. However, now we seem to be stuck.

There is no output on the serial. Should there be? We have assumed 115200 8N1 with no luck. Other configurations also fail to produce output.

Following the connection guide here: https://github.com/cetic/6lbr/wiki/6LBR-Connection
seems to allow us to connect. (eth0 shows connection at least)

eth0 Link encap:Ethernet HWaddr (eth0 MAC)
inet6 addr: bbbb::101/64 Scope:Global
inet6 addr: (eth0 IPv6 address)/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

What should the address of the Redwire IO be? We presumed bbbb::100 but

user@host:~$ ping6 -I eth0 bbbb::100
PING bbbb::100(bbbb::100) from bbbb::101 eth0: 56 data bytes
From bbbb::101 icmp_seq=1 Destination unreachable: Address unreachable
From bbbb::101 icmp_seq=2 Destination unreachable: Address unreachable
From bbbb::101 icmp_seq=3 Destination unreachable: Address unreachable

Alternatively, the broadcast: ping6 -I eth0 ff02::1 produces responses only from eth0's IPv6 address.

Additionally, we cannot reach the webserver http://[bbbb::100]. Should we be able to or does this require further configuration?

Ideally, we would like to be able to set up a transparent link between two Redwire IO's (i.e. - what goes in the IPv6 ethernet interface of one comes out the other and vice versa) but we can't even seem to verify that a device is working at all. How can we tell?

Any information that anyone can provide would be greatly appreciated.

Thank you in advance for your support.

@laurentderu
Copy link
Member

Hello,

Have you tried flashing the firmware directly into ram ? If that works it's probably a bug in the flasher tool and I will have a look at it.

If it was programmed correctly, you should be able to access http://[bbbb::100] without further configuration

About connecting two IO, it is not possible using RPL enabled builds. What you have to do is either use the NDP-Router mode and the two IO will act as vanilla IPv6 routers. Another possibility is to use full transparent bridge mode, in that case each IO will forward packet received on one interface to the other and vice-versa. (please note that this mode is untested on IO, although it should work)

@EmbeddedDesign
Copy link
Author

Attempting to load into RAM (i.e. - ./mc1322x-load.pl -t /dev/ttyUSB1 -f ~/git/6lbr/examples/6lbr/bin_red-io/cetic_6lbr_smart_bridge) results in an indefinite hang (i.e. - lots of ................. that never end). Any thoughts on this?

Additionally, bbmc is now reporting:
bbmc -l redbee-econotag erase
Found 1 devices with vendor id 0x0403 product id 0x6010
Opening device 0 interface 1 using layout redbee-econotag
couldn't open dev_index 0

For our particular application full transparent bridge mode may be what we are looking for. I will continue to do some digging on this. Thank you for the recommendation.

@EmbeddedDesign
Copy link
Author

The bbmc issue proved to be a permissions issue that I had experienced before and simply overlooked. sudo fixed it. Attempting to load into RAM still hangs though, elevated permissions or not.

@EmbeddedDesign
Copy link
Author

Progress. (Apologies for the multiple posts in a row.)

Erasing memory before trying to upload into RAM seemed to do the trick. The webserver started and I was able to access the index page. Of course, this is not persistent between reboots.

user@host:/git/6lbr/cpu/mc1322x/tools$ $ sudo bbmc -l redbee-econotag erase
Found 1 devices with vendor id 0x0403 product id 0x6010
Opening device 0 interface 1 using layout redbee-econotag
setting VREF2 erase
toggle reset
waiting for erase
setting VREF2 normal
toggle reset
done.
user@host:
/git/6lbr/cpu/mc1322x/tools$ sudo ./mc1322x-load.pl -f ../../../examples/6lbr/bin_red-io/cetic_6lbr_router ( I edited the script to default to ttyUSB1 because I got tired of typing it)
CONNECT
Size: 72904 bytes
Sending ../../../examples/6lbr/bin_red-io/cetic_6lbr_router
done sending files.
mc1322x init
vbatt: 3227 mV
NVM failed without buck, trying with buck
buck ok
starting vbatt monitor
config bad magic ffff
config bad version ffff
flash invalid
mc1322x config:
magic: 1322
version: 1
eui: 0000000000000000
channel: 15
power: 17
flags: ffffffc5
demod: 1
autoack: 0
nvm type: 1
trying to start 32kHz xtal
32kHz xtal started
trim xtal for M12
setting panid 0xcdab
setting short mac 0xffff
setting long mac 0x00050c2a_8c51cc4b
Rime configured with address 00:05:0C:2A:8C:51:CC:4B
nullmac nullrdc, channel check rate 100 Hz, radio channel 26
Tentative link-local IPv6 address fe80:0000:0000:0000:0205:0c2a:8c51:cc4b
Starting 'CETIC Bridge process'
INFO: 6LBR: Starting 6LBR version 1.3.1 (Contiki-6lbr-1.3.1)
INFO: NVM: Reading 6LBR NVM
INFO: NVM: NVM Magic : ffff
INFO: NVM: NVM Version : ffff
ERROR: NVM: Invalid NVM magic number or unsupported NVM version, reseting it...
WARN: NVM: Migrate NVM version 0 towards 1
INFO: NVM: Flashing 6LBR NVM
INFO: ECON: Eth MAC address : 06:2a:8c:51:cc:4b
INFO: ETH: ENC-28J60 Process started
INFO: ETH: ENC28J60 init
INFO: ENC: enc28j60: resetting chip
INFO: 6LBR: Tentative local IPv6 address fe80::205:c2a:8c51:cc4b
INFO: 6LBR: Tentative global IPv6 address (WSN) aaaa::205:c2a:8c51:cc4b
INFO: 6LBR: Tentative global IPv6 address (ETH) bbbb::100
INFO: NVM: Flashing 6LBR NVM
INFO: 6LBR: Configured as DODAG Root
INFO: 6LBR: Starting as RPL ROUTER
INFO: 6LBR: CETIC 6LBR Started
INFO: HTTP: Script : /index.html
INFO: HTTP: Script : /favicon.ico
INFO: ENC: enc28j60: resetting chip
INFO: ENC: enc28j60: resetting chip
INFO: ENC: enc28j60: resetting chip
INFO: ENC: enc28j60: resetting chip

Also, these resets at the end just continue to pop up. Any thoughts on this?
Off to troubleshoot flashing into NVM.

@laurentderu
Copy link
Member

Hello,

Indeed you can only program in RAM with an erased flash, otherwise the bootloader will not enter programming mode.

The "enc28j60: resetting chip" is normal, when the Ethernet controller is idle it is reset periodically (this is a hardware workaround), the trace should be at debug level and not info though...

I had a look at the flasher, it seems the latest version can corrupt the flash, resulting in a non working flash (I still have to understand why and when it happens). In the mean time I rollbacked the flasher binary (flasher_m12.bin) in the develop branch to a older version that is stable. You can give it a try.

@EmbeddedDesign
Copy link
Author

The old flasher from develop did the trick. The images are now loading into NVM and are persistent. Thanks.
The secondary load is still a bit finicky and hangs occasionally but after a couple of retries seems to work just fine.

Might I suggest updating the wiki to reflect some of these findings perhaps?
I would be glad to assist is necessary.

Thank you again!

@EmbeddedDesign
Copy link
Author

We now seem to be having some trouble with the flasher script.
If I should open this as a new issue, please let me know but it seems related to Redwire IO Config so this thread may be just as good?

Running:
./flash.sh --nvm ../nvm.dat --dev /dev/ttyUSB1 --board m12
hangs indefinitely:
Found 1 devices with vendor id 0x0403 product id 0x6010
Opening device 0 interface 1 using layout redbee-econotag
toggle reset
done.
...............................(forever)

This is the version of the script from master, though it looks the same as the one in develop? I updated the script to include the appropriate paths to mc1322x-load.pl and bbmc.

As the router firmware for the Redwire IO seems to be the light version of 6lbr there is no configuration option on the routers web interface (i.e. - http://[bbbb::100]), nor can I seem to locate the 6lbr.conf file discussed under "Configuration" in the wiki anywhere, so it would appear as though the NVM Tool and flasher are my only option.

I don't see anything obviously wrong with the way the actual command gets generated at the end of the file:
$MC1322X_LOAD -t $DEV -f $FLASHER -c "$BBMC" -z $* 0x100,hexdump -v -e '"0x" 1/4 "%08x" ","' $NVM_FILE

echoing out these values results in:
/home/user/git/6lbr/cpu/mc1322x/tools/mc1322x-load.pl -t /dev/ttyUSB1 -f ./6lbr_nvm_flasher_m12.bin -c "sudo /home/user/git/6lbr/cpu/mc1322x/tools/ftditools/bbmc -l redbee-econotag reset" -z 0x100,hexdump -v -e '"0x" 1/4 "%08x" ","' ../nvm.dat

Unless there's something up with the hexdump arguments at the end there? I would expect to see more specific output than just a never-ending sting of ellipses if that were the case though.

Thanks again for the help.

@laurentderu
Copy link
Member

Indeed, the nvm-tool is the only option, the ram on the mc1322x is too small to support the configuration part of the webserver.

There is a bug in the documentation, once you have programmed a firmware in the flash you can not update the configuration nvm anymore (as the bootloader refuses to start from the RAM anymore); that's why you have this never-ending stream of dots (the flasher waits for the handshake of the bootloader)

So you have to flash your configuration using the nvm_flasher then program your firmware using flasher_m12.bin. (Note that when I rollbacked the flasher I reintroduced an old bug that corrupted the nvm, please checkout again flasher_m12.bin from the develop branch)

We will try to find a way to allow runtime reconfiguration of the IO in a future release

@EmbeddedDesign
Copy link
Author

So it looks as though we were able to generate an NVM file and upload it using the NVM flasher tool:
(the mount-point occasionally changes, but hey, no problem.)

user@host:~/git/6lbr/examples/6lbr/tools/econotag$ ./flash.sh --nvm ../nvm.dat --board m12 --dev /dev/ttyUSB2

(Still echoing out the actual command just for sanity)
/home/user/git/6lbr/cpu/mc1322x/tools/mc1322x-load.pl -t /dev/ttyUSB2 -f /home/user/git/6lbr/examples/6lbr/tools/econotag/6lbr_nvm_flasher_m12.bin -c "sudo bbmc -l redbee-econotag reset" -z 0x100,hexdump -v -e \'"0x" 1/4 "%08x" ","\' ../nvm.dat

Found 1 devices with vendor id 0x0403 product id 0x6010
Opening device 0 interface 1 using layout redbee-econotag
toggle reset
done.
................CNETONCONCCONNECT
Size: 11416 bytes
Sending /home/user/git/6lbr/examples/6lbr/tools/econotag/6lbr_nvm_flasher_m12.bin
secondary send...
Detecting internal nvm
nvm_detect returned: 0x00 type is: 0x00000001
nvm_read returned: 0x00
nvm_erase returned: 0x00
type is: 0x00000001
nvm_write returned: 0x00
ready
Size: 0 bytes
done sending files.
sending 0x100,0x00012009,0x0000bbbb,0x00000000,0x00000000,0x01010000,0xaaaaf01c,0x00000000,0x00000000,0x00000000,0xaaaa0000,0x00000000,0x00000000,0x00000000,0xbbbb0001,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0xff180000,0x40400000,0x00000000,0x00c80258,0x01c00003,0x00015180,0x00003840,0x07080100,0x0c08001e,0x01001e0a,0xffff0100,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff,,
len: 00000000
type is: 0x00000001
flasher done
writing addr 0001e100 data 00012009 err 00000000
writing addr 0001e104 data 0000bbbb err 00000000
writing addr 0001e108 data 00000000 err 00000000
writing addr 0001e10c data 01010000 err 00000000
writing addr 0001e110 data 0aaa0000 err 00000000
writing addr 0001e12c data 00000000 err 00000000
writing addr 0001e130 data 00003840 err 00000000
writing addr 0001e134 data 07080100 err 00000000
writing addr 0001e138 data ffffffff err 00000000
writing addr 0001e13c data 00ffffff err 00000000
writing addr 0001e140 data ffffffff err 00000000
writing addr 0001e144 data ffffffff err 00000000
writing addr 0001e148 data ffffffff err 00000000
writing addr 0001e14c data 00000fff err 00000000
writing addr 0001e150 data ffffffff err 00000000
writing addr 0001e154 data 0fffffff err 00000000

Then we attempt to upload the router firmware:

user@host:~/git/6lbr/cpu/mc1322x/tools$ sudo ./mc1322x-load.pl -f ../../../emples/6lbr/tools/econotag/flasher_m12.bin -s ../../../examples/6lbr/bin_red-io/cetic_6lbr_router -t /dev/ttyUSB2 -b 500 -c 'sudo bbmc -l redbee-econotag reset'
Found 1 devices with vendor id 0x0403 product id 0x6010
Opening device 0 interface 1 using layout redbee-econotag
toggle reset
done.
.process flasher done
CONNECT
Size: 11384 bytes
Sending ../../../examples/6lbr/tools/econotag/flasher_m12.bin
secondary send...
.Detecting internal nvm
nvm_detect returned: 0x00 type is: 0x00000001
nvm_erase returned: 0x00
type is: 0x00000001
ready
Size: 72904 bytes
Sending ../../../examples/6lbr/bin_red-io/cetic_6lbr_router
done sending files.
len: 00011cc8
type is: 0x00000001
nvm_write returned: 0x00
flasher done

mc1322x init
vbatt: 3218 mV
NVM failed without buck, trying with buck
buck ok
starting vbatt monitor
config bad magic ffff
config bad version ffff
flash invalid
mc1322x config:
magic: 1322
version: 1
eui: 0000000000000000
channel: 15
power: 17
flags: ffffffc5
demod: 1
autoack: 0
nvm type: 1
trying to start 32kHz xtal
32kHz xtal started
trim xtal for M12
setting panid 0xcdab
setting short mac 0xffff
setting long mac 0x00050c2a_8ccc3ff1
Rime configured with address 00:05:0C:2A:8C:CC:3F:F1
nullmac nullrdc, channel check rate 100 Hz, radio channel 26
Tentative link-local IPv6 address fe80:0000:0000:0000:0205:0c2a:8ccc:3ff1
Starting 'CETIC Bridge process'
INFO: 6LBR: Starting 6LBR version 1.3.1 (Contiki-6lbr-1.3.1)
INFO: NVM: Reading 6LBR NVM
INFO: NVM: NVM Magic : ffff
INFO: NVM: NVM Version : ffff
ERROR: NVM: Invalid NVM magic number or unsupported NVM version, reseting it...
WARN: NVM: Migrate NVM version 0 towards 1
INFO: NVM: Flashing 6LBR NVM
INFO: ECON: Eth MAC address : 06:2a:8c:cc:3f:f1
INFO: ETH: ENC-28J60 Process started
INFO: ETH: ENC28J60 init
INFO: ENC: enc28j60: resetting chip
INFO: 6LBR: Tentative local IPv6 address fe80::205:c2a:8ccc:3ff1
INFO: 6LBR: Tentative global IPv6 address (WSN) aaaa::205:c2a:8ccc:3ff1
INFO: 6LBR: Tentative global IPv6 address (ETH) bbbb::100
INFO: NVM: Flashing 6LBR NVM
INFO: 6LBR: Configured as DODAG Root
INFO: 6LBR: Starting as RPL ROUTER
INFO: 6LBR: CETIC 6LBR Started

But it looks like the NVM is getting erased again ( nvm_erase returned: 0x00) when we upload the router firmware and we get an Invalid NVM Error.
Everything starts up just fine but the settings are not as we set them in the .dat file (i.e. - channel 24, IPv6 address of bbbb::101 just to see if it would change, etc.)

Perhaps we misinterpreted your instructions?

@laurentderu
Copy link
Member

Hello,

No, you did not misinterpreted my instructions :) The flasher erase all but the configuration section of the NVM (using a mask).
However in your case the configuration is still reset (as indicated by "config bad magic" error). The root cause is that 6LBR and Redwire have their own configuration segment in the NVM; when you do an NVM erase both are reset. Now, 6lbr_nvm_flasher writes the 6LBR part, but keep the Redwire part untouched. When 6LBR starts up and calls the Redwire initialisation code, it can not find the Redwire configuration and trigger a whole NVM configuration reset, trashing the 6LBR configuration altogether.
Usually we always try our build by programming then in RAM and only when everything is ok we burn it in flash. So the Redwire configuration page is already set and properly copied when calling 6lbr_nvm_flasher. I forgot to specify it previously.

In short you should write your firmware in RAM, update the configuration using 6lbr_nvm_flasher and then write your firmware in NVM.

A proper solution will be included in the next release (either by appending the configuration to the firmware or by adding a run-time configuration mechanism with a small footprint)

@EmbeddedDesign
Copy link
Author

Well, that does indeed solve the bad magic number problem.

Here's the process in order.

Erase:

user@host:~/git/6lbr/examples/6lbr/tools/econotag$ sudo bbmc -l redbee-econotag erase
Found 1 devices with vendor id 0x0403 product id 0x6010
Opening device 0 interface 1 using layout redbee-econotag
setting VREF2 erase
toggle reset
waiting for erase
setting VREF2 normal
toggle reset
done.

Load firmware into RAM:

user@host:~/git/6lbr/cpu/mc1322x/tools$ sudo ./mc1322x-load.pl -f ../../../examples/6lbr/bin_red-io/cetic_6lbr_router
...............CONNECT
Size: 72904 bytes
Sending ../../../examples/6lbr/bin_red-io/cetic_6lbr_router
done sending files.
mc1322x init
vbatt: 3269 mV
NVM failed without buck, trying with buck
buck ok
starting vbatt monitor
config bad magic ffff
config bad version ffff
flash invalid
mc1322x config:
magic: 1322
version: 1
eui: 0000000000000000
channel: 15
power: 17
flags: ffffffc5
demod: 1
autoack: 0
nvm type: 1
trying to start 32kHz xtal
32kHz xtal started
trim xtal for M12
setting panid 0xcdab
setting short mac 0xffff
setting long mac 0x00050c2a_8cf12843
Rime configured with address 00:05:0C:2A:8C:F1:28:43
nullmac nullrdc, channel check rate 100 Hz, radio channel 26
Tentative link-local IPv6 address fe80:0000:0000:0000:0205:0c2a:8cf1:2843
Starting 'CETIC Bridge process'
INFO: 6LBR: Starting 6LBR version 1.3.1 (Contiki-6lbr-1.3.1)
INFO: NVM: Reading 6LBR NVM
INFO: NVM: NVM Magic : ffff
INFO: NVM: NVM Version : ffff
ERROR: NVM: Invalid NVM magic number or unsupported NVM version, reseting it...
WARN: NVM: Migrate NVM version 0 towards 1
INFO: NVM: Flashing 6LBR NVM
INFO: ECON: Eth MAC address : 06:2a:8c:f1:28:43
INFO: ETH: ENC-28J60 Process started
INFO: ETH: ENC28J60 init
INFO: ENC: enc28j60: resetting chip
INFO: 6LBR: Tentative local IPv6 address fe80::205:c2a:8cf1:2843
INFO: 6LBR: Tentative global IPv6 address (WSN) aaaa::205:c2a:8cf1:2843
INFO: 6LBR: Tentative global IPv6 address (ETH) bbbb::100
INFO: NVM: Flashing 6LBR NVM
INFO: 6LBR: Configured as DODAG Root
INFO: 6LBR: Starting as RPL ROUTER
INFO: 6LBR: CETIC 6LBR Started

Flash settings into NVM:

user@host:~/git/6lbr/examples/6lbr/tools/econotag$ ./flash.sh --nvm ../nvm.dat --board m12 --dev /dev/ttyUSB1
/home/user/git/6lbr/cpu/mc1322x/tools/mc1322x-load.pl -t /dev/ttyUSB1 -f /home/user/git/6lbr/examples/6lbr/tools/econotag/6lbr_nvm_flasher_m12.bin -c "sudo bbmc -l redbee-econotag reset" -z 0x100,hexdump -v -e \'"0x" 1/4 "%08x" ","\' ../nvm.dat
Found 1 devices with vendor id 0x0403 product id 0x6010
Opening device 0 interface 1 using layout redbee-econotag
toggle reset
done.
.CONNECT
Size: 11416 bytes
Sending /home/user/git/6lbr/examples/6lbr/tools/econotag/6lbr_nvm_flasher_m12.bin
secondary send...
Detecting internal nvm
nvm_detect returned: 0x00 type is: 0x00000001
nvm_read returned: 0x00
nvm_erase returned: 0x00
type is: 0x00000001
nvm_write returned: 0x00
ready
Size: 0 bytes
done sending files.
sending 0x100,0x00012009,0x0000bbbb,0x00000000,0x00000000,0x00010000,0xaaaaf01d,0x00000000,0x00000000,0x00000000,0xaaaa0000,0x00000000,0x00000000,0x00000000,0xbbbb0001,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0xff180000,0x40400000,0x00000000,0x00c80258,0x01c00003,0x00015180,0x00003840,0x07080100,0x0c08001e,0x01001e0a,0xffff0100,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff,,
len: 00000000
type is: 0x00000001
flasher done
writing addr 0001e100 data 00012009 err 00000000
writing addr 0001e104 data 0000bbbb err 00000000
writing addr 0001e108 data 00000000 err 00000000
writing addr 0001e10c data 00010000 err 00000000
writing addr 0001e110 data 00aaa000 err 00000000
writing addr 0001e12c data 00000000 err 00000000
writing addr 0001e130 data 00003840 err 00000000
writing addr 0001e134 data 07080100 err 00000000
writing addr 0001e138 data 8fffffff err 00000000
writing addr 0001e13c data ffffffff err 00000000
writing addr 0001e140 data ffffffff err 00000000
writing addr 0001e144 data ffffffff err 00000000
writing addr 0001e148 data 00000fff err 00000000
writing addr 0001e14c data ffffffff err 00000000
writing addr 0001e150 data 00ffffff err 00000000
writing addr 0001e154 data ffffffff err 00000000

Flash firmware into NVM:

user@host:~/git/6lbr/cpu/mc1322x/tools$ sudo ./mc1322x-load.pl -f ../../../examples/6lbr/tools/econotag/flasher_m12.bin -s ../../../examples/6lbr/bin_red-io/cetic_6lbr_router -t /dev/ttyUSB1 -b 500 -c 'sudo bbmc -l redbee-econotag reset'
Found 1 devices with vendor id 0x0403 product id 0x6010
Opening device 0 interface 1 using layout redbee-econotag
toggle reset
done.
.process flasher done
CONNECT
Size: 11384 bytes
Sending ../../../examples/6lbr/tools/econotag/flasher_m12.bin
secondary send...
.Detecting internal nvm
nvm_detect returned: 0x00 type is: 0x00000001
nvm_erase returned: 0x00
type is: 0x00000001
ready
Size: 72904 bytes
Sending ../../../examples/6lbr/bin_red-io/cetic_6lbr_router
done sending files.
len: 00011cc8
type is: 0x00000001
nvm_write returned: 0x00
flasher done
mc1322x init
vbatt: 3261 mV
NVM failed without buck, trying with buck
buck ok
starting vbatt monitor
mc1322x config:
magic: 1322
version: 1
eui: 00050c2a8cf12843
channel: 15
power: 17
flags: ffffffc5
demod: 1
autoack: 0
nvm type: 1
trying to start 32kHz xtal
32kHz xtal started
trim xtal for M12
setting panid 0xcdab
setting short mac 0xffff
setting long mac 0x00050c2a_8cf12843
Rime configured with address 00:05:0C:2A:8C:F1:28:43
nullmac nullrdc, channel check rate 100 Hz, radio channel 26
Tentative link-local IPv6 address fe80:0000:0000:0000:0205:0c2a:8cf1:2843
Starting 'CETIC Bridge process'
INFO: 6LBR: Starting 6LBR version 1.3.1 (Contiki-6lbr-1.3.1)
INFO: NVM: Reading 6LBR NVM
INFO: NVM: NVM Magic : 2009
INFO: NVM: NVM Version : 1
INFO: ECON: Eth MAC address : 06:2a:8c:f1:28:43
INFO: ETH: ENC-28J60 Process started
INFO: ETH: ENC28J60 init
INFO: ENC: enc28j60: resetting chip
INFO: 6LBR: Tentative local IPv6 address fe80::205:c2a:8cf1:2843
INFO: 6LBR: Tentative global IPv6 address (WSN) ffff:ffff:ffff:ffff:205:c2a:8cf1:2843
INFO: 6LBR: Tentative global IPv6 address (ETH) 807:ffff:ff8f:ffff:42a:8cff:fff1:2843
INFO: NVM: Flashing 6LBR NVM
INFO: 6LBR: Configured as DODAG Root
INFO: 6LBR: Starting as RPL ROUTER
INFO: 6LBR: CETIC 6LBR Started
INFO: ENC: enc28j60: resetting chip
INFO: ENC: enc28j60: resetting chip

So, no bad magic number and everything is persistent. That's great.
The only remaining issue is that settings we flashed do not match the settings reflected in the console output at boot.

Here is what the nvm.dat file looks like as generated with the nvm_tool:

user@host:~/git/6lbr/examples/6lbr/tools$ ./nvm_tool --print nvm.dat
Reading nvm file 'nvm.dat'
Channel : 24

WSN network prefix : aaaa::
WSN network prefix length : 64
WSN IP address : aaaa::100
WSN accept RA : True
WSN IP address autoconf : True

Eth network prefix : bbbb::
Eth network prefix length : 64
Eth IP address : bbbb::100
Eth default router : ::
Eth IP address autoconf : False

Local address rewrite : True
Smart Multi BR : False

RA daemon : True
RA router lifetime : 0
RA maximum interval : 600
RA minimum interval : 200
RA minimum delay : 3
RA PIO enabled : True
RA prefix valid lifetime : 86400
RA prefix preferred lifetime : 14400
RA RIO enabled : True
RA RIO lifetime : 1800

RPL instance ID : 30
RPL Preference : 0
RPL version ID : : 240
RPL DIO interval doubling : 8
RPL DIO minimum interval : 12
RPL DIO redundancy : 10
RPL default lifetime : 30
RPL minimum rank increment : 256
RPL lifetime unit : 256

Webserver configuration page disabled : False

The only exceptionally odd things are the IPv6 addresses assigned to the interfaces:
INFO: 6LBR: Tentative global IPv6 address (WSN) ffff:ffff:ffff:ffff:205:c2a:8cf1:2843
INFO: 6LBR: Tentative global IPv6 address (ETH) 807:ffff:ff8f:ffff:42a:8cff:fff1:2843

The WSN has autoconf enabled so I can foresee that changing but the ETH address should be bbbb::100 shouldn't it?

Thanks for all of the help thus far!

@laurentderu
Copy link
Member

Hello,

Looking at the traces it seems that the IO did not receive all the data sent by the nvm flasher; as there is no flow control on the secondary send data can be dropped; and so the content of the configuration nvm is corrupted, resulting in invalid prefixes.

If the mc1322x-load.pl is the one from 6lbr repository you should add in flash.sh "-b 5000" when MC1322X_LOAD is invoked so that whatever happens no data word is erased by the next one.

I made that one the default as the additional time taken to write the nvm is actually negligible, you can check it out from the develop branch.

@EmbeddedDesign
Copy link
Author

That seems to have done the trick! Thanks!

Now we just need to figure out what all of the settings need to be in order to get two devices to talk to each other. If anything that is a documentation issue and this thread can probably be closed.

Thanks again!

@laurentderu
Copy link
Member

Thank you for your feedback, I'll keep this issue open until the documentation is completely in line.

@laurentderu
Copy link
Member

In release 1.3.2 we have added a simple module to read and write the configuration NVM from the firmware directly and a simple tool to transfer the NVM data.

Documentation is available here https://github.com/cetic/6lbr/wiki/Nvm-Proxy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants