Hello,
I'm using PCANBASIC v5, same for the device drivers, with PCAN-USB (Classic and FD) dongles.
I'm building a C# application, everything is working as it should.
BUT:
I would like to replicate the PCAN-view behavior, i.e. if the channel is already initialized by my C# application, PCAN-view will just leave the channel initialized as it is, and will be able to interract with the bus (read and write CAN messages).
To make this work, I usually execute first my application, then PCAN-view. If I start PCAN-view first (and connect to the PCAN-USB), my application will complain that the channel is already being used (with the very specific channel condition ChannelPCanView), can't initialize the channel (which is expected), but can't send or receive any CAN messages. The features of PCAN-Basic states here (https://www.peak-system.com/products/so ... can-basic/) that : "Multiple PEAK-System applications and your own can be operated on a physical channel at the same time".
How can I achieve that ?
PCAN-Basic multiple client
Re: PCAN-Basic multiple client
Hello,
note that the bit rate used by PCAN-View must passt exactly with those used by PCAN-Basic. PCAN-View may show you for example 500 kBits, but they are a lot of combination for that. Now, at the time PCAN-Basic was designed, there were only hardware using bit rate based on the SJA1000 CAN controller. This accepted bit rates for 8MHz in a BTR0-BTR1 format. You need to use the same way, for PCAN-basic to recognize those bit rates as compatible. In the picture you can see the bit rate registers (BTR0-BTR1) for 500 kBit, which would be understood by PCAN-Basic. So if you first conenct PCAN-View with this bit rate, and then you say PCAN-Basic to connect the same channel with bit rate PCAN_BAUD_500K, then it will work.
Other way is to set the parameter PCAN_BITRATE_ADAPTING, to just take that being used. Check the docuemntation for that.
note that the bit rate used by PCAN-View must passt exactly with those used by PCAN-Basic. PCAN-View may show you for example 500 kBits, but they are a lot of combination for that. Now, at the time PCAN-Basic was designed, there were only hardware using bit rate based on the SJA1000 CAN controller. This accepted bit rates for 8MHz in a BTR0-BTR1 format. You need to use the same way, for PCAN-basic to recognize those bit rates as compatible. In the picture you can see the bit rate registers (BTR0-BTR1) for 500 kBit, which would be understood by PCAN-Basic. So if you first conenct PCAN-View with this bit rate, and then you say PCAN-Basic to connect the same channel with bit rate PCAN_BAUD_500K, then it will work.
Other way is to set the parameter PCAN_BITRATE_ADAPTING, to just take that being used. Check the docuemntation for that.
Best regards,
Keneth
Keneth
Re: PCAN-Basic multiple client
Thank you very much for your help.
Both methods work as expected, and I'm using PCAN_BITRATE_ADAPTING to have a more resilient application.
Have a nice day,
Kraal
