Cansend works only with the first message & Candump KO

CAN-Interface for PCI Express Mini
Post Reply
nhenry
Posts: 2
Joined: Tue 30. Jul 2019, 11:58

Cansend works only with the first message & Candump KO

Post by nhenry » Tue 30. Jul 2019, 14:00

Hello,

I've an issue with the PCAN-miniPCIe. Our board have 2 other integrated CAN and they are working perfectly
The PCAN-miniPCIe is plug on a iMX7 based board running on a yocto based Linux
I've ticked the option for this extension board in the menuconfig :
Networking support -> CAN bus subsystem support -> CAN Device Drivers -> Philips/NXP SJA1000 devices -> PEAK PCAN-PCI/PCIe/miniPCI Cards

At the startup of the board, Linux successfully recognized the 2 CAN interface of the PEAK board :

Code: Select all

[    1.684575] sja1000 CAN netdevice driver
[    1.697929] peak_pci 0000:01:00.0: can2 at reg_base=0xc0861000 cfg_base=0xc081d000 irq=330
[    1.705651] peak_pci 0000:01:00.0: can3 at reg_base=0xc0861400 cfg_base=0xc081d000 irq=330
[    2.250458] can: controller area network core (rev 20120528 abi 9)
[    2.258644] can: raw protocol (rev 20120528) 
So I've configured these interface using :

Code: Select all

ip link set can2 up type can bitrate 250000
ip link set can3 up type can bitrate 250000
These 2 interfaces are plug to a PCAN-USB X6 using PEAK Terminated 120ohms cables, itself connected to a Windows 7 computer.
I'm using the software PCAN-View

So when I send a message from the iMX7 board on the PEAK PCIe interface using

Code: Select all

cansend can2 001#1122334455667788
The message is successfully received on PCAN-View, but if i resend an other message, nothing shows up
After 10 cansend, I get this message on the iMx7 Board :

Code: Select all

write: No buffer space available
If i restart the can interface

Code: Select all

ip link set can2 down
ip link set can2 up type can bitrate 250000
The first message send after that is received on PCAN-view but not the following ones

So i tried in the other way, and launch candump on the PEAK CAN interface

Code: Select all

candump can2
and send a message using PCAN-view but no message were received
I tried to plug directly can2 on can3, launch candump on can3 and cansend on can2 , but again, nothing is received

I tried the loopback mode

Code: Select all

ip link set can2 down
ip link set can2 type can loopback on
ip link set can2 up type can bitrate 250000
candump can2 &
cansend can2 001#1122334455667788 
but again,it doesn't work

To summarize, using the PEAK PCIe, only the first message is really send, after the interface has been up, the buffer doesn't clear, and after 10 candsend it's full. Candump doesn't see any message
The 2 iMX7 integrated CAN works like a charm

Any help would be appreciate,

Thanks

User avatar
S.Grosjean
Software Development
Software Development
Posts: 357
Joined: Wed 4. Jul 2012, 17:02

Re: Cansend works only with the first message & Candump KO

Post by S.Grosjean » Tue 30. Jul 2019, 17:07

Hi,

Looks like a problem with interrupt management: the 1st frame is directly sent to the CAN controller but sending the other one needs that the driver be notified of the SJA1000 Tx buffer to be empty. Same explanation on Rx side: the driver is not notified that CAN frames are available in the SJA1000 Rx buffer...

The peak_pci driver works with legacy INTA interrupt system. Can you check if your mainboard interrupt controller is correctly configured to support this?

Regards,
— Stéphane

nhenry
Posts: 2
Joined: Tue 30. Jul 2019, 11:58

Re: Cansend works only with the first message & Candump KO

Post by nhenry » Thu 1. Aug 2019, 11:22

Hi,

Thanks for your reply S.Grosjean.

During the kernel startup this messages shows up :

Code: Select all

[    0.516497] pcieport 0000:00:00.0: Signaling PME through PCIe PME interrupt
[    0.516508] pci 0000:01:00.0: Signaling PME through PCIe PME interrupt
[    0.516520] pcie_pme 0000:00:00.0:pcie001: service driver pcie_pme loaded
After using ten times cansend command, here is the result in /proc/interrupts

Code: Select all

298:          0          0   PCI-MSI   0 Edge      PCIe PME, aerdrv
I tried to disable MSI interrupt in the kernel menuconfig, but when I do that the PEAK board is no longer detected.
I also tried to add pci=nomsi or pcie_pme=nomsi to mmcargs in u-boot but when i do that, at the end of the kernel boot, systemd does not start, so it's blocked.

Regards.

User avatar
S.Grosjean
Software Development
Software Development
Posts: 357
Joined: Wed 4. Jul 2012, 17:02

Re: Cansend works only with the first message & Candump KO

Post by S.Grosjean » Thu 1. Aug 2019, 12:43

Hi,

Are you able to rebuild your Kernel? If yes, please contact us to linux@peak-system.com with the version of your Kernel ($ uname -a). We will send you back a patch to apply to the mainline driver, to enable MSI mode in the mainline peak_pci driver.

Regards,
— Stéphane

Post Reply