Example: biology

J1939 C Library for CAN-Enabled PICmicro …

2004 Microchip Technology 1AN930 INTRODUCTIONJ1939 is a series of SAE recommended practices thathave been developed to provide a standardarchitecture by which multiple electronic systems on avehicle can communicate. It was developed by theTruck and Bus Control and Communications NetworkSubcommittee of the Truck and Bus Electrical andElectronics Committee, but its use is not limited to truckand bus applications. J1939 has been implemented ina broad range of vehicles and transportation provides a communication protocol over a CANnetwork. The CAN network is comprised of two or moreinterconnected Electronic Control Units (ECUs). As perthe SAE J1939 -11 specification. the ECUs areconnected using linear shielded twisted pair wiring,with a data rate of 250 s CAN-Enabled PICmicro devices provide apowerful, flexible and low-cost means of implementingthe J1939 protocol on a wide variety of electronicvehicle components.

2004 Microchip Technology Inc. DS00930A-page 1 AN930 INTRODUCTION J1939 is a series of SAE recommended practices that have been developed to provide a standard

Tags:

  Introduction, Library, Enabled, Picmicro, Library for can enabled picmicro

Information

Domain:

Source:

Link to this page:

Please notify us if you found a problem with this document:

Other abuse

Advertisement

Transcription of J1939 C Library for CAN-Enabled PICmicro …

1 2004 Microchip Technology 1AN930 INTRODUCTIONJ1939 is a series of SAE recommended practices thathave been developed to provide a standardarchitecture by which multiple electronic systems on avehicle can communicate. It was developed by theTruck and Bus Control and Communications NetworkSubcommittee of the Truck and Bus Electrical andElectronics Committee, but its use is not limited to truckand bus applications. J1939 has been implemented ina broad range of vehicles and transportation provides a communication protocol over a CANnetwork. The CAN network is comprised of two or moreinterconnected Electronic Control Units (ECUs). As perthe SAE J1939 -11 specification. the ECUs areconnected using linear shielded twisted pair wiring,with a data rate of 250 s CAN-Enabled PICmicro devices provide apowerful, flexible and low-cost means of implementingthe J1939 protocol on a wide variety of electronicvehicle components.

2 The J1939 C Library handles themajority of network management aspects of J1939 ,allowing the user to concentrate on the primaryapplication. The Library provides support for all J1939address configurations and is easily configurablethrough Microchip s Application Maestro details about the PIC18 family of microcontrollers,refer to one of the CAN-Enabled PICmicromicrocontroller data sheets, such as the PIC18 FXX8 Data Sheet (DS41159), the PIC18F6585/8585/6680/8680 Data Sheet (DS30491), the PIC18F2585/2680/4585/4680 Data Sheet (DS39625) and the PICmicro 18C MCU Family Reference Manual (DS39500). Fordetails about the J1939 specification, refer to the variousSAE J1939 specifications, or visit :Kim OttenKim Otten Software ConsultingCo-Author: Caio G belMicrochip Technology C Library for CAN-Enabled PICmicro MicrocontrollersAN930DS00930A-page 2 2004 Microchip Technology OVERVIEWJ1939 is a communication protocol that is implementedon a CAN network.

3 Each Controller Application (CA)has an associated NAME and ADDRESS. The NAME value consists of 8 bytes with the following format:TABLE 1:CONTROLLER APPLICATION NAME/ADDRESS FORMATT hese bytes embed the following Address Capable If the CA isArbitrary Address Capable (see the J1939 Address Configuration section for details).Industry Group A 3-bit field that indicates anindustry group. These values are specified in System Instance This 4-bit field identifiesone particular occurrence of a given vehicle system ina given network. If only one instance of a certainvehicle system exists in a network, then this field mustbe set to 0 to define it as the first System This 7-bit field defines a group offunctions in a network. These values are specified inSAE This field is reserved for future use This 8-bit field defines the primary functionof the CA.

4 These values are specified in SAE Instance This 5-bit field identifies theparticular occurrence of a given function in a vehiclesystem and given network. If only one instance of acertain Function exists in a network, then this field mustbe set to 0 to define it as the first instanceECU Instance This 3-bit field is used when multipleECUs are involved in performing a single function. Ifonly one ECU is used for a particular CA, then this fieldmust be set to 0 to define it as the first Code This 11-bit field indicates themanufacturer in charge of the production of theelectronic control module. This field is assigned by thecommittee and is independent of other fields. Thesevalues are specified in SAE Number This 21-bit field is assigned by themanufacturer of the ECU. It must be unique and mustnot change with removal of power.

