BUG: FATAL in firmware with DEBUG mode #667

This commit is contained in:
rusefi 2019-01-11 17:40:44 -05:00
parent 2b1fd382f2
commit f054de0876
2 changed files with 5 additions and 2 deletions

View File

@ -1981,7 +1981,7 @@ typedef enum {
CUSTOM_ERR_6614 = 6614,
CUSTOM_ERR_6615 = 6615,
CUSTOM_ERR_6616 = 6616,
CUSTOM_ERR_6617 = 6617,
CUSTOM_ERR_TIMER_STATE = 6617,
CUSTOM_ERR_6618 = 6618,
CUSTOM_ERR_6619 = 6619,

View File

@ -47,6 +47,7 @@ static const char * msg;
static char buff[32];
static int timerFreezeCounter = 0;
static volatile int setHwTimerCounter = 0;
extern bool hasFirmwareErrorFlag;
@ -55,6 +56,7 @@ extern bool hasFirmwareErrorFlag;
* This function should be invoked under kernel lock which would disable interrupts.
*/
void setHardwareUsTimer(int32_t timeUs) {
setHwTimerCounter++;
/**
* #259 BUG error: not positive timeUs
* Once in a while we night get an interrupt where we do not expect it
@ -75,7 +77,7 @@ void setHardwareUsTimer(int32_t timeUs) {
gptStopTimerI(&GPTDEVICE);
}
if (GPTDEVICE.state != GPT_READY) {
firmwareError(CUSTOM_HW_TIMER, "HW timer state %d", GPTDEVICE.state);
firmwareError(CUSTOM_HW_TIMER, "HW timer state %d/%d", GPTDEVICE.state, setHwTimerCounter);
return;
}
if (hasFirmwareError())
@ -148,6 +150,7 @@ static constexpr GPTConfig gpt5cfg = { 1000000, /* 1 MHz timer clock.*/
void initMicrosecondTimer(void) {
gptStart(&GPTDEVICE, &gpt5cfg);
efiAssertVoid(CUSTOM_ERR_TIMER_STATE, GPTDEVICE.state == GPT_READY, "hw state");
lastSetTimerTimeNt = getTimeNowNt();
#if EFI_EMULATE_POSITION_SENSORS