Cortex-M3 and Bluetooth client

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Cortex-M3 and Bluetooth client

1,121 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by bonystedt on Thu Mar 18 05:37:49 MST 2010
Hi,
is there any chance to use ARM Cortex-M3 as only microcontroller in a Bluetooth client application? If so how?
Would uClinux be possible as operation system in a ARM7TDMI in a Bluetooth client app?
Bo
0 Kudos
Reply
8 Replies

758 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by bonystedt on Sun Mar 21 07:51:57 MST 2010

Quote: bonystedt
Here I found something interesting. This guy Tadashi G. Takaoka presents a possibility to create a small tinyos-cortex source tree. Solutions for M0 andM3. Not much support though. But together we can perhaps find out? It is for Linux (I use Debian). You have to install git, hg,bison flex autoconf gettext patch texinfo,libncurses-dev zlib1g-dev liblzo2-dev first[B].[/B].


Sorry, forgot this: http://code.google.com/p/tinyos-cortex/wikiu/PathStructure
0 Kudos
Reply

758 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by bonystedt on Sun Mar 21 07:49:54 MST 2010
Here I found something interesting. This guy Tadashi G. Takaoka presents a possibility to create a small tinyos-cortex source tree. Solutions for M0 andM3. Not much support though. But together we can perhaps find out? It is for Linux (I use Debian). You have to install git, hg,bison flex autoconf gettext patch texinfo,libncurses-dev zlib1g-dev liblzo2-dev first[B].[/B].
0 Kudos
Reply

758 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by bonystedt on Fri Mar 19 15:03:23 MST 2010

Quote: xpresso
Is your concern sending/receiving data via RFCOMM over bluetooth, or the choice of operating system?


My product is battery driven. That's the reason why I want to avoid 2 microcontrollers. The choice CM3 depends on its relative low energy requirements.


Quote: xpresso
The Connect Blue device I pointed out has an on board micro that takes care of all the real time tasks of the RFCOMM protocol. You should be able to connect it to the LPCXpresso and send/receive data with aother RFCOMM enabled device.?


I try to avoid 2 micros, so Connect Blue is no candidate. Sorry. My hope is now directed to ChibiOS. Will report what comes out of it.
0 Kudos
Reply

758 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by xpresso on Fri Mar 19 14:06:14 MST 2010
Is your concern sending/receiving data via RFCOMM over bluetooth, or the choice of operating system?

Maybe a small diagram of the system and the goal you are trying to achieve would help.

The Connect Blue device I pointed out has an on board micro that takes care of all the real time tasks of the RFCOMM protocol.  You should be able to connect it to the LPCXpresso and send/receive data with aother RFCOMM enabled device.

The expresso board may be able to get by with a simple interrupt and main loop for an operating system.
0 Kudos
Reply

758 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by bonystedt on Fri Mar 19 13:45:45 MST 2010
This is the answer I got from Giovanni, father of the ChibiOS, when I mailed him the questions below:

Hello Bo,

I know that the Cortex-M3 is supported by uClinux but I don't have direct experience about it, I read something about it on the STM32 forum here (sorry for the long URLs...):

https://my.st.com/public/STe2ecommunities/mcu/Lists/ARM%20CortexM3%20STM32/Flat.aspx?RootFolder=%2fp...

And also here:

https://my.st.com/public/STe2ecommunities/mcu/Lists/ARM%20CortexM3%20STM32/Flat.aspx?RootFolder=%2fp...

So it looks it is supported by the STM32 and ST has a version running on its evaluation board, if you search that forum you will find many more references and topics about it. I read somewhere that the Cortex-M3/STM32 is very slow (something like 10 times slower than running from internal memory) when run from external memory, you should evaluate this factor before committing to uClinux.

ChibiOS/RT could support bluetooth of course but it does not have a native stack right now, the current support is limited to the BT UART level through the included serial driver. An existing stack could be ported with some effort or a new one should be created.

Anyway uClinux and ChibiOS/RT cover very different application ranges, the required amount of RAM and storage is very different, few KBs for ChibiOS/RT, several hundreds for uClinux.

About the Cortex-M0, I think that none of the existing implementation supports an EBI so uClinux is not possible, the M3 is the very minimum IMHO.

best regards,
Giovanni
0 Kudos
Reply

758 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by xpresso on Fri Mar 19 12:32:11 MST 2010
One of the simplest blue tooth RFCOMM applications I have found is:

http://www.connectblue.com/products/bluetooth/oem-serial-port-adapter-modules/oemspa310/

Part number cB−OEMSPA310i−04, they are about $31 from DigiKey.

This works like an AT command based modem from the micro side.  Just hook it to the UART pins.

I used it to communicate with my Nokia 810 from an Atmel micro.
0 Kudos
Reply

758 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by bonystedt on Fri Mar 19 02:29:03 MST 2010
This is my mail to ARM Technical Support. Answers will be presented in this forum as soon as they arrive.

"Hi
For my battery driven products I want to choose Cortex-M3/M0 to
work together with a sensor, and a short distance ( 1 meter)
simple SPP RFCOMM only Bluetooth radio.  I want the stack protocol
and profile running on the sole microcontroller Cortex-M3 (or if
possible Cortex-M0). How do I achieve that if possible. Have had
ideas in the CMSIS BlueZ direction. Thank you!"
0 Kudos
Reply

758 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by bonystedt on Thu Mar 18 08:30:49 MST 2010
I mean, wouldn't it be possible - for use in Cortex-M3 - in a new thread, influenced by Miro Sameks
10 article long series "Building a Bare-Metal ARM with GNU" and
downloads from Bluez, be possible to build together a simple program
that detects nearby Bluetooth devices?
//simplescan.c
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/socket.h>
#include <bluetooth/bluetooth.h>
#include <bluetooth/hci.h>
#include <bluetooth/hci_lib.h>
int main(int argc, char **argv)
{
    inquiry_info *devices = NULL;
    int max_rsp, num_rsp;
    int adapter_id, sock, len, flags;
    int i;
    char addr[19] = { 0 };
    char name[248] = { 0 };
    adapter_id = hci_get_route(NULL);
    sock = hci_open_dev( adapter_id );
    if (adapter_id < 0 || sock < 0) {
        perror("opening socket");
        exit(1);
    }
    len  = 8;
    max_rsp = 255;
    flags = IREQ_CACHE_FLUSH;
    devices = (inquiry_info*)malloc(max_rsp * sizeof(inquiry_info));
   
    num_rsp = hci_inquiry(adapter_id, len, max_rsp, NULL, &devices,
            flags);
    if( num_rsp < 0 ) perror("hci_inquiry");
    for (i = 0; i < num_rsp; i++) {
        ba2str(&(devices+i)->bdaddr, addr);
        memset(name, 0, sizeof(name));
        if (0 != hci_read_remote_name(sock, &(devices+i)->bdaddr,
                    sizeof(name), name, 0)) {
            strcpy(name, "[unknown]");
        }
        printf("%s  %s\n", addr, name);
    }
    free( devices );
    close( sock );
    return 0;
}
0 Kudos
Reply