-
Notifications
You must be signed in to change notification settings - Fork 154
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MPSoC CAN QEMU acceptance filter register layout not compatible with hardware #74
Comments
Hi, Why order of can_id will not matter: can_id is sent as uint32_t on emulated bus and received as same, so with right AFMR and TX_FIFO_ID, it should pass through filter. QEMU CAN just reads the appropriate data from TX_FIFO_ID and copies whole TX_FIFO_ID to can_id without manipulating the bits. So, even the bits are different, it shouldn't cause failures. Regards, |
Hi @gvikram31 ,
We are simply sending Standard ID messages, no RTR bit, no extended Frame.
As I wrote in the original post, the problem occurs when the code we wrote for the MPSoC Hardware (XCZU7EV) is run in the QEMU. Upon CAN Reception in the hardware, a message with ID 0x001 (as in the above trace) has a received ID as The Acceptance filter API expects the ID filter and mask to have the same bit layout, therefore for the hardware, we also have to shift the ID bits to the left 21 times so
And now the problem: Since QEMU has a different bit order in the ID message, the Acceptance filter code breaks above. Since in QEMU, the same CAN message sent over SocketCAN shows up as My expectation is that the Xilinx QEMU implementation of the CanPs code would keep the bit order the same as the hardware implementation. |
We have CAN running on both the ZCU104 development board on the R5 cores and also on QEMU as delivered in Vitis/2022.1 (Xilinx_Unified_2022.1_0420_0327.tar.gz)
When we introduced the CAN Acceptance filter API to the hardware code, it worked fine on the hardware, but the same code on QEMU stopped working.
Digging deeper, I believe I found this root cause:
From the definition here:
qemu/include/net/can_emu.h
Line 44 in 74d70f8
The CAN_ID has a different bit layout than the MPSoC hardware.
From: https://www.xilinx.com/htmldocs/registers/ug1087/can___afir1.html
Here is the hardware Layout if the Filter ID (same for mask)
So when we use the settings for the hardware on QEMU, this line will always fail:
qemu/hw/net/can/xlnx-zynqmp-can.c
Line 641 in 74d70f8
And no message will land in the QEMU receive FIFO.
The text was updated successfully, but these errors were encountered: