Real hardware ICU coverage on nucleo-F767 #7034

only:preparation
This commit is contained in:
rusefillc 2024-12-09 19:55:15 -05:00
parent 143c6a2d1b
commit 9e5a3fb8f1
6 changed files with 83 additions and 39 deletions

View File

@ -35,7 +35,7 @@
void setDiscoveryPdm() {
}
#ifdef HW_FRANKENSO
#if defined(HW_NUCLEO_F767) || defined(HW_NUCLEO_H743) || defined(HW_FRANKENSO)
/**
* set engine_type 59

View File

@ -27,7 +27,7 @@ public class HwCiF4Discovery {
BurnCommandTest.class,
MiscTest.class,
CommonFunctionalTest.class,
PwmHardwareTest.class,
DiscoveryPwmHardwareTest.class,
VssHardwareLoopTest.class,
HighRevTest.class,
};

View File

@ -2,6 +2,7 @@ package com.rusefi;
import com.rusefi.common.MiscTest;
import com.rusefi.f4discovery.*;
import com.rusefi.nucleo.NucleoPwmHardwareTest;
public class HwCiNucleoF7 {
public static void main(String[] args) {
@ -9,8 +10,9 @@ public class HwCiNucleoF7 {
PTraceTest.class,
CompositeLoggerTest.class,
HighRevTest.class,
NucleoPwmHardwareTest.class,
// removed due to extremely low temperatures on the HWCI node (or we are incorrectly reading the CPU temperature on F7)
// MiscTest.class,
// MiscTest.class,
});
}
}

View File

@ -0,0 +1,50 @@
package com.rusefi.common;
import com.rusefi.Timeouts;
import com.rusefi.config.generated.Integration;
import com.rusefi.core.Sensor;
import com.rusefi.core.SensorCentral;
import com.rusefi.enums.engine_type_e;
import com.rusefi.functional_tests.EcuTestHelper;
import static com.rusefi.IoUtil.getEnableCommand;
import static com.rusefi.binaryprotocol.BinaryProtocol.sleep;
import static com.rusefi.config.generated.Fields.*;
public class PwmHardwareTestLogic {
private static final int FREQUENCY = 160;
public static void runIdlePwmTest(EcuTestHelper ecu, String idlePin, String logicCapturePin) {
ecu.setEngineType(engine_type_e.FRANKENSO_MIATA_NA6_MAP);
ecu.changeRpm(1000);
ecu.sendCommand(CMD_TRIGGER_SIMULATOR_PIN + " 0 none");
ecu.sendCommand(CMD_TRIGGER_SIMULATOR_PIN + " 1 none");
ecu.sendCommand(CMD_IDLE_PIN + " " + idlePin);
/* wasted two wire, so we really need 1..3 to be none */
ecu.sendCommand(CMD_IGNITION_PIN + " 1 none");
ecu.sendCommand(CMD_IGNITION_PIN + " 2 none");
ecu.sendCommand(CMD_IGNITION_PIN + " 3 none");
// changing pin to avoid conflict
ecu.sendCommand(CMD_TRIGGER_PIN + " 1 PA8");
/* DBG_LOGIC_ANALYZER */
ecu.sendCommand("set debug_mode " + com.rusefi.enums.debug_mode_e.DBG_LOGIC_ANALYZER.ordinal());
/* 160 Hz */
ecu.sendCommand("set idle_solenoid_freq " + FREQUENCY);
/* save these for last to ensure logic is started */
ecu.sendCommand(CMD_LOGIC_PIN + " 0 " + logicCapturePin);
ecu.sendCommand(CMD_WRITECONFIG);
sleep(2 * Timeouts.SECOND);
ecu.sendCommand(getEnableCommand(Integration.CMD_SELF_STIMULATION));
sleep(2 * Timeouts.SECOND);
/* +-2% is still acceptable */
EcuTestHelper.assertSomewhatClose("Idle PWM freq", FREQUENCY, SensorCentral.getInstance().getValue(Sensor.debugIntField1), 0.02);
}
}

View File

@ -4,12 +4,11 @@ import com.devexperts.logging.Logging;
import com.rusefi.IoUtil;
import com.rusefi.RusefiTestBase;
import com.rusefi.Timeouts;
import com.rusefi.config.generated.Fields;
import com.rusefi.common.PwmHardwareTestLogic;
import com.rusefi.config.generated.Integration;
import com.rusefi.core.Sensor;
import com.rusefi.core.SensorCentral;
import com.rusefi.enums.engine_type_e;
import com.rusefi.functional_tests.EcuTestHelper;
import org.junit.Test;
import static com.devexperts.logging.Logging.getLogging;
@ -25,8 +24,8 @@ import static org.junit.Assert.assertEquals;
* PD2<>PA5
*/
public class PwmHardwareTest extends RusefiTestBase {
private static final Logging log = getLogging(PwmHardwareTest.class);
public class DiscoveryPwmHardwareTest extends RusefiTestBase {
private static final Logging log = getLogging(DiscoveryPwmHardwareTest.class);
@Override
protected boolean needsHardwareTriggerInput() {
@ -34,8 +33,6 @@ public class PwmHardwareTest extends RusefiTestBase {
return true;
}
private static final int FREQUENCY = 160;
@Test
public void scheduleBurnDoesNotAffectTriggerIssue2839() {
ecu.setEngineType(engine_type_e.FORD_ASPIRE_1996);
@ -59,35 +56,6 @@ public class PwmHardwareTest extends RusefiTestBase {
@Test
public void testIdlePin() {
ecu.setEngineType(engine_type_e.FRANKENSO_MIATA_NA6_MAP);
ecu.changeRpm(1000);
ecu.sendCommand(CMD_TRIGGER_SIMULATOR_PIN + " 0 none");
ecu.sendCommand(CMD_TRIGGER_SIMULATOR_PIN + " 1 none");
ecu.sendCommand(CMD_IDLE_PIN + " PD2");
/* wasted two wire, so we really need 1..3 to be none */
ecu.sendCommand(CMD_IGNITION_PIN + " 1 none");
ecu.sendCommand(CMD_IGNITION_PIN + " 2 none");
ecu.sendCommand(CMD_IGNITION_PIN + " 3 none");
ecu.sendCommand(CMD_TRIGGER_PIN + " 1 PA8");
/* DBG_LOGIC_ANALYZER */
ecu.sendCommand("set debug_mode " + com.rusefi.enums.debug_mode_e.DBG_LOGIC_ANALYZER.ordinal());
/* 160 Hz */
ecu.sendCommand("set idle_solenoid_freq " + FREQUENCY);
/* save these for last to ensure logic is started */
ecu.sendCommand(CMD_LOGIC_PIN + " 0 PA5");
ecu.sendCommand(CMD_WRITECONFIG);
sleep(2 * Timeouts.SECOND);
ecu.sendCommand(getEnableCommand(Integration.CMD_SELF_STIMULATION));
sleep(2 * Timeouts.SECOND);
/* +-2% is still acceptable */
EcuTestHelper.assertSomewhatClose("Idle PWM freq", FREQUENCY, SensorCentral.getInstance().getValue(Sensor.debugIntField1), 0.02);
PwmHardwareTestLogic.runIdlePwmTest(ecu, "PD2", "PA5");
}
}

View File

@ -0,0 +1,24 @@
package com.rusefi.nucleo;
import com.devexperts.logging.Logging;
import com.rusefi.RusefiTestBase;
import com.rusefi.f4discovery.DiscoveryPwmHardwareTest;
import org.junit.Test;
import static com.devexperts.logging.Logging.getLogging;
public class NucleoPwmHardwareTest extends RusefiTestBase {
private static final Logging log = getLogging(DiscoveryPwmHardwareTest.class);
@Override
protected boolean needsHardwareTriggerInput() {
// This test uses hardware trigger input!
return true;
}
@Test
public void testIdlePin() {
// todo!
// PwmHardwareTestLogic.runIdlePwmTest(ecu, "PD2", "PA6");
}
}