Re: IPSP bluetooth sample with QEMU (ping fails)


Paul Sokolovsky
 

Hello Priyanka,

Sorry for the delay with response, I was at Linaro Connect with pretty
packed local program. But we touched some questions you posed
below with Maureen Helm and David Leach of NXP (both are in cc:), so
hopefully I can bring some info.

Another note is that I appreciate that you use Zephyr "user" mailing
list - we have also the "devel" mailing, and some posts there would be
better suited for the user lists. But your posts are actually the
opposite, as they touch Zephyr development matters, so given there're
not many responses, I may suggest to post there too, maybe people
monitor it better.

See also below for more comments.


On Wed, 27 Sep 2017 20:27:05 +0000
Priyanka Rawat <priyanka.rawat@nxp.com> wrote:

Hi

Thank you Paul for the suggestions.
We are waiting for the real hardware (KW41Z board), meanwhile I
should test IPSP with QEMU.

Unfortunately, I do not have a 96b_carbon board. Does anyone know if
IPv6 over BLE, IPSP work on FRDM boards?
Not that I know of. And work done by Linaro on KW41Z/KW40Z revolves
around 802.15.4 instead. For example, there's a Zephyr driver
already in the tree, and 15.4-over-FSCI driver in the review:
https://github.com/zephyrproject-rtos/zephyr/pull/868 . I found a bit
strange there was no talk about BLE support, as "native" Hexiwear
support is all about BLE (and communication with smartphones), and
vice-versa, there's no sign of 15.4 support.

At the Connect, David mentioned that BLE controller/stack might have
been licensed from 3rd party vendor, and that poses additional
organizational complications to its support in Zephyr.

However, if you have a two-core system, like Hexiwear, where KW40Z is
used completely as a block box BLE controller, you might be able to run
it, if it uses the standard HCI protocol. At least we have couple of
boards in Zephyr which use a similar arrangement.

Eventually, we would like to test the following scenario;
KW41Z running Zephyr + 6loble (IPv6 over BLE) with a x86 Linux +
KW41Z-FRDM / USB.
Same here at Linaro, except we want to do it over 15.4 ;-).

Any idea if IPv6 over BLE / 6lowpan works over KW41Z running Zephyr?
Has anyone tested IPv6 over BLE with Zephyr over KW41Z board?
David (re)tested 6lowpan over 15.4 with KW41Z, it mostly works.
Reproducing that is my immediate TODO once I finish with post-travel
backlog.

What is the current status on IPv6 over BLE?
Well, it works (as an "experimental technology" would, with various
requirements and caveats).


I found some links on IPv6 over BLE, but couldn't figure out much
from them. Is there any other link I should look at?
I mention previously
https://github.com/zephyrproject-rtos/zephyr/pull/1185 , which
documents steps I went thru to get IPv6 over BLE running. I'd like to
extend an invitation to add a "+1" style comment to it if you find it
useful and would like to see it in the official documentation
(otherwise, the reviewers of that patch are people who also maintain
Linux kernel side of BLE and Bluez, and they assume that everyone runs
the latest kernel and Bluez, which is of course not true ;-) ).


https://github.com/zephyrproject-rtos/zephyr/pull/1151
net: l2: bt: Make 6lowpan/BLE be compatible with Linux by default
#1151

https://github.com/zephyrproject-rtos/zephyr/issues/3111
IPv6 over BLE no longer works after commit 2e9fd88 #3111


Update on IPSP sample with QEMU (ping works, but there are errors
like fatal kernel error etc., )
Well, great news! What kernel version do you use? The latest news is
that kernel 4.12 finally should fix all the issues (known issues) with
6lowpan/ble support:
https://github.com/zephyrproject-rtos/zephyr/commit/a4e176b6a33ebbb0732e4a1d8cb174bb57a6f510

If you have below that, might as well be not too surprised with errors,
etc. ;-). I myself running 4.10, waiting while my OS vendor will issue
an (still experimental) 4.12 upgrade.

-----------------------------------------------------------------------------------------------------------------------------------------

I tested IPSP bluetooth sample with QEMU again and ping works now.
Tests with telnet and echo-client work as well.

$ ping6 2001:db8::1
PING 2001:db8::1(2001:db8::1) 56 data bytes
64 bytes from 2001:db8::1: icmp_seq=1 ttl=64 time=27.2 ms
64 bytes from 2001:db8::1: icmp_seq=2 ttl=64 time=4.45 ms
64 bytes from 2001:db8::1: icmp_seq=3 ttl=64 time=2.13 ms
64 bytes from 2001:db8::1: icmp_seq=4 ttl=64 time=3.73 ms
^C

