Open aicastell opened 10 years ago
Hello forum.
I made some progress on this issue, but still can't start testing communications.
This is the progress done:
* On the host side, want to use Jennisense/contiki-jn51xx/tools/tunslip6.c
The tunslip6.c tool compiles and works fine on the PC host:
$ cd Jennisense/contiki-jn51xx/tools
$ make tunslip6
$ sudo ./tunslip6 -B 115200 -s /dev/ttyUSB0 -v5 aaaa::1/6
* On the mote side, want to use examples/ipv6/rpl-border-router
The rpl-border-router doesn't compile fine. This is the compilation log:
$ make TARGET=jndevkit
ba-elf-gcc -DPROJECT_CONF_H=\"project-conf.h\" -DWEBSERVER=1 -DCONTIKI=1 -DCONTIKI_TARGET_JNDEVKIT=1 -DUIP_CONF_IPV6=1 -I../../../cpu/jennic/jn5148 -Wall -Os -fomit-frame-pointer -fpack-struct -Wcast-align -fdata-sections -ffunction-sections -march=ba2 -msibcall -mno-entri -mno-multi -mno-setcc -mno-cmov -mno-carry -mno-subb -mno-sext -mno-ror -mno-hard-div -mhard-mul -mbranch-cost=3 -msimple-mul -mredzone-size=4 -ffixed-r16 -ffixed-r17 -ffixed-r18 -ffixed-r19 -ffixed-r20 -ffixed-r21 -ffixed-r22 -ffixed-r23 -ffixed-r24 -ffixed-r25 -ffixed-r26 -ffixed-r27 -ffixed-r28 -ffixed-r29 -ffixed-r30 -ffixed-r31 -I. -I../../../platform/jndevkit/. -I../../../platform/jndevkit/dev -I../../../platform/jndevkit/net -I../../../cpu/jennic/. -I../../../cpu/jennic/dev -I../../../cpu/jennic/net -I../../../cpu/jennic/sys -I../../../core/dev -I../../../core/lib -I../../../core/net -I../../../core/net/mac -I../../../core/net/rime -I../../../core/net/rpl -I../../../core/sys -I../../../core/cfs -I../../../core/ctk -I../../../core/lib/ctk -I../../../core/loader -I../../../core/. -I../../../apps/webserver -DAUTOSTART_ENABLE -c border-router.c -o border-router.co
ba-elf-gcc -L../../../cpu/jennic/jn5148 -Wl,--relax -TAppBuild_JN5148.ld -nostartfiles -mba2_elf -march=ba2 -Wl,-Map=contiki-jndevkit.map obj_jndevkit/contiki-main.o border-router.co obj_jndevkit/slip-bridge.o obj_jndevkit/httpd-simple.o contiki-jndevkit.a -lHwPatch -lMacPatch -o border-router.jndevkit
contiki-jndevkit.a(sprintf.o): In function _putchar': sprintf.c:(.text.putchar+0x0): multiple definition of
_putchar'
obj_jndevkit/slip-bridge.o:slip-bridge.c:(.text.putchar+0x0): first defined here
/mnt/data/gatchets/jennic5148/ba2-elf/bin/../lib/gcc/ba-elf/4.1.2/../../../../ba-elf/bin/ld: Disabling relaxation: it will not work with multiple definitions
/mnt/data/gatchets/jennic5148/ba2-elf/bin/../lib/gcc/ba-elf/4.1.2/../../../../ba-elf/bin/ld: Warning: size of symbol _putchar' changed from 76 in obj_jndevkit/slip-bridge.o to 17 in contiki-jndevkit.a(sprintf.o) obj_jndevkit/slip-bridge.o: In function
_init':
slip-bridge.c:(.text.init+0xb): undefined reference to _BAUD2UBR' slip-bridge.c:(.text.init+0x11): undefined reference to
_slip_arch_init'
obj_jndevkit/slip-bridge.o: In function _putchar': slip-bridge.c:(.text.putchar+0x13): undefined reference to
_slip_arch_writeb'
slip-bridge.c:(.text.putchar+0x1c): undefined reference to _slip_arch_writeb' slip-bridge.c:(.text.putchar+0x2d): undefined reference to
_slip_arch_writeb'
slip-bridge.c:(.text.putchar+0x3d): undefined reference to _slip_arch_writeb' contiki-jndevkit.a(slip.o): In function
_slip_write':
slip.c:(.text.slip_write+0xc): undefined reference to _slip_arch_writeb' contiki-jndevkit.a(slip.o):slip.c:(.text.slip_write+0x26): more undefined references to
_slip_arch_writeb' follow
collect2: ld returned 1 exit status
make: *\ [border-router.jndevkit] Error 1
rm border-router.co
Can somebody help this this issue, please?
Thank you in advance.
Dear forum. I fixed compilation problems, but I am still working on this issue. The progress done was this:
1) Create this file:
contiki-jn51xx/platform/jndevkit/slip_uart0.c
with contents:
#include <stdio.h>
#include "contiki.h"
#include "slip.h"
void
slip_arch_init(unsigned long ubr)
{
// TODO
}
void
slip_arch_writeb(unsigned char c)
{
// TODO
}
2) Edit this file:
contiki-jn51xx/platform/jndevkit/Makefile
and add "slip_uart0.c" to CONTIKI_TARGET_SOURCEFILES
3) Edit ./contiki-jn51xx/cpu/jennic/sprintf.c and comment this function:
/*
#undef putchar
int putchar(int c)
{
uart0_writeb(c);
return 1;
} */
4) Enter into the rpl-border-router directory
$ cd contiki-jn51xx/examples/ipv6/rpl-border-router
5) And make compilation:
$ make TARGET=jndevkit
This generates a binary "border-router.jndevkit" as expected.
However, this code is still not already finished. The remaining work is:
1) These functions must be implemented:
+ void slip_arch_init(unsigned long ubr)
+ void slip_arch_writeb(unsigned char c)
I think implementation is close related with vAHI_Uart* interface, but I have to check this in deep.
2) Not very proud about the temporal solution to fix problem with "putchar" (solution given at point number 3). Maybe somebody can suggest a better solution?
I will continue working on this in the next days.
Thanks in advance.
Regards, -- Ivan
Continuing with my previous post...
I want to use UART0 for debugging purposes, and UART1 for the SLIP communications. The implementation done for the TODO functions in my previous post, renaming contiki-jn51xx/platform/jndevkit/slip_uart0.c as contiki-jn51xx/platform/jndevkit/slip_uart1.c, is this:
void slip_arch_init(unsigned long ubr) { uart1_init(ubr); }
void slip_arch_writeb(unsigned char c) { uart1_writeb(c); }
I still have to comment "putchar" function on this file:
./contiki-jn51xx/cpu/jennic/sprintf.c
to be able to compile the rpl-border-router Contiki application.
I am able to run tunslip6 application on my host:
$ sudo ./tunslip6 -B 115200 -s /dev/ttyUSB1 -v6 aaaa::1/6
****SLIP started on /dev/ttyUSB1'' opened tun device
/dev/tun0''
ifconfig tun0 inet hostname
up
ifconfig tun0 add aaaa::1/6
ifconfig tun0
tun0 Link encap:UNSPEC direcciónHW 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 Direc. inet:127.0.1.1 P-t-P:127.0.1.1 Másc:255.255.255.255 Dirección inet6: aaaa::1/6 Alcance:Global ACTIVO PUNTO A PUNTO FUNCIONANDO NOARP MULTICAST MTU:1500 Métrica:1 Paquetes RX:0 errores:0 perdidos:0 overruns:0 frame:0 Paquetes TX:0 errores:0 perdidos:0 overruns:0 carrier:0 colisiones:0 long.colaTX:500 Bytes RX:0 (0.0 B) TX bytes:0 (0.0 B)
Packet from TUN of length 76 - write SLIP 0000 60 00 00 00 00 24 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ff 02 00 00 00 00 00 00 00 00 00 00 00 00 00 16 3a 00 05 02 00 00 01 00 8f 00 6e 8a 00 00 00 01 04 00 00 00 ff 02 00 00 00 00 00 00 00 00 00 00 00 00 00 02 Packet from TUN of length 76 - write SLIP 0000 60 00 00 00 00 24 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ff 02 00 00 00 00 00 00 00 00 00 00 00 00 00 16 3a 00 05 02 00 00 01 00 8f 00 6e 8a 00 00 00 01 04 00 00 00 ff 02 00 00 00 00 00 00 00 00 00 00 00 00 00 02
But I don't know what is the IPv6 address of my rpl-border-route on the 802.15.4 network, I don't find the source code that initializes the IPv6 address of the Jennic node.
I see on the debug console (UART0) this message:
" Tentative link-local IPv6 address: fe80::c801:0101:0101:0202"
Because I'm compiling with WITH_WEBSERVER=1 flag (Makefile), I tried to browse to that address:
http://[fe80::c801:0101:0101:0202]
but it doesn't work, browser doesn't connect to the webserver.
I have also tried to ping that IPv6 address through the tun0 tunnel:
$ ping6 -I tun0 fe80:0000:0000:0000:c801:0101:0101:0202
and I see packets arriving to the tunnel
Packet from TUN of length 104 - write SLIP 0000 60 00 00 00 00 40 3a 40 aa aa 00 00 00 00 00 00 00 00 00 00 00 00 00 01 fe 80 00 00 00 00 00 00 c8 01 01 01 01 01 02 02 80 00 61 a5 27 95 00 54 5a e1 84 53 00 00 00 00 d9 bc 09 00 00 00 00 00 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f 20 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f 30 31 32 33 34 35 36 37
but getting no reply at all.
Please, any help on this would be very helpful.
Thanks in advance.
Regards, -- Ivan
It seems SLIP is not the most proper way to connect the device acting as border-router with the host (PC). Unfortunately, none of my Contiki devices (Jennic JN5148) have an Ethernet interface to connect with my PC, so I have to connect the device acting as border-router with my PC via a SLIP (UART) connection.
I fixed my SLIP connection, but still I'm trying to communicate Contiki devices with PC host. Hope some of you can help with this.
Now, Im sure my border-router device can send information to the host (PC). To check my SLIP connection, I implemented and loaded into the border-router device this simple Contiki application:
#include "contiki.h"
#include "net/uip.h"
#include "dev/slip.h"
#include "dev/uart1.h"
PROCESS(slip_process_test, "SLIP process test");
AUTOSTART_PROCESSES(&slip_process_test);
#define INTERVAL (CLOCK_SECOND)
void
say_hello(void)
{
uip_buf[0] = 'h';
uip_buf[1] = 'e';
uip_buf[2] = 'l';
uip_buf[3] = 'l';
uip_buf[4] = 'o';
uip_len = 5;
slip_send();
uip_len = 0;
}
PROCESS_THREAD(slip_process_test, ev, data)
{
static struct etimer period_timer;
slip_arch_init(115200);
PROCESS_BEGIN();
PROCESS_PAUSE();
etimer_set(&period_timer, INTERVAL);
while(1){
PROCESS_YIELD_UNTIL(ev == PROCESS_EVENT_TIMER);
say_hello();
etimer_restart(&period_timer);
}
PROCESS_END();
}
On my PC side, I compiled this application:
$ cd contiki-jn51xx/tools
$ make scat
After running "scat" on the host (PC), I receive the string "hello" on the PC every second. So, now I'm sure my fisrt problem related with compilation was finally fixed, and my SLIP channel works fine.
Now I need some help on setting up the IPv6 network to be able to send information from Contiki devices to the host (PC). For testing, I have a network using 3 devices:
a) contiki device (client)
b) contiki device (border-router)
c) Linux PC (server)
The connection schema:
a) b) c)
app?? rpl-border-router tun6slip
Contiki Contiki Linux
JN5148 <=== IPv6 ===> JN5148 <== RS232 ==> PC
Device c)
$ sudo sysctl -w net.ipv6.conf.all.forwarding=1
$ sudo ./tunslip6 -B 115200 -s /dev/ttyUSB0 -v5 aaaa::1/64
Device b)
* Running contiki-jn51xx/examples/ipv6/rpl-border-router
* This device has Link-Local IPv6 address fe80::c801:0101:0101:0202
Questions:
* What application can I run on device a) to send a simple message to the device c)?
* How the Global IPv6 address aaaa::2/64 is setup on b) and aaaa::3/64 on c)?
* Do I have to setup any other network parameter (related with RPL), apart from IPv6 addresses on a), b) and c), to be able to route messages from a) to c)?
* I have read something about "radvd" service, a service similar to DHCP (IPv4), but I think this is an optional service, and I can setup the network in a more simple (static) way. Is it true?
Not just for the JN5148, but for a generic Contiki platform, It would be very helpful for those as me who start working with Contiki, to have some documentation explaining steps to setup a 6LowPAN network with a rpl-border-router. Do you know if some related documentation already exists?
I appreciate any help on this. Thank you very much!! -- Ivan
How the Global IPv6 address aaaa::2/64 is setup on b) and aaaa::3/64 on c)?
I have used flash programmer "jenprog" to change the MAC address of the Jennic device b) acting as border-router:
$ jenprog -c serial -m 0x0000000000000002
waiting for /dev/ttyUSB0..done
waiting until queues are emtpy..done
Now I can check the MAC address of this device b):
$ jenprog -c serial -s
waiting for /dev/ttyUSB0..done
waiting until queues are emtpy..done
flash: ST M25P40
mac: 0x0000000000000002 license: 0x00010203040506070810111213141500
To set the IPv6 network prefix "aaaa::", I have modified this file:
contiki-jn51xx/platform/jndevkit/contiki-main.c
In this way:
// uip_ip6addr(&ipaddr, 0xfe80, 0, 0, 0, 0, 0, 0, 0);
uip_ip6addr(&ipaddr, 0xaaaa, 0, 0, 0, 0, 0, 0, 0);
When I switch on the board, I see this message on the debug console (UART0)
Tentative link-local IPv6 address aaaa:0000:0000:0000:0200:0000:0000:0002
^
WHY?
I don't understand WHY this number "2" appears on the IPv6 addres, but I think it doesn't matter. The most important is the network prefix "aaaa::" being the same on PC and device b). Let's run tunslip6 again:
$ sudo ./tunslip6 -B 115200 -s /dev/ttyUSB0 -v5 aaaa::1/64
********SLIP started on ``/dev/ttyUSB0''
opened tun device ``/dev/tun0''
ifconfig tun0 inet `hostname` up
ifconfig tun0 add aaaa::1/64
ifconfig tun0
tun0 Link encap:UNSPEC direcciónHW 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
Direc. inet:127.0.1.1 P-t-P:127.0.1.1 Másc:255.255.255.255
Dirección inet6: aaaa::1/64 Alcance:Global
ACTIVO PUNTO A PUNTO FUNCIONANDO NOARP MULTICAST MTU:1500 Métrica:1
Paquetes RX:0 errores:0 perdidos:0 overruns:0 frame:0
Paquetes TX:0 errores:0 perdidos:0 overruns:0 carrier:0
colisiones:0 long.colaTX:500
Bytes RX:0 (0.0 B) TX bytes:0 (0.0 B)
Packet from TUN of length 76 - write SLIP
0000 60 00 00 00 00 24 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ff 02 00 00 00 00 00 00 00 00 00 00 00 00 00 16 3a 00 05 02 00 00 01 00 8f 00 6e 8a 00 00 00 01 04 00 00 00 ff 02 00 00 00 00 00 00 00 00 00 00 00 00 00 02
Packet from TUN of length 76 - write SLIP
0000 60 00 00 00 00 24 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ff 02 00 00 00 00 00 00 00 00 00 00 00 00 00 16 3a 00 05 02 00 00 01 00 8f 00 6e 8a 00 00 00 01 04 00 00 00 ff 02 00 00 00 00 00 00 00 00 00 00 00 00 00 02
Ok, now we have 2 IPv6 devices on the same network segment, physically connected using SLIP:
c) IPv6: aaaa::1
b) IPv6: aaaa::0200:0000:0000:0002
I repeat the process of sending a ping6 from PC to device b). This should work...
$ ping6 -I tun0 aaaa:0000:0000:0000:0200:0000:0000:0002
Packets are passing through the tun0 interface:
Packet from TUN of length 104 - write SLIP 0000 60 00 00 00 00 40 3a 40 aa aa 00 00 00 00 00 00 00 00 00 00 00 00 00 01 aa aa 00 00 00 00 00 00 02 00 00 00 00 00 00 02 80 00 03 33 35 b0 00 01 bc 18 94 53 00 00 00 00 d3 09 0d 00 00 00 00 00 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f 20 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f 30 31 32 33 34 35 36 37
Packet from TUN of length 104 - write SLIP 0000 60 00 00 00 00 40 3a 40 aa aa 00 00 00 00 00 00 00 00 00 00 00 00 00 01 aa aa 00 00 00 00 00 00 02 00 00 00 00 00 00 02 80 00 71 0e 35 b0 00 02 bd 18 94 53 00 00 00 00 64 2d 0d 00 00 00 00 00 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f 20 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f 30 31 32 33 34 35 36 37
Packet from TUN of length 104 - write SLIP 0000 60 00 00 00 00 40 3a 40 aa aa 00 00 00 00 00 00 00 00 00 00 00 00 00 01 aa aa 00 00 00 00 00 00 02 00 00 00 00 00 00 02 80 00 32 ee 35 b0 00 03 be 18 94 53 00 00 00 00 a1 4c 0d 00 00 00 00 00 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f 20 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f 30 31 32 33 34 35 36 37
But this doesn't work, no answer from b) device at all:
$ ping6 -I tun0 aaaa:0000:0000:0000:0200:0000:0000:0002
PING aaaa:0000:0000:0000:0200:0000:0000:0002(aaaa::200:0:0:2) from aaaa::1 tun0: 56 data bytes
^C
--- aaaa:0000:0000:0000:0200:0000:0000:0002 ping statistics ---
23 packets transmitted, 0 received, 100% packet loss, time 22174ms
Please, some help to continue debugging this issue, would be very helpful...
Thank you!! -- Ivan
Hello.
I want to test IPv6 communications between my PC host and a Jennic JN5148 mote on the 6LowPAN network. I want to use a SLIP channel to exchange (send/receive) information between mote and host.
On host (PC) side, I have found these two examples on Jennisense:
What is the best option to use? tun? tap? Or once setup, it doesn't matter?
In file: Jennisense/applications/ethbridge/README (and also in some old posts published on the forum), this link is pointed:
Supposedly, it points to a document explaining more information on slip bridging. But that link is broken. I would like to take a look, to learn more about this before asking stupid questions. I have searched on Google, but it seems not being available at all. Does some of you know a different source to find it?
Related with mote side, what Contiki application should be loaded on the mote, to be able to exchange information with my host?
Reading README file applications/ethbridge/README, it seems tapslip6.c should be used on mote side, and slipbridge.c on host side. But there are so many alternatives, that I'm not sure how to start with this...
Any help on this will be very welcome!
Thank you in advance!!
Best regards, -- Ivan