What scared me off was all the multitude of problems people have! like remapping the peripherals etc etc! but my main argument is I want to learn how to program properley, Arduino IDE is really good for getting started but its so simplified and I think the Maple IDE is just the same good for beginners but a lot more to learn
Sorry, so far I have only got as far as changing the loaded program with one that makes the leds come on and stay on. I still have plenty to learn about the language for Atollic and STM32.
Some people on LeafLabs forum have made a Maple IDE port to the STM32F4 discovery but, I have not figured out how to use it. The Maple IDE is a based on Arduino IDE but, the hardware makes programming a little different in some cases.
Well I have not given up!, I have tried Coocox CoIDE with no luck but I have had some success with Attolic True Studio, pretty straight forward process once you know what options to set etc.
So I first started uploading a program that just turned the four LEDs on and after lots of messing about I have this very basic program
#include "stm32f4_discovery.h"
int T=1000000;
GPIO_InitTypeDef GPIO_InitStructure;
void Delay(__IO uint32_t nCount);
int main(void)
{
/* GPIOD Periph clock enable */
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOD, ENABLE);
/* Configure PD12, PD13, PD14 and PD15 in output pushpull mode */
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_12 | GPIO_Pin_13| GPIO_Pin_14| GPIO_Pin_15;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
GPIO_Init(GPIOD, &GPIO_InitStructure);
while (1)
{
/* PD12 to be toggled */
GPIO_SetBits(GPIOD, GPIO_Pin_12);
/* Insert delay */
Delay(T);
/* PD13 to be toggled */
GPIO_SetBits(GPIOD, GPIO_Pin_13);
/* Insert delay */
Delay(T);
/* PD14 to be toggled */
GPIO_SetBits(GPIOD, GPIO_Pin_14);
/* Insert delay */
Delay(T);
/* PD15 to be toggled */
GPIO_SetBits(GPIOD, GPIO_Pin_15);
/* Insert delay */
Delay(T);
GPIO_ResetBits(GPIOD, GPIO_Pin_12);
Delay(T);
GPIO_ResetBits(GPIOD, GPIO_Pin_13);
Delay(T);
GPIO_ResetBits(GPIOD, GPIO_Pin_14);
Delay(T);
GPIO_ResetBits(GPIOD, GPIO_Pin_15);
Delay(T);
GPIO_SetBits(GPIOD, GPIO_Pin_15);
Delay(T);
GPIO_SetBits(GPIOD, GPIO_Pin_14);
Delay(T);
GPIO_SetBits(GPIOD, GPIO_Pin_13);
Delay(T);
GPIO_SetBits(GPIOD, GPIO_Pin_12);
Delay(T);
GPIO_ResetBits(GPIOD, GPIO_Pin_15);
Delay(T);
GPIO_ResetBits(GPIOD, GPIO_Pin_14);
Delay(T);
GPIO_ResetBits(GPIOD, GPIO_Pin_13);
Delay(T);
GPIO_ResetBits(GPIOD, GPIO_Pin_12);
Delay(T);
}
}
void Delay(__IO uint32_t nCount)
{
while(nCount--)
{
}
}
I can upload the code and alter the delay value T, the great thing with attolic is I can debug the program and single step through which is a massive help for me to learn how a C program runs in fact this has learnt me a lot
Any other noobs need help getting this going just drop me a message and I will do my best to help, its taken me about 5 days reading and playing
I have lots of questions
void Delay(__IO uint32_t nCount)
{
while(nCount--)
{
}
}
Can anyone explain what this part does?
uint32_t is an unsigned 32 bit Int, I know what a while loop does but I dont get what that does in the code
GPIO_InitTypeDef GPIO_InitStructure;
What about this one any explanations?
Finally for today
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_12 | GPIO_Pin_13| GPIO_Pin_14| GPIO_Pin_15;
I see this a lot | its the Or command yeah?, whats it do in the above line?
Many thanks for looking