Hello,
I got difficulties with the Keil µVision 4 IDE. I'm using the ST Discovery-Board (STM32F407VG) and want to use the Discovery-Board as an I2C-Master. I got a working CooCox-project, but now I have to migrate it to Keil µVision 4.
When I create a new project (in µVision 4) I'm able to communicate with the board (I did some blinky-programs successfully). Problem seems to be the correct usage of libraries/ errors from the linker.
My working CooCox-project is derived from this example: ").
This project has main.c/.h and stm32_ub_i2c1.c/.h with I2C-functions. Other embedded code in the CooCox-project: stm32f4xx.c/.h stm32f4xx_gpio.c/.h stm32f4xx_rcc.c/.h stm32f4xx_i2c.c/.h
Thank you for your help.
Best Regards, Ilyas
First of all: thanks to all of you for your answers. I added the comment "/* this is line 67 of stm32f4xx.h */" in the code, I'm sorry. It was my mistake.
The hint with the macros and various derivations of the STM32F4 Discovery-Board made me think. In µVision 4 you have to choose your device in the "Target Options". This was the setting I checked the whole time, it was always right with stm32f407vg. But: There's an additional drop-down menu in the options where you have to select the correct target as well. That offers just 4 options: STM32F429_439xx; STM32F427_437xx; STM32F40_41xx and STM32F401xx. (I never really expected a second target-selection-menu ...).
So with the first setting on "stm32f407vg" and the second on "STM32F40_41xx" it compiles with 0 errors and some (37 warnings), most of them are like >..\..\..\Libraries\CMSIS\Device\ST\STM32F4xx\Include\stm32f4xx.h(88): warning: #47-D: incompatible redefinition of macro "STM32F40_41xxx"<. The other 3 options of the second drop-down-menu generate 37 errors (as before).
So now I got it compiled (second setting on "STM32F40_41xx", but when trying to load the code to the board it says "Unknown target connected" and "Error: Flash Download failed - Target DLL has been cancelled". I got the Discovery-Board connected via ST-Link to my PC (device manager doesn't show any issues with the device). Which settings do I have to change or does the project not support this board?!
Greetings, Ilyas
I missed the fact, that I selected the ST-Link in the properties of the project. So what might be wrong here?
Ilyas
Did you also select the ST-Link in the Utilities tab for Flash Download (Options for Target)?
I now got a working connection with µVision 4 to the Discovery Board. You have to select the ST-Link Debugger in the "Debug"-Tab of the project-settings. But with just this (as I tried it) is not the whole story. Additional you have to configure the ST-Link Debugger to use "SW" as port instead of JTAG and then select the ARM CoreSight device. Note that you have your Discovery-Board plugged in, otherwise it won't display the ARM CoreSight device.
At the moment, I got a working connection to the board and an example project (Template project). Now I have to transform the code from the CooCox-project to µVision 4. What do I have to consider? I'll report back in about 2 hours, I didn't had the opportunity to move the CooCox project till now.
Hi there,
sorry that I am late with my answer, but something in life didn't go as intended. So now I added the code from the CooCox-project into the µVvision 4 project and tried to compile. I was quite happy that all libraries seem to fit. I got a connection to the board, so I can transmit the code. But When starting debugging, it doesn't start code execution.
The LED of the ST-Link blinks red, green, red, etc... when I hit start debugging and keeps blinking. (If everything is fine, the LED blinks for some seconds and stays green then.) Is that a sign of a problem within the start-up of the CPU and how can I solve the issue?
solution to the startup problem was to remove the startup-function of the CooCox IDE (which was still in the code) and replace it with the startup procedure of the example-project for the MDK-ARM IDE.
So now the program runs with KEIL µVision 4. :-)
Thanks to all of you for your contribution. If you want a ZIP-folder of the project, please let me know.