2017-02-09 03:12 AM
Hi, I'm beginner and I started by a blink project using SW4STM32 along with STMCubeMx libraries set up for my board which is the STM411RE board.
It works well using the following lines in the main while loop:
HAL_GPIO_TogglePin(LD2_GPIO_Port,LD2_Pin);
for(int i=0;i<14200000;i++);but It doen't work when I tried to replace the for statment: for(int i=0;i<14200000;i++); by a function declared above the main{}
like:
void tempo(void){
for(int i=0;i<14200000;i++);}This is really simple but I'm stuck here.
I got another problem with the printf statemenent that doesn't do anything. Don't know if this is correlated to it but it seems that there is something wrong on the configuration of Eclipse or missing I guess.
ps: I have include stdio.h on top of the program.
Thanks for your help
#sw4stm32-eclipse2017-02-09 09:24 AM
Yes Sirma, I used Stm32CubeMx to generate the code and the code works (led is blinking) if I only place the following statement in the main{} > while loop:
While(1){
for(int i=0;i<14200000;i++);
HAL_GPIO_TogglePin(LD2_GPIO_Port,LD2_Pin);
}
2017-02-09 09:30 AM
Hello,
Instead of writting HAL_GPIO_TogglePin(LD2_GPIO_Port,LD2_Pin);
could you try HAL_GPIO_TogglePin(GPIOA, GPIO_PIN_5); ?
Kind regards
Sirma
2017-02-09 09:42 AM
For the printf problem, you have to add some shim code.
Read this:
http://embedded.fm/blog/2016/12/13/discovery-uarts-part-3-the-final-step
Andrei.
2017-02-09 10:54 AM
Ok, Upgraded to 1.13.1 then changed the Linker flags to-> -specs=nosys.specs -specs=nano.specs -specs=rdimon.specs -lc -lrdimon
Still no 'hello world' on the console after running the program.
Instead I got these log messages:
** Programming Finished **
** Verify Started **stm32f4x.cpu: target state: haltedtarget halted due to breakpoint, current mode: Thread xPSR: 0x61000000 pc: 0x2000002e msp: 0x20020000verified 8220 bytes in 0.784075s (10.238 KiB/s)** Verified OK **** Resetting Target **Info : Unable to match requested speed 2000 kHz, using 1800 kHzInfo : Unable to match requested speed 2000 kHz, using 1800 kHzadapter speed: 1800 kHzshutdown command invoked2017-02-09 11:34 AM
Ok. I check that and I'll get back to you soon.
Thanks you all
2017-02-09 11:35 AM
Yes It's the same...
2017-02-10 03:28 AM
Hello
lievre.gilles
,> changed the Linker flags to-> -specs=nosys.specs -specs=nano.specs -specs=rdimon.specs -lc -lrdimon
Is only the first step of the procedure.
Please confirm you have followed the full tutorial.
Olivier
2017-02-12 09:56 AM
Ok It finally works even though there is no syscalls.c file in my project.
2017-02-12 01:31 PM
Nice blog! I read all of it.Great Info. Do you mean it'll works for the SW4STM32 IDE as well since it uses also GCC compiler? Have you ever tried this IDE?
Thanks
2017-02-12 04:12 PM
excellent background music to work to:
https://www.youtube.com/watch?v=8qrhRtjFlpo
(moby seems a little slow)