Hello, I am using Nucleo L476RG board and I am facing a problem in downloading code in board using Flash programmer in Keil IDE. I compile the project successfully and when I click on Load Button, I get following errors : First Windows says:
Cannot Load Flash Programming Algorithm! C:\Keil_v5\PACK\Keil|STM32L4xx_DFP\2.2\CMSIS\Flash\STM32L4xx_1024.FLM
Second Window says:
Error: Flash Download Failed – “Cortex – M4”
If I wish to start debug session then same error occurs.
I checked the above mentioned folder and it sure contains the above specified .FLM file. Under Options->Debug-> STLink Debugger is selected. Further down in Settings, under Connect I have tried “under reset” and “Normal” both. Both result in same failure. Further down in Flash Download window- Erase sector, Program, verify, Reset & Run all 4 are checked.
Programming algorithm shows two files: STM32L_4xx 1MB Flash 1M STM32L_4xx dual bank Flash 36B with address starting 0x0800 0000H for on chip Flash and RAM for algorithm starting at 0x4000 0000.
I tried after removing second file and only with first one but no effect, the error persists.
The Pack installer software for NUCLEO-L476RG (Rev.C) shows all necessary packs “up to date”.
The 476 board is working fine with LED blink project directly downloaded as a file from mbed online compiler. STLinkV2.1 is working fine. The same Keil IDE and debugger is working fine with Nucleo 401 board so Keil IDE seems OK.
Please help to resolve.
The path looks wrong, or incorrectly pasted. Delete BOTH algorithms Reselect the TARGET CPU Select the L4 1MB FLASH again
Using this one here, successfully CMSIS\Flash\STM32L4xx_1024.FLM
Thanks for your suggestion.
1. I do not know where to set the path correctly. As per the error message, it seems that it is not able to either see the file or read it. I inserted the path to .FLM file in C/C++tab's inclue path field, but no success.
2. Earlier I was using only 1 algorithm, as set by the device selection, automatically by mbed. When it did not work, I added socond algorithm.
3. I removed both algorithms, added the standard program named STM32L4xx 1MB Flash. Even then the error persists.
4. The device selected is STM32L476RGTx. I guess I can not deselect it. I selected something else and reselected that in Device tab.
5. I also have this 15 KB .FLM file in this location - CMSIS\Flash\STM32L4xx_1024.FLM. In fact I opened the file in notepad to see that it is not empty or corrupted, it seems full of text.
This seems like 476 specific issue. Can anybody give me some more suggestions please?
It could be related to how Keil was installed, and where you told it to store the packs. I've used the NUCLEO-L476RG on this system C:\Keil5xx\ARM\PACK\Keil\STM32L4xx_DFP\2.2.0\CMSIS\Flash
Try a clean install on a different system
Hello Prakash,
I assume you are using the latest versions of the Keil tools for Arm from Keil.com/demo
If so, there are CMSIS-PACK examples for the Nucleo-L476RG board
Open the Pack installer, C:\Keil_v5\uv4\PackInstaller.exe
- On the top left of the window, select the yellow "Boards" tab. - For "Search", type "Nucleo-L476RG" - the list below gets filtered. - Select the board(entry with a green icon) from the list below – on the right side of the dialog updates with Software Packs relevant to this device - For "Packs", install the Keil:STM32L4xx_DFP pack (if necessary) - Also install the Keil::STM32Nucleo_BSP pack (if necessary) - On the top right of the screen, select the yellow "Examples" tab. - On the "Blinky (Nucleo-L476RG)" row, click the "copy" button - a dialog pops up. - Pick a directory, click both the check boxes, and press OK - a new Keil µVision session opens with the example. - Build the project, Connect a USB cable to the board and start the debugger
... If it works, compare this project's settings to yours.
======
See also - The Getting Started guide at http://www.keil.com/gsg - Learning page http://www.keil.com/learn - Creating applications at http://www.keil.com/support/man/docs/uv4/uv4_ca_packinstaller.htm
Thanks Kevin,
Your suggestion was most helpful. I created/copied blinky project from software pack, built it and successfully downloaded it in RAM and later in flash. It also worked well in debugger.
I noted a few differences between the settings in this project and the project exported by mbed. I would list them separately. However, even after making mbed project's settings identical to Keil's example project, the flash programming refused to work and there was the same error.
I noticed a couple of anomalies which may point to the actual bug. They are:
1. when I open an mbed exported project, the include statement - #include "mbed.h", it has a red cross marked on its left most column. When I hover the cursor over that, I get a balloon message - error in include chain (mbed_assert.h):invalid token at the start of preprocessor expression.
2. When the project is opened in Keil, in the Build Output Window, following warning is shown: Warning#440: Requested device 'STM32L476RG' is substituted with variant 'STM32L476RGTx' for target '476_Nucleo_pwm'.
3. First time when I build the project the linker fails saying that it could not find the required scatter file. Then I selected the Linker tab and corrected the exact path of scatter file. Then it compiled successfully. This has happened in 3 different projects, each time. This never happened in 401 board.
To me it appears that the mbed platform for Nucleo 476 board is not prefectly supported in Keil and this is causing the issues.
Any suggestions how to pinpoint the bug?
Thanks to all for helping me understand it better.
Keil MDK v5 and later uses Device Family Packs (DFP) from the Silicon vendor to maintain our device database.
If you go to http://www.keil.com/dd2/pack/#/ and expand the pack for the STM32L4 you can see the revision history. As you can seen, ST modified their naming conventions for their devices in their packs.
The mbed export tool must not be using the latest conventions.
You can go to Project -> Options For Target -> Device tab, and choose the correct device that uses the modern naming conventions .
See also:
http://www.keil.com/support/docs/3772.htm