Skip to main content
ricardomiguel
Associate II
May 10, 2017
Question

Problems with custom board at FLASH->ACR access

  • May 10, 2017
  • 5 replies
  • 1812 views
Posted on May 10, 2017 at 15:29

Hi all,

we are working on our second custom boardfor our product, using STM32F446RET6 MCU, 8MHz HSE and 746Hz LSE external crystals. From the first board to this one the only difference it's that all needed chips are integrated in one PCB, instead of having 3 PCBs connected with wires in the first version.

Debugging the first board is fast and works. On the second one it takes 20-30 seconds to stop in the main breakpoint or just fails silently. When it runs, it triggers a hard fault on this instruction (line 2):

// stm32f4xx_hal_rcc.c:HAL_RCC_ClockConfig�?�?
if(FLatency < (FLASH->ACR & FLASH_ACR_LATENCY)) // HARD FAULT HERE!!!
 { 
 /* Program the new number of wait states to the LATENCY bits in the FLASH_ACR register */
 __HAL_FLASH_SET_LATENCY(FLatency);
/* Check that the new number of wait states is taken into account to access the Flash
 memory by reading the FLASH_ACR register */
 if((FLASH->ACR & FLASH_ACR_LATENCY) != FLatency)
 {
 return HAL_ERROR;
 }
 }�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?

Looking at the

https://paste.ofcode.org/336un8t6JR3cwVmvsdeKUux

I see a

UNDEFINSTR error, with the PC register loaded with the instruction on line 2 (above).

Do you have any idea on what can be happening?

EDIT

https://www.diffchecker.com/QVY6Ocfg

of the OpenOCD output when using the newest board (on the left) and the oldest one (on the right). Shouldn't the line 51 (below) be the same for the same .elf file? If it should, what can be causing this?

xPSR: 0x01000000 pc:

0x1fff503a

msp:

0x20002af8

https://community.st.com/people/meyer.frank.001

‌ -Power source stays constant at 3.4V

https://community.st.com/people/Turvey.Clive.002

‌ - if the FPU or clock speed werethe problem shouldn't it be happening in both boards? Both crystals work at the expected frequency.
    This topic has been closed for replies.

    5 replies

    Tesla DeLorean
    Guru
    May 10, 2017
    Posted on May 10, 2017 at 15:36

    Your description of the system and problem aren't very enlightening.

    Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
    ricardomiguel
    Associate II
    May 10, 2017
    Posted on May 10, 2017 at 15:42

    I posted it first on error, it was incomplete while I was editing it

    AvaTar
    Senior III
    May 10, 2017
    Posted on May 10, 2017 at 15:50

    I agree with Clive, not much information to chew on.

    Perhaps a power supply issue (PCB or components related) ?

    Tesla DeLorean
    Guru
    May 11, 2017
    Posted on May 11, 2017 at 13:25

    The PC of 0x1FFFxxxx suggests you don't have BOOT0 pulled low on the board.

    Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..