1.5k views
in GUI Development by

i have a simple program : 

a push button that if you press it it will highlighted and one LED will turn on then if you press it again it will get back to the default state.

so here is the problem when i press it a few times it wo'nt work again no matter how many times you press the button.

note that i'm using a stm32f746_discovery board

1 Answer

+1 vote
by

Hello,

here some ideas:

1. when you observe the problem, does the button still respond to touch events? Or maybe the entire system hangs?

2. Do you see any (error) messages on the console?

Best regards

Paul Banach

by
thanks for your response

actullay the entire system hangs and there is no error (or at least i don't see any error)
by

Hello,

What happens when you start some of the provided examples found in the build environment e.g. HelloWorld? Do they work?

Bst regards

Paul Banach

by
the examples work just fine.

but i use rcc & gpio function , could it be because of them?!
by
This of course is possible. To verify this, please comment out all respective code blocks. If the issue still persists, I hope my collegues responsable for HW aspects can bring more light into the dark.

Best regards

Paul Banach
by
when i don't use rcc and gpio it works

but i want to use them , is there anaything i should know about using them and gui at the same time ?!

and again thanks for your response
by
I suppose the problem is related to RCC. I asked my collegue, who understands better the STM HW to see this thread. I hope he can help us. In the meantime could you please check whether the  problem is realated to RCC or GPIO?

Best regards

Paul Banach
by
you're right the problem is related to RCC.

so here is my RCC configration code :

void SystemClock_Config(void)
{
  RCC_OscInitTypeDef RCC_OscInitStruct = {0};
  RCC_ClkInitTypeDef RCC_ClkInitStruct = {0};

  /** Configure the main internal regulator output voltage
  */
  __HAL_RCC_PWR_CLK_ENABLE();
  __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1);
  /** Initializes the CPU, AHB and APB busses clocks
  */
  RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI;
  RCC_OscInitStruct.HSIState = RCC_HSI_ON;
  RCC_OscInitStruct.HSICalibrationValue = RCC_HSICALIBRATION_DEFAULT;
  RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
  RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSI;
  RCC_OscInitStruct.PLL.PLLM = 8;
  RCC_OscInitStruct.PLL.PLLN = 216;
  RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2;
  RCC_OscInitStruct.PLL.PLLQ = 9;
  if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
  {
    Error_Handler();
  }
  /** Activate the Over-Drive mode
  */
  if (HAL_PWREx_EnableOverDrive() != HAL_OK)
  {
    Error_Handler();
  }
  /** Initializes the CPU, AHB and APB busses clocks
  */
  RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK
                              |RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2;
  RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
  RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
  RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV4;
  RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV2;

  if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_7) != HAL_OK)
  {
    Error_Handler();
  }
}
by
Hi there,

 

I have just read the comments above and got one question.

What exactly do you mean with "but i use rcc & gpio function"?

RCC is an HAL functionality to provide easy setup of the clock configuration. Normally all RCC settings do not have any relations to GPIO's except of when you are using HSE as source. In our standard build environment we are using the external clock source (HSE). So, to be sure that the RCC configuration cause this problem, could you please try to switch to an HSE initialisation.

Therefore I recommend to use the code within "SystemClock_Config( void )" of a new downloaded Embedded Wizard Build Environment. If the problem then will gone away, I recommend to use ST's documentation about how to configure the RSI clock source correctly.

 

I hope this helps.

 

Kind regards

 

Tim
by
hello

actullay it helps , thanks for your answer .

Ask Embedded Wizard - Archive

Welcome to the Ask Embedded Wizard archive. This community forum served us well for many years, but we've evolved our support approach!

Your resources:

The Embedded Wizard Online Documentation provides comprehensive documentation, tutorials, examples and ready-to-use software packages.

For dedicated assistance, explore our Embedded Wizard Product Support.

You can still browse the valuable discussions from our community history here.

Embedded Wizard Website | Privacy Policy | Imprint

...