Problem connecting phone to carplay

Hello,

I would like to ask about the white screen saying “connect iphone to begin carplay” with settings button underneath (this settings button does absolutely nothing when clicked).
I’m getting this screen in about 1 out of 4 starts of my RPI setup and it just won’t show the carplay screen until I reboot the RPI, even though my phone always says it’s connected.
Other 3 out of 4 times it connects and works flawlessly.

I have the “Carlinkit Model:CPC200-AutoKit” dongle.
Am I doing something wrong?
Is there any other fix than rebooting the RPI?

Thanks for the reply.

The settings button is currently only listening to ontouch not onclick, next build will fix this.

For the odd one not launching, can you send an output of the terminal logs when this happens? If you launch it from the command line, or double click and choose launch in terminal.

of course, here is the log dump:

pi@raspberrypi:~/Desktop $ carplay
/home/pi/.config/ReactCarplay
spawning carplay {
dpi: 240,
nightMode: 0,
hand: 0,
boxName: ‘nodePlay’,
width: 1024,
height: 600,
fps: 30
}
directory found
sending dpi
device connected and ready
starting projection
MESA-LOADER: failed to retrieve device information
MESA-LOADER: failed to retrieve device information
MESA-LOADER: failed to retrieve device information
parsing type: 8 for length: 4 <Buffer aa 55 aa 55 04 00 00 00 08 00 00 00 f7 ff ff ff>
parsing 8 <Buffer e8 03 00 00>
Carplay message: Support Wifi
MESA-LOADER: failed to open kms_swrast: /usr/lib/dri/kms_swrast_dri.so: cannot open shared object file: Permission denied (search paths /usr/lib/aarch64-linux-gnu/dri:$${ORIGIN}/dri:/usr/lib/dri)
failed to load driver: kms_swrast
MESA-LOADER: failed to open swrast: /usr/lib/dri/swrast_dri.so: cannot open shared object file: Permission denied (search paths /usr/lib/aarch64-linux-gnu/dri:$${ORIGIN}/dri:/usr/lib/dri)
failed to load swrast driver
carplay connection
carplay connection
unkown type: 13 with data:: <Buffer aa 55 aa 55 0d 00 00 00 0d 00 00 00 f2 ff ff ff>
unkown type: 14 with data:: <Buffer aa 55 aa 55 0d 00 00 00 0e 00 00 00 f1 ff ff ff>
unkown type: 18 with data:: <Buffer aa 55 aa 55 18 00 00 00 12 00 00 00 ed ff ff ff>
parsing type: 8 for length: 4 <Buffer aa 55 aa 55 04 00 00 00 08 00 00 00 f7 ff ff ff>
parsing 8 <Buffer e9 03 00 00>
Carplay message: undefined
test message i
parsing type: 8 for length: 4 <Buffer aa 55 aa 55 04 00 00 00 08 00 00 00 f7 ff ff ff>
parsing 8 <Buffer 07 00 00 00>
Carplay message: undefined
test message
parsing type: 204 for length: 32 <Buffer aa 55 aa 55 20 00 00 00 cc 00 00 00 33 ff ff ff>
parsing 204 <Buffer 32 30 32 32 2e 31 32 2e 30 38 2e 31 36 33 36 43 4d 59 00 00 00 00 00 00 00 00 00 00 00 00 00 00>
version number: 2022.12.08.1636CMY
unkown type: 25 with data:: <Buffer aa 55 aa 55 b9 00 00 00 19 00 00 00 e6 ff ff ff>
unkown type: 1 with data:: <Buffer aa 55 aa 55 1c 00 00 00 01 00 00 00 fe ff ff ff>
sending unplugged event
parsing type: 4 for length: 0 <Buffer aa 55 aa 55 00 00 00 00 04 00 00 00 fb ff ff ff>
parsing type: 8 for length: 4 <Buffer aa 55 aa 55 04 00 00 00 08 00 00 00 f7 ff ff ff>
parsing 8 <Buffer f2 03 00 00>
Carplay message: undefined
test message r
parsing type: 8 for length: 4 <Buffer aa 55 aa 55 04 00 00 00 08 00 00 00 f7 ff ff ff>
parsing 8 <Buffer f1 03 00 00>
Carplay message: undefined
test message q
enabling wifi
auto connecting
parsing type: 8 for length: 4 <Buffer aa 55 aa 55 04 00 00 00 08 00 00 00 f7 ff ff ff>
parsing 8 <Buffer eb 03 00 00>
Carplay message: undefined
test message k
unkown type: 35 with data:: <Buffer aa 55 aa 55 11 00 00 00 23 00 00 00 dc ff ff ff>
unkown type: 36 with data:: <Buffer aa 55 aa 55 11 00 00 00 24 00 00 00 db ff ff ff>
unkown type: 18 with data:: <Buffer aa 55 aa 55 18 00 00 00 12 00 00 00 ed ff ff ff>
parsing type: 8 for length: 4 <Buffer aa 55 aa 55 04 00 00 00 08 00 00 00 f7 ff ff ff>
parsing 8 <Buffer e9 03 00 00>
Carplay message: undefined
test message i
parsing type: 8 for length: 4 <Buffer aa 55 aa 55 04 00 00 00 08 00 00 00 f7 ff ff ff>
parsing 8 <Buffer ef 03 00 00>
Carplay message: undefined
test message o
parsing type: 8 for length: 4 <Buffer aa 55 aa 55 04 00 00 00 08 00 00 00 f7 ff ff ff>
parsing 8 <Buffer ec 03 00 00>
Carplay message: undefined
test message l
parsing type: 2 for length: 8 <Buffer aa 55 aa 55 08 00 00 00 02 00 00 00 fd ff ff ff>
parsing 2 <Buffer 03 00 00 00 01 00 00 00>
wifi avail, phone type: 3 wifi: 1
sending unplugged event
parsing type: 4 for length: 0 <Buffer aa 55 aa 55 00 00 00 00 04 00 00 00 fb ff ff ff>
parsing type: 8 for length: 4 <Buffer aa 55 aa 55 04 00 00 00 08 00 00 00 f7 ff ff ff>
parsing 8 <Buffer f2 03 00 00>
Carplay message: undefined
test message r
unkown type: 37 with data:: <Buffer aa 55 aa 55 00 00 00 00 25 00 00 00 da ff ff ff>
parsing type: 8 for length: 4 <Buffer aa 55 aa 55 04 00 00 00 08 00 00 00 f7 ff ff ff>
parsing 8 <Buffer f0 03 00 00>
Carplay message: undefined
test message p
parsing type: 8 for length: 4 <Buffer aa 55 aa 55 04 00 00 00 08 00 00 00 f7 ff ff ff>
parsing 8 <Buffer f1 03 00 00>
Carplay message: undefined
test message q
^Ccarplay: …/libusb/libusb/os/threads_posix.h:46: usbi_mutex_lock: Assertion `pthread_mutex_lock(mutex) == 0’ failed.
Aborted

I have aborted the program with Ctrl+C when the mentioned white screen with text came in.

To let you know what exactly is happening:

  1. the mentioned white screen with text comes in (same as when it works normally)
  2. screen turns blank white (I assume it is connecting to phone, normally next step after this blank screen would show the carplay screen)
  3. again the mentioned white screen with text to connect phone

For the difference and if you need this, here is my log when it connects and works good:

pi@raspberrypi:~/Desktop $ carplay
/home/pi/.config/ReactCarplay
spawning carplay {
dpi: 240,
nightMode: 0,
hand: 0,
boxName: ‘nodePlay’,
width: 1024,
height: 600,
fps: 30
}
directory found
sending dpi
device connected and ready
unkown type: 38 with data:: <Buffer aa 55 aa 55 00 00 00 00 26 00 00 00 d9 ff ff ff>
unkown type: 1 with data:: <Buffer aa 55 aa 55 00 00 00 00 01 00 00 00 fe ff ff ff>
parsing type: 8 for length: 4 <Buffer aa 55 aa 55 04 00 00 00 08 00 00 00 f7 ff ff ff>
parsing 8 <Buffer f1 03 00 00>
Carplay message: undefined
test message q
starting projection
MESA-LOADER: failed to retrieve device information
MESA-LOADER: failed to retrieve device information
MESA-LOADER: failed to retrieve device information
parsing type: 8 for length: 4 <Buffer aa 55 aa 55 04 00 00 00 08 00 00 00 f7 ff ff ff>
parsing 8 <Buffer e8 03 00 00>
Carplay message: Support Wifi
unkown type: 13 with data:: <Buffer aa 55 aa 55 0d 00 00 00 0d 00 00 00 f2 ff ff ff>
unkown type: 14 with data:: <Buffer aa 55 aa 55 0d 00 00 00 0e 00 00 00 f1 ff ff ff>
unkown type: 18 with data:: <Buffer aa 55 aa 55 18 00 00 00 12 00 00 00 ed ff ff ff>
parsing type: 8 for length: 4 <Buffer aa 55 aa 55 04 00 00 00 08 00 00 00 f7 ff ff ff>
parsing 8 <Buffer e9 03 00 00>
Carplay message: undefined
test message i
parsing type: 8 for length: 4 <Buffer aa 55 aa 55 04 00 00 00 08 00 00 00 f7 ff ff ff>
parsing 8 <Buffer 07 00 00 00>
Carplay message: undefined
test message
parsing type: 204 for length: 32 <Buffer aa 55 aa 55 20 00 00 00 cc 00 00 00 33 ff ff ff>
parsing 204 <Buffer 32 30 32 32 2e 31 32 2e 30 38 2e 31 36 33 36 43 4d 59 00 00 00 00 00 00 00 00 00 00 00 00 00 00>
version number: 2022.12.08.1636CMY
unkown type: 25 with data:: <Buffer aa 55 aa 55 b9 00 00 00 19 00 00 00 e6 ff ff ff>
unkown type: 1 with data:: <Buffer aa 55 aa 55 1c 00 00 00 01 00 00 00 fe ff ff ff>
MESA-LOADER: failed to open kms_swrast: /usr/lib/dri/kms_swrast_dri.so: cannot open shared object file: Permission denied (search paths /usr/lib/aarch64-linux-gnu/dri:$${ORIGIN}/dri:/usr/lib/dri)
failed to load driver: kms_swrast
MESA-LOADER: failed to open swrast: /usr/lib/dri/swrast_dri.so: cannot open shared object file: Permission denied (search paths /usr/lib/aarch64-linux-gnu/dri:$${ORIGIN}/dri:/usr/lib/dri)
failed to load swrast driver
carplay connection
carplay connection
enabling wifi
auto connecting
parsing type: 8 for length: 4 <Buffer aa 55 aa 55 04 00 00 00 08 00 00 00 f7 ff ff ff>
parsing 8 <Buffer eb 03 00 00>
Carplay message: undefined
test message k
unkown type: 35 with data:: <Buffer aa 55 aa 55 11 00 00 00 23 00 00 00 dc ff ff ff>
unkown type: 36 with data:: <Buffer aa 55 aa 55 11 00 00 00 24 00 00 00 db ff ff ff>
unkown type: 18 with data:: <Buffer aa 55 aa 55 18 00 00 00 12 00 00 00 ed ff ff ff>
parsing type: 8 for length: 4 <Buffer aa 55 aa 55 04 00 00 00 08 00 00 00 f7 ff ff ff>
parsing 8 <Buffer e9 03 00 00>
Carplay message: undefined
test message i
parsing type: 8 for length: 4 <Buffer aa 55 aa 55 04 00 00 00 08 00 00 00 f7 ff ff ff>
parsing 8 <Buffer ef 03 00 00>
Carplay message: undefined
test message o
parsing type: 8 for length: 4 <Buffer aa 55 aa 55 04 00 00 00 08 00 00 00 f7 ff ff ff>
parsing 8 <Buffer ec 03 00 00>
Carplay message: undefined
test message l
parsing type: 2 for length: 8 <Buffer aa 55 aa 55 08 00 00 00 02 00 00 00 fd ff ff ff>
parsing 2 <Buffer 03 00 00 00 01 00 00 00>
wifi avail, phone type: 3 wifi: 1
parsing type: 8 for length: 24 <Buffer aa 55 aa 55 18 00 00 00 08 00 00 00 f7 ff ff ff>
parsing 8 <Buffer 04 00 00 00 46 34 3a 42 45 3a 45 43 3a 45 30 3a 34 35 3a 46 45 ea 7f 75>
Carplay message: undefined
test message F4:BE:EC:E0:45:FEju
unkown type: 3 with data:: <Buffer aa 55 aa 55 04 00 00 00 03 00 00 00 fc ff ff ff>
unkown type: 25 with data:: <Buffer aa 55 aa 55 6c 00 00 00 19 00 00 00 e6 ff ff ff>
[2800:0802/195753.552124:ERROR:gl_utils.cc(315)] [.RenderCompositor-0x40010b4000] GL_INVALID_FRAMEBUFFER_OPERATION: Framebuffer is incomplete: Attachment is not renderable.
[2800:0802/195753.563818:ERROR:gl_utils.cc(315)] [.RenderCompositor-0x40010b4000] GL_INVALID_FRAMEBUFFER_OPERATION: Framebuffer is incomplete: Attachment is not renderable.
[2800:0802/195753.565108:ERROR:gl_utils.cc(315)] [.RenderCompositor-0x40010b4000] GL_INVALID_FRAMEBUFFER_OPERATION: Framebuffer is incomplete: Attachment is not renderable.
[2800:0802/195753.619267:ERROR:gl_utils.cc(315)] [.RenderCompositor-0x40010b4000] GL_INVALID_FRAMEBUFFER_OPERATION: Framebuffer is incomplete: Attachment is not renderable.
[2800:0802/195753.624658:ERROR:gl_utils.cc(315)] [.RenderCompositor-0x40010b4000] GL_INVALID_FRAMEBUFFER_OPERATION: Framebuffer is incomplete: Attachment is not renderable.
[2800:0802/195753.626679:ERROR:gl_utils.cc(315)] [.RenderCompositor-0x40010b4000] GL_INVALID_FRAMEBUFFER_OPERATION: Framebuffer is incomplete: Attachment is not renderable.
unkown type: 37 with data:: <Buffer aa 55 aa 55 00 00 00 00 25 00 00 00 da ff ff ff>
parsing type: 8 for length: 4 <Buffer aa 55 aa 55 04 00 00 00 08 00 00 00 f7 ff ff ff>
parsing 8 <Buffer f0 03 00 00>
Carplay message: undefined
test message p
non-audio found
unknown audio type: 11 false false
non-audio found
unknown audio type: 11 false false
non-audio found
unknown audio type: 11 false false
non-audio found
unknown audio type: 11 false false
^Ccarplay: …/libusb/libusb/os/threads_posix.h:46: usbi_mutex_lock: Assertion `pthread_mutex_lock(mutex) == 0’ failed.
Aborted

