Merge pull request #3466 from prusa3d/MK3_3.10.2

PFW-1303: Reset pullups on ADC
This commit is contained in:
3d-gussner 2022-04-13 13:15:52 +02:00 committed by GitHub
commit e58495ef39
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 47 additions and 3 deletions

View File

@ -499,6 +499,7 @@ void raise_z_above(float target, bool plan=true);
extern "C" void softReset();
void stack_error();
void pullup_error(bool fromTempISR);
extern uint32_t IP_address;

View File

@ -1758,6 +1758,10 @@ void stack_error() {
crash_and_burn(dump_crash_reason::stack_error);
}
void pullup_error(bool fromTempISR) {
crash_and_burn(fromTempISR ? dump_crash_reason::bad_pullup_temp_isr : dump_crash_reason::bad_pullup_step_isr);
}
void trace();

View File

@ -327,7 +327,13 @@ static_assert(sizeof(Sheets) == EEPROM_SHEETS_SIZEOF, "Sizeof(Sheets) is not EEP
| 0x0D05 3333 | uint32_t | EEPROM_JOB_ID | ??? | 00 00 00 00h | Job ID used by host software | D3 only | D3 Ax0d05 C4
| 0x0D04 3332 | uint8_t | EEPROM_ECOOL_ENABLE | ffh 255 | ^ | Disable extruder motor scaling for non-farm print | LCD menu | D3 Ax0d04 C1
| ^ | ^ | ^ | 2ah 42 | ^ | Enable extruder motor scaling for non-farm print | ^ | D3 Ax0d04 C1
| 0x0D03 3321 | uint8_t | EEPROM_FW_CRASH_FLAG | 01h 1 | ff/00 | Last FW crash reason (dump_crash_reason) | D21/D22 | D3 Ax0d03 C1
| 0x0D03 3321 | uint8_t | EEPROM_FW_CRASH_FLAG | ffh 255 | ffh 255 | Last FW crash reason (dump_crash_reason) | D21/D22 | D3 Ax0d03 C1
| ^ | ^ | ^ | 00h 0 | ^ | manual | ^ | ^
| ^ | ^ | ^ | 01h 1 | ^ | stack_error | ^ | ^
| ^ | ^ | ^ | 02h 2 | ^ | watchdog | ^ | ^
| ^ | ^ | ^ | 03h 3 | ^ | bad_isr | ^ | ^
| ^ | ^ | ^ | 04h 4 | ^ | bad_pullup_temp_isr | ^ | ^
| ^ | ^ | ^ | 05h 5 | ^ | bad_pullup_step_isr | ^ | ^
| Address begin | Bit/Type | Name | Valid values | Default/FactoryReset | Description | Gcode/Function| Debug code
| :--: | :--: | :--: | :--: | :--: | :--: | :--: | :--:

View File

@ -299,6 +299,15 @@ ISR(TIMER1_COMPA_vect) {
if (sp < SP_min) SP_min = sp;
#endif //DEBUG_STACK_MONITOR
#ifdef DEBUG_PULLUP_CRASH
// check for faulty pull-ups enabled on thermistor inputs
if ((PORTF & (uint8_t)(ADC_DIDR_MSK & 0xff)) || (PORTK & (uint8_t)((ADC_DIDR_MSK >> 8) & 0xff)))
pullup_error(false);
#else
PORTF &= ~(uint8_t)(ADC_DIDR_MSK & 0xff);
PORTK &= ~(uint8_t)((ADC_DIDR_MSK >> 8) & 0xff);
#endif // DEBUG_PULLUP_CRASH
#ifdef LIN_ADVANCE
advance_isr_scheduler();
#else

View File

@ -1683,6 +1683,16 @@ void adc_ready(void) //callback from adc when sampling finished
FORCE_INLINE static void temperature_isr()
{
#ifdef DEBUG_PULLUP_CRASH
// check for faulty pull-ups enabled on thermistor inputs
if ((PORTF & (uint8_t)(ADC_DIDR_MSK & 0xff)) || (PORTK & (uint8_t)((ADC_DIDR_MSK >> 8) & 0xff)))
pullup_error(true);
#else
PORTF &= ~(uint8_t)(ADC_DIDR_MSK & 0xff);
PORTK &= ~(uint8_t)((ADC_DIDR_MSK >> 8) & 0xff);
#endif // DEBUG_PULLUP_CRASH
if (!temp_meas_ready) adc_cycle();
lcd_buttons_update();

View File

@ -1848,6 +1848,11 @@ static void lcd_stack_crash()
}
#endif
#ifdef DEBUG_PULLUP_CRASH
void TestPullupCrash() {
PORTF |= 0x01;
}
#endif // DEBUG_PULLUP_CRASH
//! @brief Show Support Menu
//!
@ -2058,7 +2063,6 @@ static void lcd_support_menu()
#endif /* DEBUG_BUILD */
#endif //MK1BP
MENU_END();
}
@ -8976,6 +8980,10 @@ void lcd_experimental_menu()
MENU_ITEM_TOGGLE_P(_N("E-cool mode"), UserECoolEnabled()?_T(MSG_ON):_T(MSG_OFF), UserECool_toggle);////MSG_MENU_ECOOL c=18
#endif
#ifdef DEBUG_PULLUP_CRASH
MENU_ITEM_FUNCTION_P(_N("Test Pullup Crash"), TestPullupCrash);
#endif // DEBUG_PULLUP_CRASH
#ifdef PRUSA_SN_SUPPORT
MENU_ITEM_FUNCTION_P(_N("Fake serial number"), WorkaroundPrusaSN);////MSG_WORKAROUND_PRUSA_SN c=18
#endif //PRUSA_SN_SUPPORT

View File

@ -168,6 +168,8 @@
#define DEBUG_DCODE3
#define DEBUG_DCODE6
//#define DEBUG_PULLUP_CRASH //Test Pullup crash
//#define DEBUG_BUILD
//#define DEBUG_SEC_LANG //secondary language debug output at startup
//#define DEBUG_XFLASH //debug external spi flash

View File

@ -170,6 +170,8 @@
#define DEBUG_DCODE3
#define DEBUG_DCODE6
//#define DEBUG_PULLUP_CRASH //Test Pullup crash
//#define DEBUG_BUILD
//#define DEBUG_SEC_LANG //secondary language debug output at startup
//#define DEBUG_XFLASH //debug external spi flash

View File

@ -8,6 +8,8 @@ enum class dump_crash_reason : uint8_t
stack_error,
watchdog,
bad_isr,
bad_pullup_temp_isr,
bad_pullup_step_isr,
};
#ifdef XFLASH_DUMP