Community
cancel
Showing results for 
Search instead for 
Did you mean: 
JMont18
Novice
2,025 Views

Bluetooth SPP Edison to PC

Hello,

I've been trying to manually send and receive serial data to my Windows 7 PC via bluetooth from the Edison. I have managed to successfully send from the pc to the Edison by following this guide using Putty instead of an android phone, but I had to use an older image file (image 28-09-15) in order for this to work. I did try this on an iPhone but I can't find an app which can find the Edison even when its connected. But the problem I'm having is that I want to also be able to manually send in the other direction from the Edison terminal to the Putty comport, does anyone know how to do this?

The other problem I'm also having is that now I've gone back to an older image version I can no longer compile a project in Eclipse. I get the following error in the console window which I guess is because the libraries are now out of sync:

"error while loading shared libraries: libmraa.so.1: cannot open shared object file: No such file or directory"

Any help is much appreciated, thanks.

0 Kudos
46 Replies
idata
Community Manager
124 Views

Hello jmontague001,

 

 

These are the steps I used to create an SPP connection between my Windows 7 PC and my Edison running the 159 image (because of the SPP issue mentioned in /thread/101689): https://communities.intel.com/thread/101689):

 

 

Edison:

 

 

vi /lib/systemd/system/bluetooth.service

 

# Edit line 8 and save

 

# before: ExecStart=/usr/lib/bluez5/bluetooth/bluetoothd

 

# after: ExecStart=/usr/lib/bluez5/bluetooth/bluetoothd -C

 

systemctl daemon-reload

 

systemctl restart bluetooth.service

 

rfkill unblock bluetooth

 

sdptool add --channel=22 SP

 

rfcomm watch /dev/rfcomm0 22 > /dev/null &

 

bluetoothctl

 

agent NoInputNoOutput

 

default-agent

 

discoverable on

 

 

Windows:

 

 

Open Bluetooth devices, find Edison and click on pair.

 

 

Edison:

 

 

An inquiry will pop-up, enter yes.

 

 

Windows:

 

 

Now, SPP COM port is recognized. If you open your PC's device manager you should be able to find under the COM ports something similar to:

 

 

Standard Serial over Bluetooth link (COMX)

 

 

If this does not happen, go to Show Bluetooth Devices and right click on your Edison, go to properties, select services and enable SPP. Now the COM port should show up on your PC and you will be able to connect to your board through SPP. Select the COM port number that appears on your device manager as Standard Serial over Bluetooth link and use a baud rate of 9600.

 

 

Let me know if this works for you.

 

-Peter.
JMont18
Novice
124 Views

Hi Peter,

Thank you for your message. I have followed through your instructions and can see the Standard Serial over Bluetooth Links on my PC, and on the edison the rfcomm says its connected to my PC device on channel 22. But when I open a putty connection on my PC I can type characters in but nothing appears on the Edison terminal. Then if I close the putty window which is connected to the SPP over Bluetooth ComPort I get the following message on the Edison terminal:

[ 2509.830245] BUG: unable to handle kernel paging request at ffffffe0

[ 2509.830341] IP: [] __kmalloc_track_caller+0x9c/0x200

[ 2509.830416] *pdpt = 0000000001d14001 *pde = 0000000001d18067 *pte = 0000000000000000