Hmm main bit that stands out is the lack of MAC address being reported, however I believe this is just to do with wireless carplay. I will have to dig out some old notes on some of the message types.

As a test, can you disable bluetooth on your phone and see if you can still replicate? I suspect the first one is seeing that wireless is disabled, so cancels the USB connection, but then is not successful in enabling wireless.

Tried it 10 times with bluetooth completely turned off, it did not connect, not even once.
Here is the log dump with bluetooth turned off:

pi@raspberrypi:~ $ carplay
/home/pi/.config/ReactCarplay
spawning carplay {
dpi: 240,
nightMode: 0,
hand: 0,
boxName: ‘nodePlay’,
width: 1024,
height: 600,
fps: 30
}
directory found
sending dpi
device connected and ready
MESA-LOADER: failed to retrieve device information
MESA-LOADER: failed to retrieve device information
MESA-LOADER: failed to retrieve device information
unkown type: 18 with data:: <Buffer aa 55 aa 55 18 00 00 00 12 00 00 00 ed ff ff ff>
parsing type: 8 for length: 4 <Buffer aa 55 aa 55 04 00 00 00 08 00 00 00 f7 ff ff ff>
parsing 8 <Buffer e9 03 00 00>
Carplay message: undefined
test message i
unkown type: 38 with data:: <Buffer aa 55 aa 55 00 00 00 00 26 00 00 00 d9 ff ff ff>
MESA-LOADER: failed to open kms_swrast: /usr/lib/dri/kms_swrast_dri.so: cannot open shared object file: Permission denied (search paths /usr/lib/aarch64-linux-gnu/dri:$${ORIGIN}/dri:/usr/lib/dri)
failed to load driver: kms_swrast
MESA-LOADER: failed to open swrast: /usr/lib/dri/swrast_dri.so: cannot open shared object file: Permission denied (search paths /usr/lib/aarch64-linux-gnu/dri:$${ORIGIN}/dri:/usr/lib/dri)
failed to load swrast driver
starting projection
parsing type: 8 for length: 4 <Buffer aa 55 aa 55 04 00 00 00 08 00 00 00 f7 ff ff ff>
parsing 8 <Buffer e8 03 00 00>
Carplay message: Support Wifi
unkown type: 13 with data:: <Buffer aa 55 aa 55 0d 00 00 00 0d 00 00 00 f2 ff ff ff>
unkown type: 14 with data:: <Buffer aa 55 aa 55 0d 00 00 00 0e 00 00 00 f1 ff ff ff>
unkown type: 18 with data:: <Buffer aa 55 aa 55 18 00 00 00 12 00 00 00 ed ff ff ff>
parsing type: 8 for length: 4 <Buffer aa 55 aa 55 04 00 00 00 08 00 00 00 f7 ff ff ff>
parsing 8 <Buffer e9 03 00 00>
Carplay message: undefined
test message i
parsing type: 8 for length: 4 <Buffer aa 55 aa 55 04 00 00 00 08 00 00 00 f7 ff ff ff>
parsing 8 <Buffer 07 00 00 00>
Carplay message: undefined
test message
parsing type: 204 for length: 32 <Buffer aa 55 aa 55 20 00 00 00 cc 00 00 00 33 ff ff ff>
parsing 204 <Buffer 32 30 32 32 2e 31 32 2e 30 38 2e 31 36 33 36 43 4d 59 00 00 00 00 00 00 00 00 00 00 00 00 00 00>
version number: 2022.12.08.1636CMY
unkown type: 25 with data:: <Buffer aa 55 aa 55 b9 00 00 00 19 00 00 00 e6 ff ff ff>
unkown type: 1 with data:: <Buffer aa 55 aa 55 1c 00 00 00 01 00 00 00 fe ff ff ff>
carplay connection
carplay connection
parsing type: 8 for length: 4 <Buffer aa 55 aa 55 04 00 00 00 08 00 00 00 f7 ff ff ff>
parsing 8 <Buffer f1 03 00 00>
Carplay message: undefined
test message q
enabling wifi
auto connecting
parsing type: 8 for length: 4 <Buffer aa 55 aa 55 04 00 00 00 08 00 00 00 f7 ff ff ff>
parsing 8 <Buffer eb 03 00 00>
Carplay message: undefined
test message k
unkown type: 35 with data:: <Buffer aa 55 aa 55 11 00 00 00 23 00 00 00 dc ff ff ff>
unkown type: 37 with data:: <Buffer aa 55 aa 55 00 00 00 00 25 00 00 00 da ff ff ff>
parsing type: 8 for length: 4 <Buffer aa 55 aa 55 04 00 00 00 08 00 00 00 f7 ff ff ff>
parsing 8 <Buffer f0 03 00 00>
Carplay message: undefined
test message p
parsing type: 8 for length: 4 <Buffer aa 55 aa 55 04 00 00 00 08 00 00 00 f7 ff ff ff>
parsing 8 <Buffer ed 03 00 00>
Carplay message: undefined
test message m
no device, sending pair
^Ccarplay: …/libusb/libusb/os/threads_posix.h:46: usbi_mutex_lock: Assertion `pthread_mutex_lock(mutex) == 0’ failed.
Aborted

Again it stopped responding so I had to kill it.

OK, were the first attempts trying to do it wireless? If so I would recommend two things, restarting your phone as that’s nice and easy, and has caused bugs for me before. After that if its still no good I would say try and update the firmware on the Carlinkit (usual bricking warning applies) it’s quite easy to do it through the android app if you have access to an android device and USB OTG adapter.

This is used daily in two of mine, and this issue doesn’t show, so can only assume its something along the lines of the above

Yes, I have never connected phone to the adapter via cable, so it was always wireless, and it works almost every time. It would just be annoying having to restart the RPI in car every once a while when it fails to connect.

I have my phone restarted several times, since I am working with your program for like six months (building my own car display and reverse camera and so on…), and the restart did not solve anything. I have tried to “forget this car” in carplay settings on my phone and set it up again, which did not help eighter.
It was doing the same thing on the 32bit version, and it did not change with 64bit version, which I thought it could.

I can try to update the adapter firmware, it will just take a time since I have to get the USB OTG adapter. I will update you if it solved my problem.

Thanks for your help.

I’d love to see the project!

OK I am suprised that you didn’t need to connect it via USB cable for the initial connection, as I thought that was a requirement, could be worth a go?

I will sure show you the project when it will be done but I am waiting for the RPI zero 2, which is not available due to processor shortage. It feels like an overkill to put my 4GB RPI4 to car, if it uses like 15% of resources.

Looks like it doesn’t need to be connected via cable for the initial connection, but I will try it after the firmware update. Hope it solves my problem.

I have updated the firmware on carlinkit adapter via browser from my phone (How to get CarlinKit firmware for upgrade/downgrade?-Carlinkit Official Website | Smart Driving Safe Traveling), update was successful and the website GUI has changed after the restart.
But now the application just crashes with this log:

pi@raspberrypi:~ $ carplay
/home/pi/.config/ReactCarplay
spawning carplay {
dpi: 240,
nightMode: 0,
hand: 0,
boxName: ‘nodePlay’,
width: 1024,
height: 600,
fps: 30
}
directory found
sending dpi
device connected and ready
FATAL ERROR: LIBUSB_TRANSFER_ERROR
Aborted

Luckily there was an option to revert update back and now it works again.
Can you see any fix with the USB transfer error?

I will have to have a look, that USB transfer error could be a plethora of causes. I wonder whether they have changed the protocol on the newer firmware

Ah I see, I have tried putting the adapter to USB 2.0 from 3.0 to see if it helps, but it didn’t.

Raspberry OS can see this device, there is nice output from lsusb command with device ID same as set in udev rules in your setup script (1314:1520), so this did not change with firmware upgrade.

The latest firmware version is 2023.06.02.1720, hope it helps with debugging.

Hmm I did have someone once who wasn’t able to run it in high power charge mode, I wonder if he was also on the newer firmware. Maybe there’s an increased current requirement. When I can I’ll update my dongle. Was rolling back east? Thanks for check the usb IDs, would have been my next question :joy:

Yes, there is a rollback button next to the update button and it works the same, it will ask if you are sure to rollback and then proceed with installation.

You don’t even need the android device to update or rollback firmware, just connect to adapter hotspot and go to 192.168.50.2 via browser.

1 Like

I May have found the cause for the occasional not starting up. I’ll get a build together tomorrow for it!

That’s perfect, I rolled back the firmware so I can test it without the USB transfer error.

Give this one a try, I still want to add one more thing (it’s 64bit version) but let me know if that’s any improvement

First thing that I noticed with this version is the white border around carplay with these ugly scrollbars:

I am running it in kiosk mode so resolution settings won’t help.

I have tried it with both, old and new firmware:
With the old firmware, there is still problem with occasional not connecting.
The new firmware shows the same LIBUSB_TRANSFER_ERROR message.

Interesting behavior that I found (and may help):
If I touch the display when it is trying to connect to the phone (blank white screen), It always fails to connect.