I am currently sending CAN Messages from my RaspberryPi to my Android Smartphone per Bluetooth. I should get between 200-1300 messages per second. Unfortunately I only average around 80 messages per second. I hope you can help me to achieve a greater number.
The steps I took on the Raspberry to achieve the connection are:
sudo hciconfig hci0 piscan
sudo sdptool add sp
sudo ./rfcomm listen hci0
This establishes the Bluetooth connection between the smartphone and the Raspberry. I write all CAN messages I receive on can0 to rfcomm0.
sudo candump -c can0 > /dev/rfcomm0 &
Now i am uncertain how I can make this process more efficient. I am not sure where I am losing my messages.
I know that all messages arrive on the Raspberry. I checked that with candump -n.
The messages I receive on the Smartphone are ASCII coded. Every second message I receive on the Android Smartphone is ASCII CR and LF. I imagine if I could get rid of that, than I would get double the messages to the Smartphone. Each Can Message contains 35 HEX chars it would be most efficient to send them as 2 Bytes per Char via Bluetooth to the Smartphone. How can I achieve this?
Thank you for your help.
Edit:
Corrected Question
Edit2:
On the Raspberry I receive through candump messages like this (40 Characters):
can0 10C [8] F4 4D B0 94 A7 08 EA 00
the 290 is the ID, the 8 are the Bytes of the content. The ID and the content are in Hex.
If write the Data to rfcomm0 like mentioned above than I receive on my Android Smartphone this Message:
[1m[34mcan0[0m 10C [8] F4 4D B0 94 A7 08 EA 00
the 53 Bytes I receive are:
32 32 27 91 49 109 27 91 51 52 109 99 97 110 48 27 91 48 109 32 32 49 48 67 32 32 91 56 93 32 70 52 32 52 68 32 66 48 32 57 52 32 65 55 32 48 56 32 69 65 32 48 48
Why do I receive additional informations on the Smartphone? If I modify the message so that I only have the context and the ID, than I would theoretically only need 10 Bytes to store the information. Is this correct?