[ 2509.830497] Oops: 0000 [# 1] PREEMPT SMP

[ 2509.830550] Modules linked in: usb_f_acm u_serial g_multi libcomposite bcm_bt_lpm bcm4334x(O)

[ 2509.830666] CPU: 0 PID: 4 Comm: kworker/0:0 Tainted: G O 3.10.17-poky-edison+ # 1

[ 2509.830732] Hardware name: Intel Corporation Merrifield/BODEGA BAY, BIOS 542 2015.01.21:18.19.48

[ 2509.830806] Workqueue: events flush_to_ldisc

[ 2509.830852] task: f6c810b0 ti: f6c96000 task.ti: f6c96000

[ 2509.830902] EIP: 0060:[] EFLAGS: 00010282 CPU: 0

[ 2509.830953] EIP is at __kmalloc_track_caller+0x9c/0x200

[ 2509.831000] EAX: 00000000 EBX: f73f04e0 ECX: ffffffe0 EDX: 00004346

[ 2509.831052] ESI: c1d0c4e0 EDI: f6c01b00 EBP: f6c97e10 ESP: f6c97de4

[ 2509.831104] DS: 007b ES: 007b FS: 00d8 GS: 0000 SS: 0068

[ 2509.831152] CR0: 8005003b CR2: ffffffe0 CR3: 01d17000 CR4: 001007f0

[ 2509.831203] DR0: 00000000 DR1: 00000000 DR2: 00000000 DR3: 00000000

[ 2509.831253] DR6: ffff0ff0 DR7: 00000400

[ 2509.831287] Stack:

[ 2509.831311] 00000003 00000001 f73efc50 f6c96000 c1733437 00000200 00010220 ffffffe0

[ 2509.831421] f6c97e3f 00000020 00000200 f6c97e2c c1732bb2 00000020 f5f1f000 f5f1f000

[ 2509.831529] f6c01c00 00000020 f6c97e4c c1733437 00000000 0000010c 00000000 f51b5000

[ 2509.831636] Call Trace:

[ 2509.831683] [] ? __alloc_skb+0x67/0x1a0

[ 2509.831740] [] __kmalloc_reserve.isra.33+0x22/0x70

[ 2509.831799] [] __alloc_skb+0x67/0x1a0

[ 2509.831853] [] hci_reassembly+0x1a1/0x1f0

[ 2509.831908] [] hci_recv_stream_fragment+0x3a/0x70

[ 2509.831968] [] h4_recv+0x1f/0x50

[ 2509.832017] [] hci_uart_tty_receive+0x53/0x80

[ 2509.832073] [] flush_to_ldisc+0xe0/0x130

[ 2509.832131] [] process_one_work+0xfe/0x410

[ 2509.832188] [] ? get_parent_ip+0xb/0x40

[ 2509.832241] [] ? add_preempt_count+0x7d/0xf0

[ 2509.832295] [] ? sub_preempt_count+0x95/0xf0

[ 2509.832352] [] worker_thread+0xfc/0x360

[ 2509.832406] [] ? _raw_spin_unlock_irqrestore+0x55/0x60

[ 2509.832468] [] ? rescuer_thread+0x2d0/0x2d0

[ 2509.832522] [] kthread+0xa0/0xb0

[ 2509.832570] [] ? sub_preempt_count+0x95/0xf0

[ 2509.832630] [] ret_from_kernel_thread+0x1b/0x28

[ 2509.832687] [] ? kthread_create_on_node+0xc0/0xc0

[ 2509.832735] Code: e8 ca 07 5c 00 8b 45 e0 8b 55 f0 8b 40 08 a8 08 0f 85 32 01 00 00 8b 03 85 c0 89 45 f0 0f 84 32 01 00 00 8b 47 14 8b 4d f0 8b 37 <8b> 1c 01 8d 4a 02 8b 45 f0 64 0f c7 0e 0f 94 c0 84 c0 74 a3 03

[ 2509.833248] EIP: [] __kmalloc_track_caller+0x9c/0x200 SS:ESP 0068:f6c97de4

[ 2509.833327] CR2: 00000000ffffffe0

[ 2509.833375] ---[ end trace 192e50bea969c6e5 ]---

[ 2509.833426] BUG: sleeping function called from invalid context at /data/jenkins_worker/workspace/edison-weekly/linux-kernel/kernel/rwsem.c:20

[ 2509.833517] in_atomic(): 1, irqs_disabled(): 1, pid: 4, name: kworker/0:0

[ 2509.833578] CPU: 0 PID: 4 Comm: kworker/0:0 Tainted: G D O 3.10.17-poky-edison+ # 1

[ 2509.833641] Hardware name: Intel Corporation Merrifield/BODEGA BAY, BIOS 542 2015.01.21:18.19.48

[ 2509.833712] Workqueue: events flush_to_ldisc

[ 2509.833755] f6c810b0 00000004 f6c97bfc c18d9eea f6c97c20 c126d689 c1adaaf8 00000001

[ 2509.833865] 00000001 00000004 f6c813b0 f6c8caa8 f6c810b0 f6c97c2c c18dcd1c f6c810b0

[ 2509.833973] f6c97c40 c125573e 00000000 f6c97c40 00000009 f6c97c90 c12452fd 00000009

[ 2509.834081] Call Trace:

[ 2509.834126] [] dump_stack+0x16/0x18

[ 2509.834179] [] __might_sleep+0xe9/0x110

[ 2509.834234] [] down_read+0x1c/0x30

[ 2509.834288] [] exit_signals+0x1e/0x110

[ 2509.834341] [] do_exit+0x8d/0x9d0

[ 2509.834393] [] ? printk+0x1c/0x1e

[ 2509.834443] [] ? kmsg_dump+0xcb/0xe0

[ 2509.834497] [] oops_end+0x8b/0xd0

[ 2509.834548] [] no_context+0x104/0x1e0

[ 2509.834602] [] __bad_area_nosemaphore+0xb5/0x140

[ 2509.834662] [] ? enqueue_task_fair+0x146a/0x17d0

[ 2509.834720] [] ? sched_clock_cpu+0x125/0x180

[ 2509.834776] [] bad_area_nosemaphore+0x17/0x20

[ 2509.834834] [] __do_page_fault+0xa7/0x550

[ 2509.834890] [] ? default_send_IPI_mask_logical+0xa7/0xe0

[ 2509.834954] [] ? tracing_is_on+0x11/0x30

[ 2509.835011] [] ? probe_sched_wakeup+0x20/0xa0

[ 2509.835068] [] ? check_preempt_curr+0x4b/0x80

[ 2509.835125] [] ? tracing_sched_wakeup_trace+0xc0/0xc0

[ 2509.835187] [] ? ttwu_do_wakeup+0x10f/0x140

[ 2509.835246] [] ? __do_page_fault+0x550/0x550

[ 2509.835303] [] do_page_fault+0xd/0x10

[ 2509.835356] [] error_code+0x5f/0x64

[ 2509.835411] [] ? __do_page_fault+0x550/0x550

[ 2509.835467] [] ? __kmalloc_track_caller+0x9c/0x200

[ 2509.835527] [] ? __alloc_skb+0x67/0x1a0

[ 2509.835581] [] __kmalloc_reserve.isra.33+0x22/0x70

[ 2509.835641] [] __al...

idata
Community Manager
124 Views

Sorry, I forgot to mention, that you have to make the changes I explain in https://communities.intel.com/message/400538# 400538 https://communities.intel.com/message/400538 in order to fix that behavior. Please try that let us know how it goes.

 

 

-Peter.
JMont18
Novice
124 Views

Hi Peter,

I've had a look at making the changes you've described in the link, but the files and directories do not exist on my edison? Is there anything I need to install in order to be able to then modify the files?

idata
Community Manager
124 Views

Unfortunately the only way to make these changes are to build the image. In case you interested in doing so, you can find instructions on how to do it in http://www.intel.com/content/www/us/en/support/boards-and-kits/000005616.html.

 

 

-Peter.
JMont18
Novice
124 Views

I downloaded the source package "edison-src-ww25.5-15.tgz" but had the following problems when running trhough the guide.

2.1 In the guide "sudo apt-get: command not found", I tried using opkg command but says cannot install package.

2.3 Tried to run the setup script but come back with the following:

root@pearl-edison:/edison/edison-src# ./meta-intel-edison/setup.sh --dl_dir=/edison/bitbake_download_dir/ --sstate_dir=/edison/bitbake_sstate_dir/

We are building in external mode

./meta-intel-edison/setup.sh: line 159: git: command not found

3.1 If I try using make then i get the following error:

root@pearl-edison:/edison/edison-src# make setup

Setup buildenv for SDK host linux64

./meta-intel-edison/setup.sh --dl_dir=/edison/edison-src/bbcache/downloads --sstate_dir=/edison/edison-src/bbcache/sstate-cache --build_dir=/edison/edison-src/out/linux64 --build_name=custom_build_root@20160722132051 --sdk_host=linux64

We are building in external mode

./meta-intel-edison/setup.sh: line 159: git: command not found

Makefile:25: recipe for target 'setup' failed

make: *** [setup] Error 127

I am just trying to initally setup a basic serial communication via bluetooth to another device but this seems to be not possible using the edison board.

idata
Community Manager
124 Views

I'm sorry you have experienced so many issues.

 

 

Nevertheless, I'm afraid there might have been a misunderstanding about the guide. It is supposed to be followed on a full Linux PC (running, for example, Ubuntu 14). Could you please try again to build the image a make the modifications above from a Linux PC?

 

 

-Peter.
JMont18
Novice
124 Views

Sorry Peter I don't currently have a Linux PC thats why I was attempting to follow the guide on the Edison itself. I'll contact my IT department about getting me Linux PC but my contact is out on holiday this week.

Is there any other way of doing this? I did have the communication working from the PC to the Edison using the SPP-loopback.py file but couldnt send anything back from the Edison to the PC?

The other problem I have with using an older version of the image is that I can no longer program the Edison from the Eclispe IDE as I get the follwing message:

"error while loading shared libraries: libmraa.so.1: cannot open shared object file: No such file or directory"

Do you know a solution for this also?

idata
Community Manager
124 Views

Unfortunately no, the image can only be built on a Linux host machine. I'm afraid you will need a Linux PC in order to proceed.

 

 

In one of your earlier posts you mention that you can connect your Edison to your PC through PuTTY but you can't see any of the messages you send. That is because you have to be reading the port in order to check the messages. In you case it would be rfcomm0. In the same way if you would like to send messages from your Edison to your PC you'll have to send the message through that port. You can do that with the commands cat and echo. That way you will be able to see the messages on both sides.

 

 

Regarding the issue with mraa, have you tried updating the repos on your board and installing the latest version?

 

 

-Peter.
JMont18
Novice
124 Views

Thanks Peter! I've managed to send messages back and forth now using the cat and echo commands. I've also got Eclipse up and running again by updating the mraa repo to the latest version on the Edison. Thanks again.

I'll try to get hold of a Linux PC in order to build the image to fix the problem when closing the Com terminal. In order to do this I downloaded the "edison-src-ww25.5-15.tgz" file, is this the appropriate version to build from? Would the process be to build the image using the guide you provided, flash the image to edison and then update the three files "drivers/tty/tty_io.c", "include/linux/tty.h" & "net/bluetooth/rfcomm/tty.c" to the updated versions?

idata
Community Manager
124 Views

That great to hear! I'm glad you are now able to read and send messages from and to your Edison/PC. I'm really glad to hear that Eclipse is working again now that you've updated the repo.

 

 

Yes, you are right, that is the source you have to use. However, the process would be a little different, you have to set up the environment, make the modifications to the "drivers/tty/tty_io.c" files, build the image and flash the board.

 

 

Let me know how it goes.

 

-Peter.
JMont18
Novice
124 Views

Thanks for your help Peter! I'll let you know how it goes once I get hold of a Linux PC.

idata
Community Manager
124 Views

Please, do let us know, we'll be waiting for your update.

 

 

-Peter.
idata
Community Manager
124 Views

Hi jmontague001,

 

 

Just wondering if you have any updates. Please let us know if you still need help.

 

 

Regards,

 

-Diego
JMont18
Novice
124 Views

Hi Diego,

I wasnt able to get hold of a Linux PC so I've installed a virtual version of Ubuntu 14 using VirtualBox. But I'm not sure if I'm doing something wrong or just don't understand the process I need to follow.

On the Edison BSP guide I unpackaged the edison-src-ww25.5-15.tgz file and built the enviroment but I can't find the 3 files that need to be updated. When I build the Image using the make command after several hours I got the following:

jay@jay-VirtualBox:~/Desktop/Edison/edison-src$ make image

/bin/bash -c "source out/current/poky/oe-init-build-env /home/jay/Desktop/Edison/edison-src/out/current/build ; bitbake -c cleansstate edison-image ; bitbake edison-image"

# Shell environment set up for builds. #

You can now run 'bitbake '

Common targets are:

core-image-minimal

core-image-sato

meta-toolchain

adt-installer

meta-ide-support

You can also run generated qemu images with a command like 'runqemu qemux86'

Parsing recipes: 100% |# | Time: 00:02:21

Parsing of 959 .bb files complete (0 cached, 959 parsed). 1364 targets, 117 skipped, 0 masked, 0 errors.

NOTE: Resolving any missing task queue dependencies

Build Configuration:

BB_VERSION = "1.24.0"

BUILD_SYS = "x86_64-linux"

NATIVELSBSTRING = "Ubuntu-14.04"

TARGET_SYS = "i586-poky-linux"

MACHINE = "edison"

DISTRO = "poky-edison"

DISTRO_VERSION = "1.7.2"

TUNE_FEATURES = "m32 core2"

TARGET_FPU = ""

meta

meta-yocto

meta-yocto-bsp = "(detachedfromyocto-1.7.2):29812e61736a95f1de64b3e9ebbb9c646ebd28dd"

meta-intel-edison-bsp

meta-intel-edison-distro = ":"

meta-intel-iot-middleware = "(detachedfromc6d6814):c6d681475e76107e6c04c5f7a06034dc9e772d1e"

meta-intel-arduino = ":"

meta-arduino = "1.6.x:541b127163acb243109f07141bf249da2ecdcd9a"

NOTE: Preparing runqueue

NOTE: Executing RunQueue Tasks

NOTE: Tasks Summary: Attempted 2 tasks of which 0 didn't need to be rerun and all succeeded.

Loading cache: 100% |# | ETA: 00:00:00

Loaded 1365 entries from dependency cache.

NOTE: Resolving any missing task queue dependencies

Build Configuration:

BB_VERSION = "1.24.0"

BUILD_SYS = "x86_64-linux"

NATIVELSBSTRING = "Ubuntu-14.04"

TARGET_SYS = "i586-poky-linux"

MACHINE = "edison"

DISTRO = "poky-edison"

DISTRO_VERSION = "1.7.2"

TUNE_FEATURES = "m32 core2"

TARGET_FPU = ""

meta

meta-yocto

meta-yocto-bsp = "(detachedfromyocto-1.7.2):29812e61736a95f1de64b3e9ebbb9c646ebd28dd"

meta-intel-edison-bsp

meta-intel-edison-distro = ":"

meta-intel-iot-middleware = "(detachedfromc6d6814):c6d681475e76107e6c04c5f7a06034dc9e772d1e"

meta-intel-arduino = ":"

meta-arduino = "1.6.x:541b127163acb243109f07141bf249da2ecdcd9a"

NOTE: Preparing runqueue

NOTE: Executing SetScene Tasks

NOTE: Executing RunQueue Tasks

WARNING: Failed to fetch URL http://zlib.net/pigz/pigz-2.3.1.tar.gz, attempting MIRRORS if available

WARNING: Failed to fetch URL ftp://ftp.debian.org/debian/pool/main/b/base-passwd/base-passwd_3.5.29.tar.gz, attempting MIRRORS if available

WARNING: Failed to fetch URL http://downloads.sourceforge.net/project/libpng/libpng16/1.6.13/libpng-1.6.13.tar.xz, attempting MIRRORS if available

WARNING: Failed to fetch URL http://www.apache.org/dist/apr/apr-1.5.1.tar.bz2, attempting MIRRORS if available

WARNING: Failed to fetch URL http://www.apache.org/dist/apr/apr-util-1.5.3.tar.gz, attempting MIRRORS if available

WARNING: Failed to fetch URL http://code.entropywave.com/download/orc/orc-0.4.18.tar.gz;name=orc, attempting MIRRORS if available

NOTE: validating kernel config, see log.do_kernel_configcheck for details

WARNING: Failed to fetch URL http://serf.googlecode.com/svn/src_releases/serf-1.3.7.tar.bz2, attempting MIRRORS if available

WARNING: Failed to fetch URL http://www.apache.org/dist/subversion/subversion-1.8.9.tar.bz2, attempting MIRRORS if available

WARNING: QA Issue: bluez5: configure was passed unrecognised options: --with-systemdunitdir [unknown-configure-option]

WARNING: Failed to fetch URL git://git.eclipse.org/gitroot/paho/org.eclipse.paho.mqtt.c.git;protocol=http, attempting MIRRORS if available

ERROR: Fetcher failure: Fetch command failed with exit code 128, output:

Cloning into bare repository '/...

idata
Community Manager
124 Views

Hello thomatwn123,

 

 

The reason why this is happening is probably because you are on an image newer than 159.devkit. As you ca see in https://communities.intel.com/thread/101689 https://communities.intel.com/thread/101689, there's a known issue with newer versions of the image and SPP. So you should use an older version. This has already been reported and we are working on it. However, there's no ETA for a fix.

 

 

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

 

 

Hello jmontague001,

 

 

Let me try to build the image to see if I am able to replicate the issue. I'll try to get back to you as soon as I can.

 

 

-Peter.
idata
Community Manager
124 Views

I've just tested it. I can confirm that the issue is present. It looks like a repository URL has changed. Please let me see if I can find the file where this repo's URL is found in order to see if I can update it.

 

 

-Peter.
SShar24
Beginner
124 Views

Peter,

Thanks a lot. I have already solved the issue using an old image from this link

http://downloadmirror.intel.com/24909/eng/edison-image-ww05-15.zip http://downloadmirror.intel.com/24909/eng/edison-image-ww05-15.zip

and installed using the help of this link

https://www.youtube.com/watch?v=lDKM7UKUL5A Intel Edison Getting Started - A Step-By-Step Tutorial (windows) | Intel - YouTube

Maybe others, who are suffering from this issue they can follow this. I tested it and its works fine.

need to save the file SPP-loopback.py in /home/root/bluetooth location (user defined) using Putty and WinScp

commands are:

cd /home/root/bluetooth

ls

python SPP-loopback.py &

rfkill unblock bluetooth

hciconfig hci0

hciconfig hci0 up

hciconfig hci0 piscan

bluetoothctl

show

pair ....... (device id want to communicate)

trust ...... (device id want to communicate)

discoverable on

connect ...... (device id want to communicate)

JMont18
Novice
158 Views

Hi Peter,

Thanks for looking into this for me.

Something else I'm working on is writing some code in C using eclipse to automate the process of connecting to my PC via bluetooth and then store any commands received from my PC in a buffer or variable. I started this by trying to call the same commands to connect the blue tooth but using the system command in my code, but I've found that if I call the system("bluetoothctl") function then no following system commands work. It seems that once its in the bluetoothctl menu then none of the following system calls to set the agent etc work, if I then manually type exit in the console it exits the bluetoothctl menu and then the following system commands then run. I just wondered if you know why this is or if there is a better way that I should be doing this?

SShar24
Beginner
158 Views

Hi, Peter,

I have successfully connected my phone as BT device and did the SPP communication. But now the problem is, whenever I am trying to connect my another ECG BT sensor, I get something like this

[CHG] Device 00:0E:00:09:D8:F6 Paired: yes

Pairing successful

[CHG] Device 00:0E:00:09:D8:F6 Connected: no

[bluetooth]# connect 00:0E:00:09:D8:F6

Attempting to connect to 00:0E:00:09:D8:F6

[CHG] Device 00:0E:00:09:D8:F6 Connected: yes

Failed to connect: org.bluez.Error.NotAvailable

How can I solve this problem? Even I downgraded my Edison and even tried with Ubilinux still get same result "Failed to connect: org.bluez.Error.NotAvailable". Pleas help me out in this critical situation

Thanks and regards

Susanta Sharma

Reply