# How to set communication between Raspberry Pi 4B and pixhawk 6c through CAN Bus

**URL:** <https://discuss.px4.io/t/how-to-set-communication-between-raspberry-pi-4b-and-pixhawk-6c-through-can-bus/42740>\
**Category:** PX4 Autopilot\
**Created:** [December 5, 2024, 7:53pm UTC](https://discuss.px4.io/t/how-to-set-communication-between-raspberry-pi-4b-and-pixhawk-6c-through-can-bus/42740 "2024-12-05T19:53:56Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Chi-En](https://discuss.px4.io/letter_avatar_proxy/v4/letter/c/7feea3/32.png) [@Chi-En](https://discuss.px4.io/u/Chi-En)\
**Post date:** [December 5, 2024, 7:53pm UTC](https://discuss.px4.io/t/how-to-set-communication-between-raspberry-pi-4b-and-pixhawk-6c-through-can-bus/42740/1 "2024-12-05T19:53:57Z")

</div>

Hello everyone, I have a question is that I try to build communication Raspberry Pi 4B(OS: Rasbian) and pixhawk 6c through CAN Bus. I already set the all setting included wire, bitrate=500k, etc. And I use the ccandump pn Raspberry to check is there any data, and result show attachment:  
the ID:1F04397B, 0100047B seems the data send from Pixhawk 6c, and ID:123 is I send from Raspberry, so the connection from Raspberry to CAN and from Pixhawk to CAN should be correct. And the problem is how can I to send the data from Raspberry to Pixhawk through CAN?

 ![截圖 2024-12-04 13.20.24](https://discuss.px4.io/uploads/default/original/3X/5/6/56a778906e8ee7bf4e9c85ee8854c4ba59a4ebc6.jpeg)

---

<div class="post-metadata">

**Author:** ![sibujacob](https://discuss.px4.io/user_avatar/discuss.px4.io/sibujacob/32/9673_2.png) [@sibujacob](https://discuss.px4.io/u/sibujacob)\
**Post date:** [December 6, 2024, 6:45am UTC](https://discuss.px4.io/t/how-to-set-communication-between-raspberry-pi-4b-and-pixhawk-6c-through-can-bus/42740/2 "2024-12-06T06:45:29Z")

</div>

Hi,  
What is the CAN controller chip that you are using with the Raspberry pi 4

---

<div class="post-metadata">

**Author:** ![Chi-En](https://discuss.px4.io/letter_avatar_proxy/v4/letter/c/7feea3/32.png) [@Chi-En](https://discuss.px4.io/u/Chi-En)\
**Post date:** [December 6, 2024, 9:48am UTC](https://discuss.px4.io/t/how-to-set-communication-between-raspberry-pi-4b-and-pixhawk-6c-through-can-bus/42740/3 "2024-12-06T09:48:41Z")

</div>

Hi,  
I use the MCP2515(with TJA1050), and connection with Raspberry as shown below, and for the CANL and CANH connect to the Pixhawk CANL and CANH respectively.

 ![截圖 2024-12-06 10.46.32](https://discuss.px4.io/uploads/default/original/3X/7/0/70f001cca4d23b57f73fefb35eb71be7c7847428.png)

---

<div class="post-metadata">

**Author:** ![sibujacob](https://discuss.px4.io/user_avatar/discuss.px4.io/sibujacob/32/9673_2.png) [@sibujacob](https://discuss.px4.io/u/sibujacob)\
**Post date:** [December 6, 2024, 11:20am UTC](https://discuss.px4.io/t/how-to-set-communication-between-raspberry-pi-4b-and-pixhawk-6c-through-can-bus/42740/4 "2024-12-06T11:20:56Z")

</div>

How are you checking if Raspberry pi is sending CAN messages at a specific baud rate to pixhawk.  
Also what is CAN baudrate for pixhawk

---

<div class="post-metadata">

**Author:** ![Chi-En](https://discuss.px4.io/letter_avatar_proxy/v4/letter/c/7feea3/32.png) [@Chi-En](https://discuss.px4.io/u/Chi-En)\
**Post date:** [December 6, 2024, 11:54am UTC](https://discuss.px4.io/t/how-to-set-communication-between-raspberry-pi-4b-and-pixhawk-6c-through-can-bus/42740/5 "2024-12-06T11:54:00Z")

</div>

I don’t really know how can I set the specific baud rate for Raspberry when I sending CAN messages, but when I use “cansend can0 123#DEADBE”, I can see the message on CAN bus using “candump can0”. Like first attachment above.

And the CAN baudrate for pixhawk is 500000.

---

<div class="post-metadata">

**Author:** ![sibujacob](https://discuss.px4.io/user_avatar/discuss.px4.io/sibujacob/32/9673_2.png) [@sibujacob](https://discuss.px4.io/u/sibujacob)\
**Post date:** [December 6, 2024, 12:15pm UTC](https://discuss.px4.io/t/how-to-set-communication-between-raspberry-pi-4b-and-pixhawk-6c-through-can-bus/42740/6 "2024-12-06T12:15:56Z")

</div>

Well i suggest to ensure that Raspberry is sending 500 k baudrate.  
What is the os loaded on Raspberry

---

<div class="post-metadata">

**Author:** ![Chi-En](https://discuss.px4.io/letter_avatar_proxy/v4/letter/c/7feea3/32.png) [@Chi-En](https://discuss.px4.io/u/Chi-En)\
**Post date:** [December 6, 2024, 1:05pm UTC](https://discuss.px4.io/t/how-to-set-communication-between-raspberry-pi-4b-and-pixhawk-6c-through-can-bus/42740/7 "2024-12-06T13:05:47Z")

</div>

I check the baudrate for Raspberry when sending CAN message is 500k like picture shows below

 ![截圖 2024-12-06 14.09.45](https://discuss.px4.io/uploads/default/original/3X/4/5/45a72e35bba76cab22da681960fcaa8e06751f15.png)

OS:  
NAME=“Debian GNU/Linux”  
VERSION\_ID=“12”  
VERSION=“12 (bookworm)”

---

<div class="post-metadata">

**Author:** ![sibujacob](https://discuss.px4.io/user_avatar/discuss.px4.io/sibujacob/32/9673_2.png) [@sibujacob](https://discuss.px4.io/u/sibujacob)\
**Post date:** [December 6, 2024, 2:04pm UTC](https://discuss.px4.io/t/how-to-set-communication-between-raspberry-pi-4b-and-pixhawk-6c-through-can-bus/42740/8 "2024-12-06T14:04:54Z")

</div>

What is the voltage for canH and CanL.  
Also have you grounded the can controller with raspberry pi and pixhawk

---

<div class="post-metadata">

**Author:** ![Chi-En](https://discuss.px4.io/letter_avatar_proxy/v4/letter/c/7feea3/32.png) [@Chi-En](https://discuss.px4.io/u/Chi-En)\
**Post date:** [December 6, 2024, 2:26pm UTC](https://discuss.px4.io/t/how-to-set-communication-between-raspberry-pi-4b-and-pixhawk-6c-through-can-bus/42740/9 "2024-12-06T14:26:08Z")

</div>

Both are 2.5V.  
Yes, the ground of CAN controller connect to Raspberry pi, and the ground of pixhawk also connect to Raspberry pi.

---

<div class="post-metadata">

**Author:** ![sibujacob](https://discuss.px4.io/user_avatar/discuss.px4.io/sibujacob/32/9673_2.png) [@sibujacob](https://discuss.px4.io/u/sibujacob)\
**Post date:** [December 6, 2024, 2:50pm UTC](https://discuss.px4.io/t/how-to-set-communication-between-raspberry-pi-4b-and-pixhawk-6c-through-can-bus/42740/10 "2024-12-06T14:50:02Z")

</div>

I think CANH has to be near to 5v and CANL has to be near to 3v . The difference between them must be at least 2v .
