cancel
Showing results for 
Search instead for 
Did you mean: 

stm32f407 delay problem

bnymntrz
Associate III

Hi, I am using the stm32f407 card and I am developing keilda software but when I compile it does not fail but the delay does not work and I would be glad if you could help what could be the reason.

6 REPLIES 6
S.Ma
Principal

Please elaborate, some of us aren't telepaths.

Compilers detect syntax errors, not logic errors.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
bnymntrz
Associate III
I'm sorry I have to write on the line of code, but when I write to the answer block, it wipes out what I write. Thank you for writing my question, but the delay doesn't do the job. I know that the compiler only extracts the syntax error, but when I load the program, I don't get the pending wait.

Ok, but in order to understand the issue I'd need to actually see some code..

What OS/Browser are you using?

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
#include "stm32f4xx.h"                  // Device header
#include "stm32f4xx_gpio.h"             // Keil::Device:StdPeriph Drivers:GPIO
#include "stm32f4xx_rcc.h"              // Keil::Device:StdPeriph Drivers:RCC                             
#include "RTE_Device.h"                 // Keil::Device:Startup
 
 
 
 
 
 
 
 
 
void delay(uint32_t time){
	
 	while(time>0){
	time--;
	}
}
 
	int main(){
		
	                            GPIO_InitTypeDef APORT;
                              GPIO_InitTypeDef DPORT;
	                           
                         
	                        
		        
	
	      
        RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOA,ENABLE);
        RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOD,ENABLE);
      
	    
	
	      DPORT.GPIO_Mode = GPIO_Mode_OUT;
	      DPORT.GPIO_OType = GPIO_OType_PP;
	      DPORT.GPIO_Pin = GPIO_Pin_All;
	      DPORT.GPIO_PuPd = GPIO_PuPd_NOPULL;
	      DPORT.GPIO_Speed = GPIO_Speed_100MHz;
	      GPIO_Init(GPIOD,&DPORT);
		
	      APORT.GPIO_Mode = GPIO_Mode_OUT;
	      APORT.GPIO_OType = GPIO_OType_PP;
	      APORT.GPIO_Pin = GPIO_Pin_8| GPIO_Pin_9;
	      APORT.GPIO_PuPd = GPIO_PuPd_NOPULL;
	      APORT.GPIO_Speed = GPIO_Speed_100MHz;
	      GPIO_Init(GPIOA,&APORT);
 
     
 
	         
          while(1)
 
					
            {
							
					  GPIO_SetBits(GPIOD, GPIO_Pin_12);
	          delay(20000);
             	 GPIO_ResetBits(GPIOD, GPIO_Pin_12);
						}
	
 
 
 
 
I am using win10 as the operating system.
most simply I've run this code for trial purposes but the delay is not working.

S.Ma
Principal

The compiler will simplify your code and remove things detected as useless. Add an asm("nop;"); in your loop, or disable the compiler optimisations...