▸ Python production tester architecture: pip install python-udsoncan python-can; imports: import udsoncan, can, udsoncan.connections as conn; create socketcan or PCAN interface: bus = can.interface.Bus('can0', bustype='socketcan', bitrate=500000); transport = conn.PythonIsoTpConnection(bus, rxid=0x7E8, txid=0x7E0, address_type=udsoncan.TargetAddressType.Physical); config: {'request_timeout':2, 'p3_client':4.5, 'use_server_timing':True}; client = udsoncan.Client(transport, config=config); entire sequence wrapped in context manager: with client: ... handles connection + TesterPresent keep-alive automatically via config p3_client interval
▸ Step-by-step Python implementation: client.change_session(DiagnosticSessionControl.Session.extendedDiagnosticSession); # Security access with customer algorithm: response = client.request_seed(0x09); seed = response.service_data.seed; key = production_key_algorithm(seed, SECRET_MASTER_KEY); client.send_key(0x09, key); # Read VIN for verification: vin_response = client.read_data_by_identifier([0xF190]); vin = vin_response.service_data.values[0xF190].decode('ascii'); # Write variant code: client.write_data_by_identifier(0xF101, bytes([VARIANT_CODE])); # Trigger EOL calibration routine: client.start_routine(0xA001); routine_result = client.request_routine_results(0xA001); assert routine_result.service_data.routine_status_record[0] == 0x00; # Clear DTCs: client.clear_dtc(0xFFFFFF); # Final DTC check: dtcs = client.get_dtc_by_status_mask(0x08); assert len(dtcs) == 0, f"Unexpected confirmed DTCs: {dtcs}"
▸ Quality gate pass/fail logic: define test_results = {} dictionary; for each step assign pass/fail with actual vs expected value; generate structured report: {timestamp, ECU_partNumber, testerSerialNumber, step_results: [{step:'VIN', expected:'WBA12345678901234', actual:vin, pass:True}, {step:'VariantCode', expected:0x03, actual:written_code, pass:True}, {step:'CalibrationRoutine', expected:0x00, actual:routine_result, pass:True}, {step:'DTCCheck', expected:0, actual:0, pass:True}]}; write JSON report to shared network path for MES integration; barcode scanner integration: scan ECU barcode → set PART_NUMBER + VIN variables → run sequence → upload report to quality database; target cycle time: <30 seconds per ECU including power-on delay
▸ Common pitfalls and debugging: NRC 0x22 on session change → ECU voltage too low (<10.5V), check bench supply; NRC 0x36 on security access → key algorithm mismatch - verify MASTER_KEY version matches ECU software version (version tied to key variant); NRC 0x31 on variant write → variant code out of allowed range for this hardware part number - check OEM variant matrix; NRC 0x78 unexpected during routine → extend routine timeout to 10s for slow NvM writes; IsoTP timeout on TransferData → CAN bus overloaded - check no other nodes transmitting; use python-can Bus.set_filters() to capture all diagnostic frames for post-mortem analysis; dump full session trace with can.Logger('test_trace.asc') → open in CANoe for timing analysis