5 The manufacturermay choose to encode information within this field, butthey must also ensure Address ConfigurationMost CAs on a J1939 network will have a preferredaddress that will be used based on the CA s primaryfunction. These addresses are defined in the SAEJ1939 specification. As a general rule, after power-up,a J1939 module will try to claim its preferred address. Ifa conflict arises between modules, there are severalresolution methods based on the address configurationof the CA. If the CA cannot claim an address, it will notbe able to send Address Capable CA Single AddressCapable CAs are not able to change their addressindependently of external action. There are fourdifferent types of Single Address Capable CAs: Non-Configurable Address CA This type of CA can have its address changed only by the replacement of the firmware installed in the system.

6 Service Configurable Address CA This type of CA may have its source address changed in the field, either by a technician using a proprietary technique, or by another CA sending it a Commanded Address message while the CA is in a service mode of operation, which normally requires some sort of external tool/device. Command Configurable Address CA This type of CA can have its source address changed in the field through a Commanded Address message sent by another CA without the use of a service tool. Self-Configurable Address CA This type of CA may select its own address within a limited set of source addresses based on internal algorithms. Once the CA selects which address it should use, it is not capable of changing its address in the case of a Address Capable CA This type of CA canselect its source address from any appropriate sourceaddress, including those in the 128-247 range, usingan internal algorithm to calculate the address.

7 In caseof conflict, it can recalculate and reclaim a new addressunless all available addresses are already Address CapableIndustry GroupVehicle System InstanceVehicle SystemReservedFunctionFunction InstanceECU InstanceManufacturer CodeIdentity Number1 Bit3 Bits4 Bits7 Bits1 Bit8 Bits5 Bits3 Bits11 B its21 Bits 2004 Microchip Technology 3AN930J1939 MessagesJ1939 messages are sent using the CAN ExtendedFrame. A J1939 message consists of the followingcomponents:Priority This 3-bit field is used to define the priorityduring arbitration. 000 is the highest priority and isusually associated with high-speed control priority is used for noncritical configuration andinformation Page This 1-bit field defines on which data page(0 or 1) the message is defined in the J1939 specifica-tion. Page 0 contains the messages that are presentlydefined, while Page 1 is for future Data Unit (PDU) Format (PF) This 8-bitfield determines the format of the message and is oneof the fields that determines the Parameter GroupNumber of the message (see the Parameter GroupNumber section).

8 If the value is between 0 and 239,the message is a PDU 1 Format message. Thesemessages are sent to specific addresses (CAs). If thevalue is between 240 and 255, the message is a PDU 2 Format message. These messages are not sent to aspecific address (CA), but are instead broadcast to theentire Specific (PS) This 8-bit field is either theDestination Address (PDU 1 Format) or the GroupExtension (PDU 2 Format).Source Address This 8-bit field is the address of theCA that sent the Length The number of data bytes in Up to 8 bytes of first five items are placed into the CAN 29-bitextended identifier in the format shown in Table with more than 8 bytes of data must be sentusing the special Broadcast Announce Message(BAM) Transport messages are intended to be broadcastmessages, or PDU 2 Format, where the message is notsent to a particular address.

9 The J1939 specificationdefines PDU Format and PDU Specific values for manymessages by specifying the message ParameterGroup Numbers (see the Parameter GroupNumber section).A J1939 node can send messages to other nodes, or itcan request messages from other nodes, either glo-bally or with a specific destination address. If a nodereceives a request sent to it specifically, it must processthe message and send some sort of a node receives a global request, it must respond if itcan. If a node receives a broadcast message, it mustdetermine whether or not it is 2: J1939 MESSAGE FORMATSOFI dentifier11 BitsSRRIDEI dentifier Extension18 BitsRTRSOFP riorityRDPPDU Format (PF)6 Bits (MSB)SRRIDEPF(cont.)PDU Specific (PS)(Destination Address, Group Extension or Proprietary)Source AddressRTR3218765432187654321876543211 2345678910111213141516171819202122232325 2627282930313233282726252423222120191817 161514131211109876543210AN930DS00930A-pa ge 4 2004 Microchip Technology Group NumberThe J1939 specification defines allowable messagesby their Parameter Group Number (PGN).

10 The Param-eter Group Number is a 3-byte value that uniquelydefines the message purpose. A PGN has the followingformat:If the PDU Format value for a message is less than240, then the last 8 bits of the PGN are set to 0 . The J1939 specification gives the decimal equivalent ofthe PGNs. To obtain the PF and PS values to use for aspecific message, convert the decimal value from theJ1939 specification to hexadecimal and use the lasttwo bytes. These values can then be used to eithersend messages on the network or to request messagesfrom other CAs (see Example 5A and Example 5B inAppendix A: Source Code ). Library OVERVIEWThe J1939 C Library is targeted for use with CAN-Enabled PIC18 microcontroller applications written withMPLAB C18. It offers J1939 communications protocolsupport for CAs with one of the following addressconfigurations: Single Address Capable- Non-configurable- Service configurable- Command configurable- Self-configurable Arbitrary Address CapableThe Library routines handle initialization and networkfunctions automatically.


Related search queries