s$ telnet 2001:db8::1 4242
Trying 2001:db8::1...
Connected to 2001:db8::1.
Escape character is '^]'.
hello
hello
okkkkkkkk
okkkkkkkk

$ sudo ./echo-client -i bt0 2001:db8::1
Binding to 2001:db8::2
.......

However, I get warnings
[bt] [WRN] read_payload: Failed to allocate, deferring to rx_thread
[bt] [WRN] read_payload: Failed to allocate, deferring to rx_thread

and then after a while it terminates with the following error (fatal
kernel error and fatal fault in ISR!)

***** CPU Page Fault (error code 0x00000002)
Supervisor thread wrote address 0x00000008
PDE: 0x025 Present Read-only User
PTE: 0x000 Non-present Read-only Supervisor
Current thread ID = 0x004015e0
Faulting segment:address = 0x0008:0x00013170
eax: 0x00402094, ebx: 0x00403510, ecx: 0x0040200a, edx: 0x00402050
esi: 0x00000000, edi: 0x000001f4, ebp: 0x00417774, esp: 0x00417764
eflags: 0x202
Fatal fault in ISR! Spinning...
Terminate emulator due to fatal kernel error
$zephyr/scripts/Makefile.qemu:26: recipe for target 'run' failed
make[2]: *** [run] Error 1
make[2]: Leaving directory
'zephyr/samples/bluetooth/ipsp/outdir/qemu_x86' Makefile:178: recipe
for target 'sub-make' failed make[1]: *** [sub-make] Error 2
make[1]: Leaving directory '...../zephyr'
/zephyr/Makefile.inc:91: recipe for target 'run' failed
make: *** [run] Error 2

-------------------------------------------------

Following is the entire output.


[QEMU] CPU: qemu32

[bt] [INF] show_dev_info: Identity: 00:aa:01:00:00:23 (public)
[bt] [INF] show_dev_info: HCI: version 5.0 (0x09) revision 0x0000,
manufacturer 0x003f [bt] [INF] show_dev_info: LMP: version 5.0 (0x09)
subver 0x0000 [ipsp] [INF] init_app: Run IPSP sample
[ipsp] [INF] listen: Starting to wait
[bt] [ERR] read_payload: Not enough space in buffer
[bt] [WRN] hci_cmd_done: pool id 4 pool 0x0041add4 != &hci_cmd_pool
0x0041adb4 [ipsp] [DBG] build_reply_pkt: UDP IPv6 received 1 bytes
[ipsp] [DBG] build_reply_pkt: Received 1 bytes, sending 1 bytes
[ipsp] [DBG] pkt_sent: Sent 1 bytes
[ipsp] [DBG] build_reply_pkt: UDP IPv6 received 6 bytes
[ipsp] [DBG] build_reply_pkt: Received 6 bytes, sending 6 bytes
[ipsp] [DBG] pkt_sent: Sent 6 bytes
[ipsp] [DBG] build_reply_pkt: UDP IPv6 received 4 bytes
[ipsp] [DBG] build_reply_pkt: Received 4 bytes, sending 4 bytes
[ipsp] [DBG] pkt_sent: Sent 4 bytes
[ipsp] [DBG] build_reply_pkt: UDP IPv6 received 26 bytes
[ipsp] [DBG] build_reply_pkt: Received 26 bytes, sending 26 bytes
[ipsp] [DBG] pkt_sent: Sent 26 bytes
[bt] [WRN] read_payload: Failed to allocate, deferring to rx_thread
[bt] [WRN] read_payload: Failed to allocate, deferring to rx_thread
[bt] [WRN] read_payload: Failed to allocate, deferring to rx_thread
[bt] [WRN] read_payload: Failed to allocate, deferring to rx_thread
[bt] [WRN] read_payload: Failed to allocate, deferring to rx_thread
[bt] [WRN] read_payload: Failed to allocate, deferring to rx_thread
[ipsp] [DBG] build_reply_pkt: UDP IPv6 received 1232 bytes
[ipsp] [DBG] build_reply_pkt: Received 1232 bytes, sending 1232 bytes
[ipsp] [DBG] build_reply_pkt: UDP IPv6 received 1 bytes
[ipsp] [DBG] build_reply_pkt: Received 1 bytes, sending 1 bytes
[ipsp] [DBG] pkt_sent: Sent 1 bytes
[ipsp] [DBG] build_reply_pkt: UDP IPv6 received 256 bytes
[ipsp] [DBG] build_reply_pkt: Received 256 bytes, sending 256 bytes
[bt] [WRN] read_payload: Failed to allocate, deferring to rx_thread
[bt] [WRN] read_payload: Failed to allocate, deferring to rx_thread
[bt] [WRN] read_payload: Failed to allocate, deferring to rx_thread

