Getting Started with STM32F407 and Atollic trueSTUDIO

Thread Starter

sakciit

Joined May 24, 2019
8
Hello Mr Chips, I am very glad to see your discussion regarding the STM32F4, I am also a newbie to this and i am having too many problems.
1st one is i have installed the latest cubeMX and AtollicTrueStudio, i followed your discussion and i was able to run the code for blinking LED, it was good, But there are no guide or notes for learning programming syntax. As you wrote a condenesed code in one reply, that works pretty well but i could not understand it. i want to have enough understanding, that i can toggle a pin based on a condition, and i can chose any pin. but it seems to be difficult as i just started today.
2nd is i read online in many articles that using CubeMX is very user friendly, but i also cannot run a program using that as well, as i followed different tutorials but they were old and i am using a new controller STM32F407 with all latest softwares as of today.
So please if you could either guide me how can i directly program using TrueStudio or using CubeMX with truestudio.
 

Thread Starter

sakciit

Joined May 24, 2019
8
Dear MrChips, Thank you for your replies.
Actually the problem is that as i mentioned previously that i am very new to this type of board, and the configuration looks very different to me from aurdino.
As for arduino one can find syntax for any function almost but this case is different i guess. At first i wanted to use direct programming approach, because i have basic knowledge of c++, and i though it would be easy for me, i also tried cubeMX as i have read in your threads that they are very user friendly. My target is to generate a PWM signal which will be depended on an input. as the input will change, the PWM will change accordingly, so first of all is that even possible on this board?
Second is that i am trying to use cubeMX, i follow steps for blinking led source:
but the when i generate code from cubeMX and debug it in atollic studio, nothing happens, i looked carefully for the pin configurations, but may be i think i also make a mistake there too. In the video the user write 2 lines of code for blinking led, and select pin 5, but when i change the pin to 60, the program shows error and does not build. I have attached screenshots, Please have a look. Thank you again.
 

Attachments

Last edited by a moderator:

MrChips

Joined Oct 2, 2009
19,768
I will use the other thread to discuss Getting Started with STM32CubeIDE.

We will continue dealing with your specific problem here on this thread.
 

Thread Starter

sakciit

Joined May 24, 2019
8
Dear Mr Chips, I have done the blinky LED project, and its working fine. i have also connected oscilloscope to see the output at pins and its working too. But now i have to focus on my project, and i could not find any helpful material which can help me in my case. Generating PWM signal and changing it.Please let me know. thanks
 

Thread Starter

sakciit

Joined May 24, 2019
8
  1. #include "stm32f4_discovery.h"


  2. GPIO_InitTypeDef GPIO_InitStructure;

  3. #define LED_PORT GPIOD
  4. #define RED_LED GPIO_Pin_5
  5. #define DELAY 1000000

  6. void delay( unsigned long d)
  7. {
  8. while(--d);
  9. }

  10. void Init(void)
  11. {
  12. RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOD, ENABLE);
  13. /* Configure PD5, PD12, PD13, PD14 and PD15 in output pushpull mode */
  14. GPIO_InitStructure.GPIO_Pin = GPIO_Pin_5 | GPIO_Pin_12 | GPIO_Pin_13| GPIO_Pin_14| GPIO_Pin_15;
  15. GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
  16. GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
  17. GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;
  18. GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
  19. GPIO_Init(GPIOD, &GPIO_InitStructure);
  20. }

  21. void main(void)
  22. {
  23. Init();
  24. while (1)
  25. {
  26. GPIO_SetBits(LED_PORT, RED_LED);
  27. delay(DELAY);
  28. GPIO_ResetBits(LED_PORT, RED_LED);
  29. delay(DELAY);
  30. }
  31. }

Mr chips, this condensed code from the previous thread, do you any guide for coding like this? how to start and select io pins, then apply conditions? this looks easy as compared to other methods. I am just guessing, you know better..
 

MrChips

Joined Oct 2, 2009
19,768
To answer your question, the proper way to generate PWM is to use a hardware timer.
At this stage, you have already encountered three different platforms:

1) Atollic TrueSTUDIO + CubeMX
2) STM32CubeIDE which replaces (1) above
3) Mbed

Is your problem resolved?
Are you finished with this thread?
 
Top