SerialBT freezes while writing

azathoth
Posts: 2
Joined: Tue Jun 04, 2019 4:57 pm

SerialBT freezes while writing

Postby azathoth » Tue Jun 04, 2019 5:12 pm

I have one codec that produces 16bit at 8kHz samples that I send trough BT (SPP profile).

In between I receive AT commands from Serial2 and from BT. AT commands received from BT are routed to Serial2 whose response is sent through BT.

Everything is managed via two task, one per core. Task0 manages writes to BT (and the codec), Task1 manages the readings from BT and Serial2.

At startup Task0 begins to read audio from the codec and send it via BT. Continuosly.

Then I start to send AT commands (via BT).
After a while it happens that BT stops sending data; and after about 20 cycles Task0 freezes on btSerial.write(buffer,size);
Task1 continues to run normally.

I tryed to add a semaphore to ensure that the issue could'nt be related to concurrent read/write BT access, but is seams BTSerial is thread-safe.

I suppose Task0 freezes because of a buffer-overflow and it is a symptom, not the cause.

Why BT stops sending data? Anyone had a similar issue?

Who is online

Users browsing this forum: No registered users and 102 guests