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.
Find CAN Baudrate.
- PEAK-Support
- Sales & Support
- Posts: 1646
- Joined: Fri 10. Sep 2010, 19:34
Re: Find CAN Baudrate.
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)
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
-------------------------------
PEAK-System Technik
Technical Support Team
support[at]peak-system.com
-------------------------------
Re: Find CAN Baudrate.
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?
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?
- PEAK-Support
- Sales & Support
- Posts: 1646
- Joined: Fri 10. Sep 2010, 19:34
Re: Find CAN Baudrate.
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
-------------------------------
PEAK-System Technik
Technical Support Team
support[at]peak-system.com
-------------------------------
Re: Find CAN Baudrate.
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?
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?
- PEAK-Support
- Sales & Support
- Posts: 1646
- Joined: Fri 10. Sep 2010, 19:34
Re: Find CAN Baudrate.
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...
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.
Code: Select all
And another question. How can I put my CAN interface in listen only mode with CANapi2 function?
--------------------------------
PEAK-System Technik
Technical Support Team
support[at]peak-system.com
-------------------------------
PEAK-System Technik
Technical Support Team
support[at]peak-system.com
-------------------------------