[bt] [WRN] read_payload: Failed to allocate, deferring to rx_thread
[bt] [WRN] read_payload: Failed to allocate, deferring to rx_thread
[bt] [WRN] hci_cmd_done: pool id 4 pool 0x0041add4 != &hci_cmd_pool
0x0041adb4 [bt] [WRN] hci_cmd_done: pool id 4 pool 0x0041add4 !=
&hci_cmd_pool 0x0041adb4

[ipsp] [DBG] build_reply_pkt: TCP IPv6 received 7 bytes
[ipsp] [DBG] build_reply_pkt: Received 7 bytes, sending 7 bytes
[ipsp] [DBG] pkt_sent: Sent 7 bytes
[ipsp] [DBG] pkt_sent: Sent 7 bytes
[ipsp] [DBG] pkt_sent: Sent 0 bytes
[ipsp] [DBG] build_reply_pkt: TCP IPv6 received 11 bytes
[ipsp] [DBG] build_reply_pkt: Received 11 bytes, sending 11 bytes
[ipsp] [DBG] pkt_sent: Sent 11 bytes
[ipsp] [DBG] pkt_sent: Sent 11 bytes
[ipsp] [DBG] pkt_sent: Sent 0 bytes
[ipsp] [DBG] build_reply_pkt: TCP IPv6 received 36 bytes
[ipsp] [DBG] build_reply_pkt: Received 36 bytes, sending 36 bytes
[ipsp] [DBG] pkt_sent: Sent 36 bytes
[ipsp] [DBG] pkt_sent: Sent 36 bytes
[ipsp] [DBG] pkt_sent: Sent 0 bytes
[ipsp] [DBG] build_reply_pkt: TCP IPv6 received 86 bytes
[ipsp] [DBG] build_reply_pkt: Received 86 bytes, sending 86 bytes
[ipsp] [DBG] pkt_sent: Sent 86 bytes
[ipsp] [DBG] pkt_sent: Sent 0 bytes

[ipsp] [DBG] build_reply_pkt: TCP IPv6 received 7 bytes
[ipsp] [DBG] build_reply_pkt: Received 7 bytes, sending 7 bytes
***** CPU Page Fault (error code 0x00000002)
Supervisor thread wrote address 0x00000008
PDE: 0x025 Present Read-only User
PTE: 0x000 Non-present Read-only Supervisor
Current thread ID = 0x004015e0
Faulting segment:address = 0x0008:0x00013170
eax: 0x00402094, ebx: 0x00403510, ecx: 0x0040200a, edx: 0x00402050
esi: 0x00000000, edi: 0x000001f4, ebp: 0x00417774, esp: 0x00417764
eflags: 0x202
Fatal fault in ISR! Spinning...
Terminate emulator due to fatal kernel error
/zephyr/scripts/Makefile.qemu:26: recipe for target 'run' failed
make[2]: *** [run] Error 1
make[2]: Leaving directory
'/zephyr/samples/bluetooth/ipsp/outdir/qemu_x86' Makefile:178: recipe
for target 'sub-make' failed make[1]: *** [sub-make] Error 2
make[1]: Leaving directory '/Downloads/zephyr-LTI/zephyr'
/zephyr/Makefile.inc:91: recipe for target 'run' failed
make: *** [run] Error 2

-----------------------------------------------------------------------------------

Has anyone come across similar errors?

I found a link on Bluetooth: ipsp fixes
https://github.com/zephyrproject-rtos/zephyr/pull/1537/files?diff=split
Not sure if this would fix the above issues.


Best Regards,
Priyanka


-----Original Message-----
From: zephyr-users-bounces@lists.zephyrproject.org
[mailto:zephyr-users- bounces@lists.zephyrproject.org] On Behalf Of
Paul Sokolovsky
Sent: Thursday, September 21, 2017 9:46 PM
To: Priyanka Rawat <priyanka.rawat@nxp.com>
Cc: zephyr-users@lists.zephyrproject.org
Subject: Re: [Zephyr-users] IPSP bluetooth sample with QEMU (ping
fails)

Hello Priyanka,

On Mon, 18 Sep 2017 17:04:25 +0000
Priyanka Rawat <priyanka.rawat@nxp.com> wrote:

While testing bluetooth IPSP sample (recent master branch of
zephyr) with Qemu, ping fails (no response found) and

