Page 1 of 1

Connection Bitrate and logging

Posted: Mon 7. Sep 2020, 15:12
by mdanski
Hello,
I am currently developing application using PCAN-Developer 4 C# library.

Moving from PCAN Basic I found that I need to set manually clock, prescaler etc. when passing bitrate to new Net. I have a couple of question:
1. how can I know which clock frequencies I can set on device? (we are using PCAN USB, PCAN USB Pro, some are FD also)
2. how can I compute nominal bitrates (and in the future data bitrate) settings for specific clock and speed ? (like in your Bitrate Calculator)

and also:
3. in documentation I haven't found nothing about TRC logging, is it possible to keep this feature when using PCAN Developer 4?

Re: Connection Bitrate and logging

Posted: Tue 8. Sep 2020, 15:19
by K.Wolf
Hi,

setting the individual bit rate parameters is only required for CAN FD Nets, which is the same as in PCAN-Basic when calling the InitializeFD function.
If you define a Net e.g. for a standard PCAN-USB (NXP SJA1000 CAN controller) you can use the RegisterNet overload that accepts an UInt32 bitrate parameter where you can specifiy a BTR0/BTR1 baud rate code exactly in the same way as in the PCAN-Basic Initialize function (see chapter 2.1. for a list of predefined values).

If you know your individual bit rate parameters you could also use the RegisterNet overload that accepts a BitrateNominal parameter to define a bit rate for an SJA1000-based hardware. In this case, the clock frequency must be specified as 8,000,000 (8 MHz). FD-compatible hardware like PCAN-USB FD, PCAN-USB Pro FD, PCAN-PCI Express FD accept the clock frequencies 20, 24, 30, 40, 60, and 80 MHz. You can also connect an 8 MHz-based Net to an FD-compatible hardware. In this case the device driver internally adjusts the clock frequency to 80 MHz and the prescaler is multiplied by 10.

We'll add the missing information to the PCAN-Developer documentation. In the meantime, if you would like to register a CAN-FD Net, the PCAN-Basic documentation also contains the neccessary information in the topic "FD Bit rate Parameter Definitions". The names of the fields in the BitrateFD struct mostly correspond to the parameter names that can be used in PCAN-Basic's InitializeFD function.

For details about how bit rates are composed, for SJA1000 bit rates refer to the NXP Application Note AN97046. I did not find a good link to it, but the following website also gives some useful information: http://www.bittiming.can-wiki.info
For CAN FD you can have a look in the document "Bit time requirements for CAN FD", which you can download on this page: https://www.bosch-semiconductors.com/ip ... es/can-fd/

A feature to create TRC files is currently not included in the PCAN-API.