Skip to content

udv2g/saej3068-ref

Repository files navigation

Introduction

This is a hardware and software implementation of the communications (LIN-CP) portion of SAE J3068 to accompany the third edition of that standard. The implementation is incomplete, does not yet meet all requirements of the standard, and has not been exhaustively tested. The known deficiencies are noted in the following sections.

It can also be configured for SAE J1772/IEC 61851-1 Annex A, but this is not the primary intention and may have subtle incompatibilities. The upcoming revision of IEC 61851-1 Annex D is expected to be the same as SAE J3068 and is therefore supported. The published version of Annex D can be supported with modification.

Initial support for SAE J3068/1 has been added as of 2/24. Preliminary support for SAE J3068/2 is added as of 11/24. See below.


Hardware

The hardware design is provided as schematic and PCB layout files in Pulsonix format. A free Viewer is available. A single design is used for both the Electric Vehicle (EV) and the Electric Vehicle Supply Equipment (SE in SAE J3068 parlance). Four design variants are provided for different configurations.

Design Variant Description
EV Inlet controller for an Electric Vehicle including an inlet lock driver and CAN controller
EVB Same as EV with the ability to control two inlets simultaneously
SE Supply Equipment charging controller
SEB Same as SE with the ability to control two connections simultaneously

The fully populated design is capable of functioning as either an EV or an SE with the addition or removal of a small number of components.

The layout provided can be used as is as a component in an EVSE or EV inlet, but it is recommended for the design to be integrated in a complete product, and the layout provided only be used as a starting point. As provided, the design is appropriate for bench testing of LIN-CP.

The software supports two microcontroller "targets", but the hardware design is only supplied for the Standard (9S12G96) target. Hardware for the S12X target (MC9S12XET256) is mostly the same but some pins are changed. See hardware.h and the S12X define.


Software

The software is provided as a CodeWarrior project for the HCS12 microcontroller. The code depends on the NXP LIN Stack. A direct link does not work so go to The NXP website, log in, search fsl_lin, and click on software on the left pane.

Until the licensing situation of the relevant LIN Stack files is clarified, the LIN_Stack subdirectory will need to be copied from the stack package to the top-level directory and patched with

    patch -s -p0 < LIN_4_6_5_add_mc9s12g.patch

(Tested on 4.6.6 as well)

LIN configuration files are generated by the NCFTool (from the LIN stack package) with the .npf and .ldf files. This has already been done. Other generation scripts present in the files have also been run.

The project file is Project/Project.mcp. Open it in Codewarrior, modify config.h as appropriate, and make (F7).

All configuration options relevant to fully supported features (including EV/SE and one/two channel) are set in config.h.

Options include:

  • Support for LIN-CP, PWM, or both
  • Support for J1939 signaling (EV only -- configurable message IDs)
  • Support for single or three phase supplies and type 1 couplers.
  • Nominal/Supported voltages and currents

Deficiencies WRT SAE J3068

An incomplete list of ways in which the implementation does not yet conform to the standard:

  • LIN sleep is not implemented
  • Temperature monitoring is not implemented in the software (it is supported by the hardware).
  • Some of the timing requirements may not be met.
  • The SE does not respect EvMinCurrents (the minimum current the EV requested the SE be able to maintain before providing power). The meaning of this signal has been clarified in the second edition and this feature needs to be reviewed.

Limitations

An incomplete list of features that are not required by the standard, but the developers feel are likely to be important to many users, and are not yet implemented:

  • The hardware is designed to support all common inlet lock types, but the software is only currently able to support simple four-wire locks (reversible coil to lock/unlock and a pair which is connected when locked e.g. Aptive Power Signal Evolution). No lock is also supported but not allowed by the standard.
  • The SE controller software cannot be commanded to set a particular diagnostic code.
  • A bootloader is not used.
  • The single (CH_A_ONLY) EVSE configuration is broken when using PWM-CP.

Serial Interface

A UART is provided on RX_IN_5V_TTL and TX_OUT_5V_TTL configured as 115200 baud 8N1. It is a 5V interface but will generally interoperate with 3.3V UARTs without level shifters. It is intended that the UART will be the primary communication interface on an SE configuration and be used only for debugging on an EV configuration, but a functioning EVSE can be built without using the UART and it can be used on an EV if desired.

Due to hardware limitations, this one interface is used for both debug information and (machine generated) commands. To allow easy differentiation, commands and status information intended to be machine parseable begin with a > and end with either a carriage return + line feed (\r\n) or a # and an optional comment. If a comment is included, the command will not be parsed until a CR+LF is encountered. Two devices with this scheme (i.e. the SE LIN-CP controller and a device controlling the other functions of an EVSE such as RCD protection) can communicate while also providing debug information to a technician monitoring the connection.

All numbers in commands are hexadecimal, parts in parentheses () are optional, The channel is always specified as a character A or B and is assumed to be A if not set.

