Problem with myBlueUSB and Ticker using Bluetooth Dongle

29 Jul 2011

I am trying to communicate via bluetooth between two mbeds(LPC1768).
I am using the myBlueUSB by Ad van der Weiden (http://mbed.org/users/networker/programs/myBlueUSB/ltn52x).
The first problem is that I can not figure out why it is very slow..
The 2nd problem after certain time it is disconnected by showing message on terminal

HCICallback: 6: 05 04 00 01 00 08
HCI_EV_DISCONN_COMPLETE 6: 05 04 00 01 00 08

The other thing is that when i try to use ticker to follow even the same program by Rob Toulsan (http://mbed.org/forum/mbed/post/11562/).. the whole programs hangs.. stops running after transmitting the first packet...

these things are knocking me out
so your help will be highly appreciated

ATif

29 Jul 2011

Hi,

I have not noticed speed problems and the library itself has almost no waiting loops (afaik it only waits when it runs out of buffers). There were reports about crashes after longer periods of use (this could be due to memory fragmentation). When an application like this is slow it is usually due to the main loop. This loop should never wait and call the polling routine on every iteration. The 'state' of the program must be kept in an explicit variable and not implicitely in the program counter with nested loops or wait statements. The 'disconnect' can have many causes including errors in the library. It can also depend on the device you are connecting. I, for example, had a case where all devices caused a disconnect except devices of a particular brand. It turned out that the device checked the MAC of my dongle and if it was wrong it just disconnected. This kind of errors can only be found by comparing the behaviour in a working system with the behaviour in your application. I use USBSnoop or a logic analyser to observe the desired behaviour and I printf to the console the library behaviour. This usually puts me on the the track towards the problem. The next few weeks I will be busy and not be able to answer your questions but please post them I will answer later.

30 Jul 2011

Hello,

Well I have removed the wait in main loops but still it can not transmit the data....on the console both are transmitting packets contonously but the data packets are not transmitted only the other packets like credits....
but the one problem is dat wen i try to use the ticker and timeout functions the transmitter kinda hangs.. it does not return from putc function.... but the first packet is transmitted ....but after transmitting i can not detect until now where is it hanging....
may be it can be problem for the timer functions...

16 Aug 2011

Hi Muhammad - I'm afraid the program I developed was made from trial and error from code I found online. I've also tried to modify it further and also found issues with hangs and latency. I've found that different USB dongles (however similar they may look) operate very differently with this code. Some work, some start running then hang, some don't even connect at all. I'm still investigating, but as its all very trial and error its really hard to help. But If I have a breakthrough I'll post the results. Good luck and keep us updated on your progress!

17 Aug 2011

The library could use a total rewrite. Clear choices should be made to work C-style with fixed memory allocations or c++ style where memory is allocated when needed (potentially efficient but with leaks and fragmentation). I would also like to know where the original code came from (or was it developed from scratch by PB?). In any case for me it works reasonably with dongles with CSR chips. I'm on a different project now but if you send me complete log files and your application I may find time to take a look.

17 Aug 2011

I will post back the updates when I am back on work
As now I am on holidays but this task I will do when I start again at the end of September
The task is synchronization of a robot in Master Slave configuration by using Bluetooth. So I need to transmit one-way data from master to slave but at high speed so to achieve smoothness at real time.
I was trying to know the flow of the code so that i can configure/edit it to my needs i.e. simple data transfer using Bluetooth dongle.
The other thing is that when I check the mac address of my Bluetooth dongle in windows using the ipconfig -all command the address for both devices is shown 11-11-11-11-11-11 i.e. all 1s.
Is it the correct way to check the mac address?
Do update regarding this if you have any breakthrough.