5

I'am using IAR Workbench and I am having hard time to flash my STM32F407VG I got:

FATAL error ST-Link No MCU device found.

  • The USB cable connecting the laptop and the MCU is new so I don't think it's the problem.
  • ST-Link en.stsw-link009 is installed

When I go to project options Debugger > ST-Link > Reset > connect during reset and try to download again I got:

Warning stack pointer is setup to incorrect alignement stack addr = 0x00000016 after the download progress bar stay blocked.

By navigating in the option menu I find it's possible to adjust CPU frequency actually it's 72 MHz, the default one, I changed it to 168 MHz, the CPU frequency but the problem remains.

Could you please suggest me some solutions to debug/resolve the problem.

Edit

I have used STM32 ST-Link Utility and i succeded to connect to the board, But the problem with my IDE is not resolved yet.

too honest for this site
  • 12,050
  • 4
  • 30
  • 52
Mouin
  • 1,025
  • 4
  • 19
  • 33
  • You forgot to mention what IDE you are using. Project options: Debugger does not tell a lot, what project. Guessing from the MCU you are using an STM32F4 Discovery board, or is it a custom board? To simply verify if you can connect to the chip I suggest to use [STM32 ST-Link Utlity](http://www.st.com/en/embedded-software/stsw-link004.html). – Bence Kaulics Oct 23 '16 at 11:47
  • @BenceKaulics Thank you for the feedback, i'am using IAR Workbench Yes i have used STM32 ST-Link Utility and i succeded to connect to the board. This is why i'am not sure to undrestand from where the problem come – Mouin Oct 23 '16 at 13:32
  • Do you have a file called something like `stm32f407xx_flash.icf` in your project? – Bence Kaulics Oct 23 '16 at 14:14
  • Yes i have this file in the project – Mouin Oct 23 '16 at 19:35
  • Then first check your warning. There should be a line `define block CSTACK with alignment =` . Now, I suppose it is equal 16 in your case. Is that correct? – Bence Kaulics Oct 23 '16 at 19:42
  • I have an IAR EWARM project generated by [STM32CubeMX](http://www.st.com/en/development-tools/stm32cubemx.html) (I have never used IAR by the way) for an STM32F407VG (F4 Discovery) and it has the following line: `define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { };`. And for the heap: `define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { };`. – Bence Kaulics Oct 23 '16 at 19:47
  • Here is the whole file: http://pastebin.com/uMsYkWyD – Bence Kaulics Oct 23 '16 at 19:51
  • [This is mine](http://pastebin.com/vzYeVmXe) it's also 8 in my case, by the way i have tried to download the image in a friend's board and it succeed so the problem is from the board itself but one may ask why it's connecting using ST-Link utility, does that mean that the bootloader is corrupted or smth like that, how to know and how to correct ? – Mouin Oct 23 '16 at 20:39
  • Note: You don't download, but upload. But even many (self-called) "experts" don't get this simple concept right. – too honest for this site Oct 24 '16 at 16:27
  • @Olaf Actually Yes, but even in some IDE the operation is called "Download" – Mouin Oct 24 '16 at 17:12
  • @Mouin: I think I wrote something about "experts" (mind the `\"`). – too honest for this site Oct 24 '16 at 17:13

1 Answers1

3

I used ST-Link Utility to erase flash memory, once this is done i activated

Debugger > ST-Link > Reset > connect during reset

and all works well, i don't know why but i'am glad to see my board works again

Thank you for your help

Mouin
  • 1,025
  • 4
  • 19
  • 33