Find CAN Baudrate.

CAN Development Packages for Windows®
Post Reply
jbonninFH
Posts: 3
Joined: Tue 30. Jul 2013, 11:43

Find CAN Baudrate.

Post by jbonninFH » Tue 30. Jul 2013, 11:49

Hello,
I have a project in C# which use CANApi2 with two PCAN module.
I want to know if it's possible to get the baudrate of the CAN bus which is connect to the PCAN.
I mean that I configure the Can connection (ID, net , ...) and open it. And on this connection, I want to get with a function all baudrate of the current CAN connected.
Is it possible?
Have you an idea for do that?
Thank.

User avatar
PEAK-Support
Sales & Support
Sales & Support
Posts: 1646
Joined: Fri 10. Sep 2010, 19:34

Re: Find CAN Baudrate.

Post by PEAK-Support » Wed 31. Jul 2013, 08:06

Yes, that is possible. In the CANAPI2 you use Client & Net Handles. The Baudrate is a Property of the Net Handle.
Simply use the GetParam(...) function with the PARAM_BAUDRATE parameter, and you get back the Baudrate as BTR0BTR1-Code (which is simply to compare with the defined Baudrates)
--------------------------------
PEAK-System Technik
Technical Support Team
support[at]peak-system.com
-------------------------------

jbonninFH
Posts: 3
Joined: Tue 30. Jul 2013, 11:43

Re: Find CAN Baudrate.

Post by jbonninFH » Thu 1. Aug 2013, 13:13

Hello,
Thanks for your reply but it's not exactly what I want.
I want to detect the baudrate of the CAN bus on which I'm connected.
I don't want to get the baudrate of the with GetParam() function because it's the baudrate that I set it.
Do you understand what I want?

User avatar
PEAK-Support
Sales & Support
Sales & Support
Posts: 1646
Joined: Fri 10. Sep 2010, 19:34

Re: Find CAN Baudrate.

Post by PEAK-Support » Thu 1. Aug 2013, 14:03

HowTo find the BUS Baudrate without influence the CAN Bus:
  • Be sure that minimum 2 other CAN nodes are communicate on the CAN Network (they must be "active")
  • Set you CAN Interface from PEAK-System to listen only mode
  • Set the Baud rate and listen on the Bus (there must be traffic on the bus)
  • Check CANRead Value and see if you receive a valid CAN Frame - if yes - you got it - if not change to next baud rate and read again.
  • Run until end of available Baud rate list or until you found the Baud rate.
--------------------------------
PEAK-System Technik
Technical Support Team
support[at]peak-system.com
-------------------------------

jbonninFH
Posts: 3
Joined: Tue 30. Jul 2013, 11:43

Re: Find CAN Baudrate.

Post by jbonninFH » Thu 1. Aug 2013, 14:12

Thank you.
But how you cans check if the receive frame is valid or not? Have you a function to do that? Because I check the MsgType of the CANApi2.TCANMsg and if it's not 0 or 2 it's not a valid CAN frame.
And another question. How can I put my CAN interface in listen only mode with CANapi2 function?

User avatar
PEAK-Support
Sales & Support
Sales & Support
Posts: 1646
Joined: Fri 10. Sep 2010, 19:34

Re: Find CAN Baudrate.

Post by PEAK-Support » Thu 1. Aug 2013, 16:58

If you read a real CAN Frame - the Baudrate/BTR0/BTR1 Values are valid ! If the Baudrate is wrong you will never see a valid CAN Frame on the bus - very easy...

Code: Select all

And another question. How can I put my CAN interface in listen only mode with CANapi2 function?
The CANAPI2 is a non free Development Tool. Please send serial number and company information to our support[at]peak-system.com email and we could send you a sample.
--------------------------------
PEAK-System Technik
Technical Support Team
support[at]peak-system.com
-------------------------------

Post Reply