-
PCAN-USB manual한국과학기술연구소 인턴 2023. 3. 27. 17:41
배경
모터를 CAN 통신으로 제어하기 위한 방법들에 대해서 공부해 보았고, 그중에서도PCAN-USB에 에 대해서 정리해 보고자 합니다. (전에 공부했던 CAN Interface 들에 비해 오늘 리뷰하는 제품이 Matlab과 자사 제품을 연동될 수 있도록 편의 기능을 제공해서 최종적으로 PEAK-System 사의 PCAN-USB 제품을 사용하게 되었습니다)
PCAN-USB
Properties at a Glance
- CAN interface for the USB connection (Full-Speed mode, compatible with USB 1.1, USB 2.0, and USB 3.0)
- High-speed CAN connection (ISO 11898-2)
- Bit rates from 5 kbit/s up to 1 Mbit/s
- Time stamp resolution 42 µs
- NXP CAN controller SJA1000, 16 MHz clock frequency
- NXP CAN transceiver PCA82C251
- Galvanic isolation on the CAN connection up to 500 V (only PCAN-USB opto-decoupled)
- CAN termination can be activated through a solder jumper
Time stamp resolution 42 µs
:이것은 PCAN-USB 인터페이스에서 CAN 메시지에 할당된 타임스탬프의 해상도를 나타냅니다. 즉, 각 CAN 메시지의 수신 시간을 42 마이크로초(µs) 단위로 기록할 수 있습니다. 이 정보는 메시지 간의 시간 관계를 분석하고 디버깅하는 데 유용합니다.
NXP CAN controller SJA1000
: NXP사의 SJA1000 CAN 컨트롤러를 사용, CAN 컨트롤러는 CAN 프레임의 송수신을 관리하고, 통신 오류를 감지하며, CAN 통신의 시간 제어를 담당
NXP CAN transceiver PCA82C251
NXP사의 PCA82C251 CAN 트랜시버를 사용, CAN 컨트롤러와 CAN 버스 간의 신호 변환을 처리
Internal Termination
Only applicable from S/N 200000
The internal termination can be activated by solder jumpers on the circuit board to
terminate one end of the CAN bus. At delivery the termination is not activated.Tipp: We recommend to do termination at the CAN cabling, for example with the terminating resistors PCAN-Term (IPEK-003002) or PCAN-MiniTerm (IPEK-003002-Mini). Thus, CAN nodes can be flexibly connected to the bus.
-> Termination Register를 고려하여 추가적인 단자와 선 구매 예정
Example of a Connection
Principle Description of the API
Initialization
A CAN channel must be initialized before using it. This is done by the simple call of
the function CAN_Initialize for CAN and CAN_InitializeFD for CAN FD.
Per CAN interface type the API allows the simultaneous use of up to 16 CAN
channels. After a successful initialization the CAN channel is ready. No further
configuration steps are required.Interaction
For receiving and transmitting messages the functions CAN_Read and CAN_ Write as well as CAN_ReadFD and CAN_WriteFD are available depending on the initialization mode. For the receiving CAN messages, events can be configured for automatic notification of an application (client). This offers the following advantages:
- The application no longer needs to check for received messages periodically (no polling).
- The response time at reception is reduced.
Completion
To end the communication the function CAN_Uninitialize is called in order to release the reserved resources for the CAN channel, among others. In addition the CAN channel is marked as "Free" and is available to other applications.
CAN VS CAN FD
CAN (Controller Area Network)과 CAN FD (CAN with Flexible Data-Rate)는 모두 자동차 및 산업용 애플리케이션에서 널리 사용되는 직렬 통신 프로토콜입니다. 두 프로토콜 모두 신뢰성 높은 실시간 통신을 제공하며, 다중 마스터 시스템에서 사용되기 위해 설계되었습니다. 주요 차이점은 다음과 같습니다.
- 데이터 전송 속도 : 기본 CAN 프로토콜은 최대 1 Mbit/s의 데이터 전송 속도를 제공합니다. 반면에 CAN FD는 5 Mbit/s 이상의 데이터 전송 속도를 지원합니다. 이 높은 전송 속도는 빠른 데이터 교환을 요구하는 어플리케이션에 유용합니다.
- 데이터 프레임 크기 : 기본 CAN에서 데이터프레임의 최대 페이로드 크기는 8바이트로 제한됩니다. 이는 효율성과 실시간 성능에 제한을 두게 됩니다. 반면에 CAN FD는 최대 64바이트의 페이로드 크기를 지원하여, 더 많은 데이터를 한 번에 전송할 수 있습니다. 이는 보다 효율적인 통신 및 대역폭 활용을 가능하게 합니다.
- 전송 속도의 유연성 : CAN FD는 데이터 프레임의 속도를 동적으로 조정할 수 있는 기능을 제공합니다. 이는 프레임의 일부(데이터 필드)에서 더 높은 전송 속도를 사용하고, 프레임의 다른 부분(아이들링, 동기화)에서는 기본 속도를 사용할 수 있게 합니다. 이 기능은 데이터 전송 효율성을 높이고, 더 나은 실시간 성능을 제공합니다.
- 오류 검출 및 처리 : 기본 CAN 프로토콜은 CRC (Cyclic Redundancy Check)를 사용하여 데이터 전송 오류를 검출하고 처리합니다. 반면에 CAN FD는 더 긴 데이터 필드를 사용하므로 CRC 길이가 증가하여 더 강력한 오류 검출 기능을 제공합니다. 이렇게 함으로써 CAN FD는 오류가 더 낮은 통신을 가능하게 합니다.
- 하위 호환성 : CAN FD는 기존의 CAN 시스템과 호환될 수 있도록 설계되어 있습니다. 이를 통해 개발자는 기존의 CAN 기반 시스템을 쉽게 업그레이드할 수 있습니다. 그러나 CAN FD를 완전히 활용하려면 하드웨어 및 소프트웨어를 업데이트해야 할 수도 있습니다.
'한국과학기술연구소 인턴' 카테고리의 다른 글
MATLAB [Send CAN message] (0) 2023.04.04 MATLAB [CAN channel creation] (0) 2023.03.28 UART (0) 2023.03.26 uCAN Converter (API) (0) 2023.03.25 uCAN Converter (Data Type) (0) 2023.03.17