background image

Korenix | Korenix Library Reference 

15 

 

 

Can_Get_TXERROR_COUNTER 

 

BYTE Can_Get_TXERROR_COUNTER(void) 

 

Return 

The value of transmit error. 

 

The TX error counter register reflects the current value of the transmit error counter. 

Note 11: More information of Status is given in the data sheet of SJA 1000 in 

section 6.4.12.

 

 

 

Can_Get_RXERROR_COUNTER 

 

BYTE Can_Get_RXERROR_COUNTER(void) 

 

Return 

The value of receive error. 

 

The RX error counter register reflects the current value of the receive error counter.

 

Note 12: More information of Status is given in the data sheet of SJA 1000 in 

section 6.4.11. 

 

4-3 

 

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; 

 

StockCheck.com

Summary of Contents for JetBox 8152

Page 1: ...JetBox 8152 Linux CANBus User Manual www korenix com S t o c k C h e c k c o m...

Page 2: ...ocument is for product information only and is subject to change without notice While reasonable efforts have been made in the preparation of this document to assure its accuracy Korenix assumes no li...

Page 3: ...Pin Assignment 6 2 2 Jumper Setting JP6 6 Chapter 3 Software Configuration 7 3 1 Installation 7 3 2 Example 8 Chapter 4 Korenix Library Reference 9 4 1 How to Use Library 9 4 2 Functions 9 4 3 Struct...

Page 4: ...trial automation CANbus This section describes how to program and use the CANBUS It provides a description of the I O memory map of the chip and discussion of the internal registers to aid you in prog...

Page 5: ...ts you can write powerful code to CAN Example Programming Write 300H to the CAN controller Control byte located in the on chip address 0 The Example is listed below Outportb 0x300 0x00 Write CAN Addre...

Page 6: ...s termination jumper Only two termination jumpers should be closed at the endpoints of the CANbus Value Terminator Resistor 120 The minimum speed is 20k bps The maximum speed is 1M bps But when CANBUS...

Page 7: ...e code will work successfully Do the following steps to setup the driver 1 Login in as root username root password korenix 2 Default CanBus code are built in jetbox linux environment Go to the path Ca...

Page 8: ...compile install all need files It will generate two sample files cantest and canrcv cantest There will be four command as below cantest i Initial CanBus Chip and set baud rate to 125K cantest r Reset...

Page 9: ...amic library returned by dlopen and the null terminated symbol name returning the address where that symbol is loaded Init_CanBus dlsym handle Init_Can Call man dlopen to detail information of dlopen...

Page 10: ...ng of messages will be canceled and messages in the driver buffer will be cleared as well Can_Send_Message void Can_Send_Message CANMsg MsgToSend Parameters MsgToSend Message to transmit Please refer...

Page 11: ...on of Status is given in the data sheet of SJA 1000 in section 6 4 15 Acceptance Filter Parameters dwACR Acceptance Code Register dwAMR Acceptance Mask Register Example The following example shows the...

Page 12: ..._Status BYTE Can_Interrupt_Status void Return The value of Interrupt Register 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_S...

Page 13: ...ISTER 0 BTR1 BUS TIMING REGISTER 1 This function only sets the baud rate to CAN controller Can_Set_Command void Can_Set_Command BYTE bCmd Parameters bCmd Command mode Description Value CLEAR_DATA_OVER...

Page 14: ...heet of SJA 1000 in section 6 4 9 Can_Get_ALC BYTE Can_Get_ALC void Return The value of Arbitration Lost Capture Register Can_Get_EWL BYTE Can_Get_EWL void Return The value of Error Warning Limit Regi...

Page 15: ...SJA 1000 in section 6 4 12 Can_Get_RXERROR_COUNTER BYTE Can_Get_RXERROR_COUNTER void Return The value of receive error The RX error counter register reflects the current value of the receive error co...

Page 16: ...MSGTYPE_STANDARD 00h Data Frame CAN message with data contents and an 11 bit CAN ID MSGTYPE_RTR 01h Remote Transmit Request RTR MSGTYPE_EXTENDED 02h Data Frame CAN message with data contents according...

Page 17: ...0K 47 2F 100K BAUD _100K 43 2F 125K BAUD _125K 03 1C 250K BAUD _250K 01 1C 500K BAUD_500K 00 1C 1000K BAUD_1M 00 14 The following Baud Rates are also common Baud Rate bps BTR0 BTR1 33 33K 1D 14 47 6K...

Page 18: ...1 1 start of frame 0 0 0 1 0 ID 28 to ID 21 0 0 1 1 0 ID 20 to ID 18 0 0 1 0 0 bit SRTR 0 0 1 0 1 bit IDE 0 0 1 1 1 ID 17 to ID 13 0 1 1 1 1 ID 12 to ID 5 0 1 1 1 0 ID 4 to ID 0 0 1 1 0 0 bit RTR 0 1...

Page 19: ...sheet of SJA 1000 in section 6 4 5 Status Register SR 11 Note 4 More information of Status is given in the data sheet of SJA 1000 in section 6 4 15 Acceptance Filter 11 Note 5 More information of Sta...

Page 20: ...t of SJA 1000 in section 6 5 17 Note You can get the SJA1000 datasheet from following website http www nxp com documents data_sheet SJA1000 pdf 5 4 Revision history V0 1 by 2012 9 4 Change default CAN...

Reviews: