Bad F407 Mcu ?¶
There is a problematic MCU used in the very early STM32F407 Discovery Boards which causes Mecrisp-Across to throw an exception when flashing the MSP430 Target.
Otherwise, Mecrisp-Across works fine in host and target mode, and the compiled image can be flashed to the target using a MSP-EXP430G2 Board.
This problem MCU was mentioned here in 2015: https://www.mikrocontroller.net/topic/359690 and experienced by User Maciek with Mecrisp-Across.
From 2015 ChibiOS (hal_lld.c)
#if defined(STM32_USE_REVISION_A_FIX)
/* Some old revisions of F4x MCUs randomly crashes with compiler
optimizations enabled AND flash caches enabled. */
if ((DBGMCU->IDCODE == 0x20006411) && (SCB->CPUID == 0x410FC241))
Problem MCU¶
DBGMCU_IDCODE == $20006411
Note
This is best read on chip with Mecrisp-Stellaris (as below) because eternal readers like ST-Link have given inconsistent values on a bad board.
Detection Program¶
This program can be run on any F4 Disco Board running Mecrisp-Stellaris, or Mecrisp-Across in HOST mode only. It should give the “OK” or alert the board has the problem MCU.
Note
tested on a problem board, but works on a good board.
Code¶
\ ------------------------------------------------------------
\ Program Name: badf407?.fs
\ Date: 10 March 2022
\ Copyright 2022 T.Porter licensed under the GPL
\ For Mecrisp-Across by Matthias Koch
\ http://mecrisp.sourceforge.net/ features:
\ chip: STM32F407
\ Documents: see section 33.6.1 MCU device DBGMCU_IDCODE in Reference manual RM0090
\ and PM0215, section: 4.3 System control block (SCB)
\ Aim: Detect bad early silicon version that crashes when Mecrisp-Across tries to flash the Target
\
\ Note: on Mecrisp-Across, run this in HOST mode only.
\ ------------------------------------------------------------
hex
$E0042000 constant DBGMCU_IDCODE \ good 10016413 ; bad 20006411
$E000ED00 constant SCB_CPUID \ STM32F407 = 410FC241
: bad-f407? ( -- ) \ can it run Mecrisp-Across without crashing when flashing the target ?
cr
SCB_CPUID @ $410FC241 =
if ." Chip is a STM32F405xx/07xx or STM32F415xx/17xx "
else ." WRONG MCU MODEL ! " quit
then cr
DBGMCU_IDCODE @ dup 10016413 =
if ." Known good DBGMCU_IDCODE, MCU works with Mecrisp-Across ."
else $20006411 =
if ." Known BAD DBGMCU_IDCODE, this STM32F407 MCU may CRASH Mecrisp-Across."
else ." Unknown DBGMCU_IDCODE, probably works with Mecrisp-Across, only testing will confirm ."
then
then
;
decimal
Running the Test Program¶
To run, enter:
bad-f407?