ping: sendmsg: No buffer space available (wireshark capture
attached).

I noticed that there are some old issues and bugs reported on the
IPSP sample. However, I couldn't figure out if the bugs/issues
have been resolved already.

What is the current status on the IPSP bluetooth sample? Anyone
tested IPSP sample with Qemu?
I tested it on BOARD=96b_carbon (real hardware) straight before 1.9
release, everything worked well, and I captured docs required to
set it up at
https://github.com/zephyrproject-rtos/zephyr/pull/1185 (if you
would find detailed instructions for setting up IPSP in Zephyr
useful, please add +1 comment to that pull request).

What's your usecase for working with BLE in qemu_x86 in general? I
fully understand and support the idea of being able to run it via
QEMU, so everyone can test it without a real hardware, but based on
your own experience, not everything works smooth there. So, if
you're just interested in BLE and/or IPSP, I'd suggest to try them
on some real board as an alternative to QEMU, that's known to work
pretty well (across few boards).

I myself a novice with BLE support in Zephyr (usually work on other
things), and would be interested to get it work with QEMU too, but
don't know when I'll be able to pay enough attention to it, as I'm
currently working on few other things keeping me pretty busy.


I get the following for the IPSP test:

zephyr/samples/bluetooth/ipsp$ make BOARD=qemu_x86
CONF_FILE=prj_dbg.conf run

[QEMU] CPU: qemu32
qemu-system-i386: warning: Unknown firmware file in legacy mode:
genroms/multiboot.bin

[bt] [INF] show_dev_info: Identity: 00:aa:01:00:00:23 (public)
[bt] [INF] show_dev_info: HCI: version 5.0 (0x09) revision
0x0000, manufacturer 0x003f [bt] [INF] show_dev_info: LMP:
version 5.0 (0x09) subver 0x0000 [ipsp] [INF] init_app: Run IPSP
sample [ipsp] [INF]
listen: Starting to wait


On host PC

----------------

I enabled 6lowpan and bluetooth_6lowpan


# modprobe bluetooth_6lowpan
# modprobe 6lowpan
# echo 1 > /sys/kernel/debug/bluetooth/6lowpan_enable
# echo connect "00:aa:01:00:00:23 1"
/sys/kernel/debug/bluetooth/6lowpan_control


$ sudo hcitool lescan
[sudo] password for nxf32661:
LE Scan ...
00:AA:01:00:00:23 (unknown)
00:AA:01:00:00:23 Test IPSP node


$ sudo ./echo-client -i bt0 2001:db8::1 Binding to 2001:db8::2
Timeout while waiting idx 0 len 1 Timeout while waiting idx 1 len
6 Timeout while waiting idx 2 len 4 Timeout while waiting idx 3
len 26 Timeout while waiting idx 4 len 1232 Timeout while waiting
idx 5 len 1 Timeout while waiting idx 6 len 256

$ ping6 -I bt0 2001:db8::1
PING 2001:db8::1(2001:db8::1) from 2001:db8::2 bt0: 56 data bytes
ping: sendmsg: No buffer space available
ping: sendmsg: No buffer space available
ping: sendmsg: No buffer space available
ping: sendmsg: No buffer space available

$ ifconfig bt0
bt0 Link encap:UNSPEC HWaddr
00-AA-01-FF-FE-01-00-24-00-00-00-00-00-00-00-00 inet6 addr:
fe80::2aa:1ff:fe01:24/64 Scope:Link inet6 addr: 2001:db8::2/64
Scope:Global UP POINTOPOINT RUNNING MULTICAST MTU:1280 Metric:1
RX packets:76 errors:0 dropped:0 overruns:0 frame:0
TX packets:91 errors:0 dropped:91 overruns:0 carrier:0
collisions:0 txqueuelen:1
RX bytes:7128 (7.1 KB) TX bytes:8532 (8.5 KB)

Thanks
Priyanka


--
Best Regards,
Paul

Linaro.org | Open source software for ARM SoCs Follow Linaro:
http://www.facebook.com/pages/Linaro
http://twitter.com/#!/linaroorg - http://www.linaro.org/linaro-blog
_______________________________________________
Zephyr-users mailing list
Zephyr-users@lists.zephyrproject.org
https://lists.zephyrproject.org/mailman/listinfo/zephyr-user


--
Best Regards,
Paul

Linaro.org | Open source software for ARM SoCs
Follow Linaro: http://www.facebook.com/pages/Linaro
http://twitter.com/#!/linaroorg - http://www.linaro.org/linaro-blog

Join users@lists.zephyrproject.org to automatically receive all group messages.