Home/Support/Support Forum/Kernel crash when using Bluetooth UART module with Digi Connect ME 9210
Welcome to Digi Forum, where you can ask questions and receive answers from other members of the community.

Kernel crash when using Bluetooth UART module with Digi Connect ME 9210

0 votes
Hi there,
We have a serious trouble when using Bluetooth module with Digi Connect ME. We have try serveral of weeks but not successful. And as application programmers, We don't know how to solve it. We really need the support.

We will try to describe the problem in details, step by step as We have done.

1. We know that Digi Connect ME 9210 support Linux, has UART interface. So We think it will be easy if We use a UART bluetooth module, We can have a full functional system with Ethernet and Bluetooth support which run on Linux OS.


2. Choosing and testing bluetooth module with PC
We have try this step with many type of bluetooth modules. The first we have try is Parani ESD 200 with Debian 5.0 and bluez-libs-3.36, but we were not successful.
because Parani ESD 200 does not support HCI.
So we change the bluetooth module to BTM330, which support UART and HCI. That is wonderful, the module work fine with Debian 5.0 and bluez-libs-3.36.
With hardware, we use Digi Connect ME 9210 development board as a power supply and voltage converter (from 3.3V TTL to RS232). I connect the bluetooth module with the power, ground and TX, RX pin (which is located in P3 Signal rail). Next, connect serial P1 to PC COM port. And unplug Digi Connect Me ofcouse!
Attach the bluetooth module
#hciattach ttyS0 bcsp 38400
See it attached
#hciconfig
Bring it up
#hciconfig hci0 up
Doing some test
#hcitool hci0 scan
and it work.

3. Test the BTM330 with DigiConnectME


3.1 Change the serial console to P2 on the development board, and boot from NFS, TFTP
We create a new Uboot-Kernel project in DigiEL dev environment. With the Uboot, we modify line #50 in file /build/U-Boot/include/configs/cme9210.h
from
#define CONFIG_CONS_INDEX 0 /* = Port A */
to
#define CONFIG_CONS_INDEX 2 /* = Port C */
then in we configure the kernel to have a serial port C in the kernel.
In the configure window, open this section kernel/System Type/NS9xxx Implementations/Digi Connect ME 9210 on Devboard/ and make check on Serial port C (only modules with JTAG-header) CME9210JS_SERIAL_PORTC

Next, we build and update Uboot, kernel firmware.
To get the kernel work with serial port 2, an additional step must be done:
In Uboot console, execute these command
setenv console console=ttyNS2,38400
saveenv
reboot
we are in development phase so boot the Linux kernel, rootfs with NFS is required. We have done it. It is a basic work and well documented so I do not write here.
That's all for getting a serial console for P2, so we can free working with bluetooth module BTM330 on P1.


3.2 Get the kernel suppport bluetooth:
To get the kernel working with bluetooth, we must configure the kernel again. All the bluetooth subsystem in the kernel is set to Yes. It's very easy to done, just select project, click Configure button, choose Expand, then type "Blue", section "Bluetooth subsystem support BT" must selected on the screen, then say "Yes" to all.
Next, compile the kernel reinstall, when bootting there must be some Notice that inform bluetooth drivers is loaded.

3.3 Crosscompile BlueZ
In the begining, we choose bluez version 3.36. It has 2 parts: library bluez-libs-3.36, ultilities bluez-utils-3-36.
With bluez-libs-3.36, it very easy to compile. But with bluez-utils-3-36 it is impossible to crosscompile, because it depends on D-Bus.

So we search on the Internet for solution. BlueZ version 2.25 is the solution, bluez-utils-2.25 doesn't depend on D-Bus.

every thing goes well. Here is the instruction:

bluez libs 2.25
wget http://bluez.sf.net/download/bluez-libs-2.25.tar.gz
tar xzf bluez-libs-2-25.tar.gz
cd bluez-libs-2-25/
./configure --host=arm-linux
make CC=arm-linux-gcc
mkdir _installdir
make install DESTDIR=/usr/local/DigiEL-5.0/mylibs/bluez-libs-2.25/_installdir
bluez utils 2.25
wget http://bluez.sf.net/download/bluez-utils-2.25.tar.gz
tar xzf bluez-utils-2-25.tar.gz
cd bluez-utils-2-25/
./configure --host=arm-linux --with-bluez=/usr/local/DigiEL-5.0/mylibs/bluez-libs-2.25/_installdir/usr/local/
make CC=arm-linux-gcc
mkdir _installdir
make install DESTDIR=/usr/local/DigiEL-5.0/myapps/bluez-utils-2.25/_installdir

Next step is building a rootfs that have these files for getting the bluetooth module working. by adding following contents into /configs/add_files.sh (this is attached)

Then Build the rootfs and install.

4. Testing:
Replug Digi Connect ME, swap TX and RX signal, use P2 as a console.

Boot up the system, then start up bluetooth deamon hcid
#hcid
after that the same as with PC, we use hciattach to attach the bluetooth module
#hciattach ttyS0 bcsp 38400
then the problem happen: all the kernel crash, we cannot access it any more, the serial console is hang up, cannot use telnet and ssh too.

So we decided to find out what happen.

5. Debug
First we discover that if in config file "/etc/bluetooh/hcid.conf"
line #7-8
from
# Automatically initialize new devices
autoinit yes;
to
# Automatically initialize new devices
autoinit no;
then retry again
#hcid
#hciattach ttyS0 bcsp 38400
the kernel still run like normal, but when we execute this command, it crash again
#hciconfig hci0 up
that explain the reason of system crash.

We doing something to debug the kernel
the first thing we do is using printk() in bluetooth driver to print on the serial console what happen inside the driver when it run.
We also monitor the communication between Bluetooth module and DigiConnectME by using Docklight.

The next we discover the ttyS0 is change the line discipline mode to HCI during hciattach. And is after hicattach, if there is any data send to the serial Port /dev/ttyS0 the system crash.

We also testing the transmission of data:
run
#hcid
#hciattach ttyS0 bcsp 38400
then unplug the bluetooth module, and run
#hciconfig hci0 up
the system still alive, there is many BSCP packet is sent from the serial port 0, so we sure that transmiting is not the problem but the receiving is.

If you are interested in solving this problem, you can contact me via skype at tt.electronic_nguyen.tien

Thanks for reading this entire article.
asked Aug 7, 2009 in Linux by nguyentien New to the Community (0 points)
recategorized Dec 18, 2013 by tuxembb

Please log in or register to answer this question.

...