Korenix JetBox 8152 User Manual

Linux canbus
Hide thumbs Also See for JetBox 8152:

Advertisement

Quick Links

JetBox 8152 Linux CANBus
User Manual
www.korenix.com

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the JetBox 8152 and is the answer not in the manual?

Questions and answers

Subscribe to Our Youtube Channel

Summary of Contents for Korenix JetBox 8152

  • Page 1 JetBox 8152 Linux CANBus User Manual www.korenix.com...
  • Page 2: Copyright Notice

    Korenix assumes no liabilities resulting from errors or omissions in this document, or from the use of the information contained herein. Korenix reserves the right to make changes in the product design without notice to its users. Acknowledgments Korenix is a registered trademark of Korenix Technology Co., Ltd.
  • Page 3: Table Of Contents

    Chapter 1 Introduction ....................4 Chapter 2 Hardware Configuration................6 Pin Assignment...................6 Jumper Setting: JP6..................6 Chapter 3 Software Configuration ................7 Installation....................7 Example......................8 Chapter 4 Korenix Library Reference ................9 How to Use Library..................9 Functions....................9 Structure ....................15 Chapter 5 Appendix ....................17 Baud Rate Table..................17 Error Code Table..................18 Notes ......................19...
  • Page 4: Chapter 1 Introduction

    Chapter 1 Introduction The JetBox 8152 has two ports for I/O communications, One RS-232/422/485 port and one CANBUS port. The CAN (Controller Area Network) is a serial bus system especially suited for networking "intelligent" I/O devices as well as sensors and actuators within a machine or plant.
  • Page 5 CAN controller chip. And your can use interrupt the main processor when a message is received or transmitted if interrupts are enabled on the JetBox 8152. By using interrupts you can write powerful code to CAN. Description...
  • Page 6: Chapter 2 Hardware Configuration

    (120 Ω). The minimum speed is 20k bps. The maximum speed is 1M bps. But when CANBUS terminator is disabled, the maximize speed of CANBUS is 125k bps. If you want to use high speed (1M bps), please enable terminator. Korenix | Hardware Configuration...
  • Page 7: Chapter 3 Software Configuration

    Do the following steps to setup the driver Login in as root. ( username : root, password : korenix ) Default CanBus code are built-in jetbox linux environment. Go to the path /CanBus and you will see the follow directory.
  • Page 8: Example

    -w : Write CAN message. We use standard message type in this example. canrcv This example show you how to receive CAN message from other CANBus. Before to receive CAN messages, you have to reset CAN chip first and initial it. Korenix | Software Configuration...
  • Page 9: Chapter 4 Korenix Library Reference

    Chapter 4 Korenix Library Reference This section shows how to use Korenix CANbus Library to develop your program. When you call “make install” in the example directory, the library will be installed to the /usr/lib path. How to Use Library We use dlopen to load CANBus library.
  • Page 10 Message to transmit. Please refer to Structure for details. Can_Receive_Message void Can_Receive_Message(CANMsg *MsgToRead) Parameters MsgToRead Returns a CAN message from the receive queue. Can_Status_Report BYTE Can_Status_Report(void) Return Status of CAN controller Get the current status of the CAN controller. Korenix | Korenix Library Reference...
  • Page 11 001 0001 00xx ID 110h: 001 0001 0000 ID 111h: 001 0001 0001 ID 112h: 001 0001 0010 ID 113h: 001 0001 0011 So the value of dwACR is 0x221FFFFF and the value of dwAMR is 0x007FFFFF. Korenix | Korenix Library Reference...
  • Page 12 Note 5: More information of Status is given in the data sheet of SJA 1000 in section 6.4.6 Interrupt Register (IR). Can_Mode_Set void Can_Mode_Set(BYTE bMode) Parameters bMode operation mode Description Value SLEEP_MODE 0x10 ACCEPT_FILTER_MODE 0x08 SELF_TEST_MODE 0x04 LISTEN_ONLY_MODE 0x02 RESET_MODE 0x01 NORMAL_MODE 0x00 Korenix | Korenix Library Reference...
  • Page 13 Parameters bCmd Command mode Description Value CLEAR_DATA_OVERRUN 0x08 RELEASE_RECEIVE_BUFFER 0x04 ABORT_TRANSMISSION 0x02 TRANSMISSION_REQUEST 0x01 Note 7: More information of Status is given in the data sheet of SJA 1000 in section 6.4.4 Command Register (CMR). Korenix | Korenix Library Reference...
  • Page 14 The error warning limit can be defined within this register. The default value (after hardware reset) is 96. Note 10: More information of Status is given in the data sheet of SJA 1000 in section 6.4.10. Korenix | Korenix Library Reference...
  • Page 15: Structure

    Note 12: More information of Status is given in the data sheet of SJA 1000 in section 6.4.11. Structure The CanPort API defines the following structures CANMsg :Defines a CAN message typedef struct { DWORD ID; BYTE MSGTYPE; BYTE LEN; BYTE DATA[8]; } CANMsg; Korenix | Korenix Library Reference...
  • Page 16 Data Frame. CAN message with data contents according to CAN 2.0B standard (29-bit CAN ID). Number of data bytes in a data message (Data Length Code). DATA Data bytes of a CAN message. The size can be 0 to 8 bytes. Korenix | Korenix Library Reference...
  • Page 17: Chapter 5 Appendix

    The following Baud Rates are also common: Baud Rate (bps) BTR0 BTR1 33.33K 47.6K 83.33K 95.23K 800K Note 13: More information on setting the bit rate is given in the data sheet of SJA 1000 in section 6.5. Korenix | Appendix...
  • Page 18: Error Code Table

    ID.20 to ID.18 bit SRTR bit IDE ID.17 to ID.13 ID.12 to ID.5 ID.4 to ID.0 bit RTR reserved bit 1 reserved bit0 data length code data field CRC sequence CRC delimiter acknowledge slot acknowledge delimiter end of frame Korenix | Appendix...
  • Page 19: Notes

    6.4.9..................14 Note 10: More information of Status is given in the data sheet of SJA 1000 in section 6.4.10...................14 Note 11: More information of Status is given in the data sheet of SJA 1000 in section 6.4.12...................15 Korenix | Appendix...
  • Page 20: Revision History

    Note: You can get the SJA1000 datasheet from following website: http://www.nxp.com/documents/data_sheet/SJA1000.pdf Revision history V0.1 by 2012/9/4 Change default CANbus terminator jump setting (JP6) to enable Customer Service Korenix Technologies Co., Ltd. Business service: sales@korenix.com Customer service: koreCARE@korenix.com Korenix | Appendix...

Table of Contents