esp32 Bluetooth Classic Buffer Overflow Issue

Thread Starter

nipuntanna

Joined Dec 21, 2020
4
hello
i am devloping bluetooth thermal printer based on esp32

the android app sends data very fast i have set rx_queue_size = 15000 in bluetooth serial library but still this getting full in one second

other chinese made thermal printers uses stm32 and external serial bluetooth chip with very low sram and flash memory still they handles data without loss

esp32 handles data but when buffer 15000 gets full it looses some data and my print goes garbage data

if someone help me to slow down esp32 bluetooth classic reciving speed


i tried to store data in spiff but somewhere i read that spiff have fixed write cycles and tear down the eps32 shortly

any help or any other approch to do this
 

Ya’akov

Joined Jan 27, 2019
9,276
Welcome to AAC.

You need to implement handshaking so the printer can tell the application to stop sending data until the buffer has space to handle it.
 

Thread Starter

nipuntanna

Joined Dec 21, 2020
4
Welcome to AAC.

You need to implement handshaking so the printer can tell the application to stop sending data until the buffer has space to handle it.

thank hou for your kind reply
actually there are already so many apps in market that been printing for thermal printer

so basically i can not implement anything from app side

one of the solution i fount that make a chunk of 1024 bytes and store it to spiff very fast so it can clear bluetooth buffer very fast

i can read data from spiff slowly as pringer process
 

Ya’akov

Joined Jan 27, 2019
9,276
bluetooth serial library dosnt have any support for glow contorl so i am wondering how to achive that in code
I am guessing it just needs to be turned on and it is handled at a lower level. But I haven‘t actually used RFCOMM so I haven’t needed to figure it out. The BT standards docs definitely refers to flow control, warning that if you using an older version of BT you may have to adjust the packet size for RFCOMM to get flow control to work.

You can probably get better general help on AAC that most anywhere else but I think this is so domain-specific a BT developers forum would be more helpful.

That’s to say someone might not show up suddenly with the answer, that happens.
 

BobTPH

Joined Jun 5, 2013
9,335
thank hou for your kind reply
actually there are already so many apps in market that been printing for thermal printer
If the apps can work with other printers but not yours, the problem is on your side.

Can you write an app to log data from a working printer to find out what it is sending to slow down the app?
 

Thread Starter

nipuntanna

Joined Dec 21, 2020
4
thats a pretty better idea i will try that and upload th results what actually bluetooth chip sends data to microcontroller and at what speed
 
Top