Page 1 of 1

Enabling PCAN write mode

Posted: Mon 2. Dec 2024, 08:48
by fenasikerim
Hello, I am new to PCAN stuff and try to run all CAN related works with C++ code.

I would like to enable PCAN cards write mode. Here it shows (I guess) it is closed because the value is 0. I am currently using jetson tx2.

I checked the usermanuel for the parameters and added options pcan txqsize=64
$uname -a
Linux fenasikerim 4.9.140-tegra #1 SMP PREEMPT Tue Jan 19 12:44:36 EST 2021 aarch64 aarch64 aarch64 GNU/Linux

$ cat /proc/pcan
*------------- PEAK-System CAN interfaces (www.peak-system.com) -------------
*------------- Release_20200701_n (8.10.2) Jul 9 2021 02:30:17 --------------
*------------- [mod] [isa] [pci] [pec] [dng] [usb] --------------
*--------------------- 4 interfaces @ major 505 found -----------------------
*n -type- -ndev- --base-- irq --btr- --read-- --write- --irqs-- -errors- status
0 pcifd -NA- aa51000 380 0x001c 00000001 00000000 00000001 00000000 0x0000
1 pcifd -NA- aa52000 380 0x001c 00000001 00000000 00000001 00000000 0x0000
2 pcifd -NA- aa53000 380 0x001c 00000001 00000000 00000001 00000000 0x0000
3 pcifd -NA- aa54000 380 0x001c 00000001 00000000 00000001 00000000 0x0000
I tried some other parameters on the manual fdusemsi which I found then it's not related. txqprealloc and other txq related things but couldn't make this write section other than value 0.

I tried updating my driver too but that didn't solve the problem too.

Sorry for my basic level question but I am really new to CANBus and trying to understand how it works.

Re: Enabling PCAN write mode

Posted: Mon 2. Dec 2024, 09:31
by M.Heidemann
Hello,

Have you tried any application that actually tries to write onto the bus or are you just guessing here?

There is no "Write"-mode, the card writes if there is something to write in the queue, for that an application has to push a frame into said queue.

If that doesn't work we need a clear info on what you were doing before, step by step.

please elaborate a bit on your issue.

BR

Marv

Re: Enabling PCAN write mode

Posted: Mon 2. Dec 2024, 09:55
by fenasikerim
I found out how to do it. As you said, it was already open, but I disabled it with C++ code as follows.

DWORD listenOnlyState = PCAN_PARAMETER_ON;
if (CAN_SetValue(channelUsed, PCAN_LISTEN_ONLY, &listenOnlyState, sizeof(listenOnlyState)) ==
PCAN_ERROR_OK)

When I turn the listen_only mode here to OFF, it sends a "I'm here" signal like a heartbeat (I guess), which causes the other devices to disrupt the signal on the CAN line. Can you help me with solving this heartbeat issue?

Re: Enabling PCAN write mode

Posted: Mon 2. Dec 2024, 10:07
by M.Heidemann
Hello,

We are not the "How to CAN 101"-forum.

What you are talking about is a frame acknowledgement, which is not a heartbeat signal. If you get issues on your bus it's either:

A) Wrong bitrate

B) Improper Termination

Please check both

BR

Marvin

Re: Enabling PCAN write mode

Posted: Mon 2. Dec 2024, 11:41
by fenasikerim
Can you tell me what kind of questions are answered in this forum?

From now on, I can report my problems accordingly.

sorry for the inconvenience

Re: Enabling PCAN write mode

Posted: Mon 2. Dec 2024, 12:41
by M.Heidemann
Hello,

This forum is for supporting PCAN-Hard- and Software.

There is an extensive documentation available for the driver and the API:

https://www.peak-system.com/fileadmin/m ... an_eng.pdf

Your request touches on several different topics which are unrelated to one another,
there is no reason to use parameters at all, if you don't know what they do.

It seem's like you are new to both PCAN AND CAN, you will have the very basics of CAN down,
to follow our suggestions...

A good introduction can be found here:

https://en.wikipedia.org/wiki/CAN_bus

So, in short:

If you want thelp, it would be easier to tell us what you are trying to do.
I can then point you in the right direction...


BR

Marvin