Command Sender Receiver Examples Description
>E:⁠<Error Number>⁠(#Comment) All All >E:01#PEBKAC Response to a command that cannot be acted upon. No specific response is expected.
>EU:<Error Number>:<set[S]/
clear[C]⁠(:⁠<channel>)⁠(#⁠<comment>)
All Ctrl SE or EV >EU:81:S
>EU:82:C:B
Set or Clear a one of the "Upstream Errors" that disallow charging.
>C:&<open[O]/
close[C]>(:<channel>)(#comment)
SE SE Ctrl >C:O#Open channel A
>C:C:B#Close channel B
Tell the EVSE controller when the LIN-CP interface thinks the contactor should close or open
>SI:<PWM&nbspcurrent/
I L1>(:<I L2>:<I L3>:<I N>)
(:<channel>)(#Comment)
SE Ctrl SE >SI:1E
>SI:3F:3F:20:05
Set the allowable current for a channel that is supplying power (does not change starting current of an idle channel). Example 1: Set all contacts to 30A. Example 2: Set Lines 1 and 2 to 63A, Line 3 to 32A, and Neutral to 5A.
>IC:⁠<Info Code>:⁠<set[S]/priority set[P]/
clear[C]>(:<channel>)(#Comment)
All Ctrl SE or EV >IC:11:P#VerFail
>IC:1D:C:B
Set an info code at the end of the list, the beginning of the list (priority), or clear a code. A code will be cleared by this command if it was set by this command, the application code, or both.
Error Number Type Description
01 Standard Invalid Command
02 Standard Malformed Command
81 Upstream Sleeping
82 Upstream Charging Disallowed
83 Upstream Error
84 Upstream RCD Fault
85 Upstream Unlock (clears automatically on unplug)

Explanation of Hardware Features

12V_HIGH_SIDE_WAKEUP_500mA: This is a 12V output signal capable of driving half an amp that is driven high when an EV detects the presence of an SE (as determined by pilot state).

Over Temp Cutout: This signal is expected to be connected to ground through a series of temperature sensors that open when above whatever maximum temperature is determined safe for the component bonded to the sensor. Not yet implemented!

+5V Sleep Shdn: Rail to power high-draw components not needed when in LIN sleep to save power. Not yet implemented!

Contactor LEDs: These are not needed for normal function, but are very helpful for bench testing/debugging. The signals driving the LEDs can also be used to control the contactor in systems not sophisticated enough to parse the serial signals.

CAN termination: A 120 Ohm CAN termination resistor is included for bench testing. It is not connected by default (can be connected by installing the adjacent jumper). It is not recommended to be used in a vehicle.

+-12V generation: +-12V are generated from the 5V rail on SE config. This isolates the generation circuit, sensitive to high-voltage spikes, from the upstream power supply. These rails do not draw enough current in normal operation to have a significant impact on power consumption. In a system with a well-regulate 12V supply, the generation circuit can be run from this supply, or the generation circuit can be replaced with a charge-pump voltage inverter if desired.

Updated (Edition 2) Control Pilot/LIN circuit: The Control Pilot circuit is modified from the published version of SAE J3068 to improve interoperability with PWM signaling. See this post.

Pads for Inlet Prox resistor: SAE J3068 (like SAE J1772) requires the Prox pulldown resistor in the EV (R5 in the standards) be installed in the inlet socket for diagnostic purposes. Pads are included in the design to install this resistor on the inlet controller PCB. They are there for bench testing only and should not be used in a production vehicle.

Prox power supply compensation: The upcoming edition of SAE J3068 requires the Prox circuit power supply be 5V+-1% OR 5V+-5% and the supply be compensated for when measuring the Prox voltage to ensure all of the states can be correctly differentiated with the specified component tolerances. (5V is required so the SE can monitor the Prox line if necessary. The looser tolerance is acceptable as it is not critical the SE be able to uniquely identify all of the states.) This implementation compensates for the Prox circuit supply voltage by using this voltage as the reference (supply) voltage of the analog-to-digital converter.

Prox and Pilot Fusing: The Proximity Detection and Control Pilot circuits are protected by poly fuses. This satisfies the requirement these circuits survive an indefinite short to vehicle 12V and should obviate the need to ensure the resistors fail open.

Oscillator crystal options: SMD oscillator crystals are currently in short supply so the design accepts 3.2mm x 2.5mm no lead packages with 2 or 4 pads and with or without shield. Instructions are in the schematic.

Lock Wiring: 4-wire lock mechanisms are to be wired as follows:

  • Lock_X_Coil_Plus and Lock_X_Coil_Minus should be wired to the lock coil/motor such that it locks when the polarity matches the signal names.
  • It is assumed the driver is designed for 12V operation
  • uC_Sense_Signal_X_Lock should be connected to one side of the lock detection switch, with the other side connected to ground via Sense_Signal_X_Lock_Return
  • uC_Sense_Signal_X_Unlock and Sense_Signal_X_Unlock_Return are unused for this lock type.

Other lock types are not currently supported by the software, but not having a lock is supported (not allowed in the standard, but useful for testing).


SAE J3068/1 and SAE J3068/2 Support

Protocol version support and priority is configured in config.h with the SUPPORTED_PVERSIONS macro

    #define SUPPORTED_PVERSIONS  PVER_SLASH_1,	//support /1
	#define SUPPORTED_PVERSIONS  PVER_SLASH_2, PVER_SLASH_1, //support /2 and /1 with /2 prioritized over /1
	#define SUPPORTED_PVERSIONS  PVER_SLASH_2,	//support only /2

The base Protocol Version defined in SAE J3068 (2) and the Protocol Version associated with PWM-CP (as historically defined in SAE J1772 and now SAE J3400) (0) are automatically included as appropriate. Other Protocol Versions listed in the define will be enabled and prioritized left to right. To enable only Protocol Version 2 use

    #define SUPPORTED_PVERSIONS

Only the Identification phase is fully enabled with a limited subset of generic information (e.g. VIN = VINgoesHere234567). ids-handler.c can be regenerated using the code generator included in the emulator repo to add, remove, or change the fields supported, including support for the data phase.

Support for /2 is partial but the mechanisms are included. Support for the SunSpec tunnel is not yet included.

About

Reference Implementation of SAE J3068

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published