Skip to content

Commit

Permalink
fix: TLite V2 is using another MCU (#3789)
Browse files Browse the repository at this point in the history
* fix: TLite V2 is using another MCU

* fix: exclude MCU check from bootloader

* chore: add explanation comment

* fix : comment in wrong place
  • Loading branch information
3djc authored Jul 12, 2023
1 parent efd580e commit c5aa250
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion radio/src/opentx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,15 @@ void toggleLatencySwitch()

void checkValidMCU(void)
{
#if !defined(SIMU)
#if !defined(SIMU) && !defined(BOOT)
// Checks the radio MCU type matches intended firmware type
uint32_t idcode = DBGMCU->IDCODE & 0xFFF;

#if defined(RADIO_TLITE)
#define TARGET_IDCODE_SECONDARY 0x413
// Tlite ELRS have a CKS F4 run as an F2 (F4 firmware won't run on those)
#endif

#if defined(STM32F205xx)
#define TARGET_IDCODE 0x411
#elif defined(STM32F407xx)
Expand All @@ -116,10 +121,16 @@ void checkValidMCU(void)
#define TARGET_IDCODE 0x0
#endif

#if defined(TARGET_IDCODE_SECONDARY)
if(idcode != TARGET_IDCODE && idcode != TARGET_IDCODE_SECONDARY) {
runFatalErrorScreen("Wrong MCU");
}
#else
if(idcode != TARGET_IDCODE) {
runFatalErrorScreen("Wrong MCU");
}
#endif
#endif
}

void per10ms()
Expand Down

0 comments on commit c5aa250

Please sign in to comment.