Sorry in advance if the explanation is too general, I can attach code if needed...
I'm working on a project where a python program is running in a device, and a Bluetooth socket is opened and listening to incoming connections and data which come from those connections. On the other side I have a mobile application that pairs with the device and sends data. The device can receive commands like recording video or doing some image processing using the camera it's attached to with OpenCV library. I tried to run this in different boards, and now I run it on Raspberry Pi 3.
Everything works ok, Bluetooth-wise, when the system is not "busy" (e.g. no recording or image processing is done), but once I activate one of those, and then exits the mobile application and re-run it, the app is unable to connect via Bluetooth to my raspberry again...in the raspberry's syslog I get a lot of error message as I mentioned in the title, and eventually the connection fails. The connection is able to be made only when I manually shut down the busy processes (image processing or recording)...
What can I do to make it more robust? What am I missing? I tried to update the Bluetooth and bluez, uninstall and reinstall, nothing helps...
EDIT 1: I realized that it has something to do with the camera driver! I shut down my program running on the RPi, leaving only the bluetooth socket open and a shell command of "avconv" (RPi equivalent of ffmpeg) that takes frames from the camera into a file. Once I ran that, I kept getting those error messages. When I stopped the command, I could pair back again...
EDIT 2: With the raspi camera module it works ok, but with USB camera, as I desire, it doesn't...
Why is this happening?