Author Topic: STM32F407 Discovery  (Read 12555 times)

0 Members and 1 Guest are viewing this topic.

Offline CM800Topic starter

  • Frequent Contributor
  • **
  • Posts: 882
  • Country: 00
STM32F407 Discovery
« on: December 10, 2014, 12:36:28 pm »
Heya,

A while back I brought an STM32F407 Cortex M4 Discovery board

I can't find any decent tutorials that are up to date and work.
Does anyone have any good links to tutorials? Just somthing like a simple blink would be a good starter. I don't have too much experiance with microcontrollers other then arduino.

Thanks!

EDIT:

I have already tried CooCox's IDE but I can't seem to figure out config properly. I really need some kind of starting tutorial to get to understand these things.
« Last Edit: December 10, 2014, 05:15:41 pm by TCWilliamson »
 

Offline AndreasF

  • Frequent Contributor
  • **
  • Posts: 251
  • Country: gb
    • mind-dump.net
Re: STM32F407 Discovery
« Reply #1 on: December 10, 2014, 10:05:19 pm »
I've been using the CooCox IDE with this Discovery board, and I agree, it's not as easy for a beginner. But there are a few resources out there that will help. One thing that may not be obvious is that CoIDE alone is not enough. You also need the ARM compiler and the ST-LINK utility from STM to program and debug the board. This is reasonably well explained here and also in this . Both are slightly outdated and for a different Discovery board, but should help get you started.

On my own blog I have a few post about some of the peripherals, including some things that are not obvious to users of smaller micros (e.g. having to explicitly turn on clocks for peripherals including the GPIO's - the video talk about this too).
my random ramblings mind-dump.net
 

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8221
  • Country: 00
Re: STM32F407 Discovery
« Reply #2 on: December 11, 2014, 12:11:01 am »
A big fan of CoIDE too.

The set-up is super easy and tons of context-sensitive examples to get you going in no time.
================================
https://dannyelectronics.wordpress.com/
 

Offline CM800Topic starter

  • Frequent Contributor
  • **
  • Posts: 882
  • Country: 00
Re: STM32F407 Discovery
« Reply #3 on: December 11, 2014, 03:50:19 pm »
Thanks for the help everyone. It's a bit of a pain as I'm going off out of home for a week. But you will hear from me later if its working or not :)

 

Offline pyrohaz

  • Regular Contributor
  • *
  • Posts: 186
  • Country: gb
    • Harris' Electronics!
Re: STM32F407 Discovery
« Reply #4 on: December 11, 2014, 07:02:21 pm »
A big fan of CoIDE too.

The set-up is super easy and tons of context-sensitive examples to get you going in no time.

Completely agree! I've used CoIDE for the past year and I find it really easy to use once you get it setup. If I recall correctly, the method I used is:

  • Install STLink drivers (download from ST website)
  • Download and install latest version of CoIDE, either through CoCenter or as a standlone download
  • Create a new project with your selected microcontroller (STM32F407 in this case!)
  • Include required peripheral files on the repository list
  • Plug in STM32F407 discovery board
  • Compile and test program!

Probably isn't the greatest bit of help but keep trying and it will definitely pay off, the ST micros are brill.

Edit: I've got a few STM32F0 tutorials on my blog if you also have an STM32F0 discovery board - www.hsel.co.uk
 

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8221
  • Country: 00
Re: STM32F407 Discovery
« Reply #5 on: December 11, 2014, 07:41:26 pm »
Simpler than that:

1) download the gcc compiler from the launchpad and install it;
2) download coide and install it;
3) configure coide to use the installed gcc compiler: coide will prompt you;
4) create a new project for your chip, link in the components;
5) compile, download and you have a working project, :)

Cannot be simpler than that.
================================
https://dannyelectronics.wordpress.com/
 

Offline pyrohaz

  • Regular Contributor
  • *
  • Posts: 186
  • Country: gb
    • Harris' Electronics!
Re: STM32F407 Discovery
« Reply #6 on: December 11, 2014, 07:43:07 pm »
Simpler than that:

1) download the gcc compiler from the launchpad and install it;
2) download coide and install it;
3) configure coide to use the installed gcc compiler: coide will prompt you;
4) create a new project for your chip, link in the components;
5) compile, download and you have a working project, :)

Cannot be simpler than that.

+1
 

Offline CM800Topic starter

  • Frequent Contributor
  • **
  • Posts: 882
  • Country: 00
Re: STM32F407 Discovery
« Reply #7 on: December 11, 2014, 11:46:16 pm »
Okay. Something isn't working.

Code: [Select]
#include "stm32f4xx.h"

int main(void)
{

RCC -> AHB1ENR |= (1 << 3);

GPIOD -> MODER |= (1 << 26);

GPIOD -> ODR |= (1 << 13);



    while(1)
    {
    }
}

I can't seem to get the LED on PD13 to turn on.

Could anyone figure out whats wrong?

These are the errors I'm getting.


« Last Edit: December 12, 2014, 12:58:40 am by TCWilliamson »
 

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8221
  • Country: 00
Re: STM32F407 Discovery
« Reply #8 on: December 12, 2014, 02:46:43 am »
cannot see your error message.

the code is largely right. i would clear bit 27 and explictly set other port registers, just in case they have some weird values.

make sure the port/pin for the led is right, the led polarity is right.

make sure your project is set up right.

when i get some time i will try on my f4 discovery.
================================
https://dannyelectronics.wordpress.com/
 

Offline pyrohaz

  • Regular Contributor
  • *
  • Posts: 186
  • Country: gb
    • Harris' Electronics!
Re: STM32F407 Discovery
« Reply #9 on: December 12, 2014, 03:45:39 am »
Okay. Something isn't working.

Code: [Select]
#include "stm32f4xx.h"

int main(void)
{

RCC -> AHB1ENR |= (1 << 3);

GPIOD -> MODER |= (1 << 26);

GPIOD -> ODR |= (1 << 13);



    while(1)
    {
    }
}

I can't seem to get the LED on PD13 to turn on.

Could anyone figure out whats wrong?

These are the errors I'm getting.


I think thats to do with administrative privileges/firewall when running CoIDE. tasklist.exe generally contains each task required to get the program from code to microcontroller (compile, link, download etc.), if its failing to run, it's likely that your computer is stopping it. Try temporarily disabling your firewall to see if that helps OR try running CoIDE as administrator. I might not be getting this problem because I have CoIDE installed directly to my C:\ instead of in program files (Don't ask me why!).

The fact that gdbserver also fails to launch (for debugging) really shows that it could be something on your computer blocking the program from running.
 

Offline CM800Topic starter

  • Frequent Contributor
  • **
  • Posts: 882
  • Country: 00
Re: STM32F407 Discovery
« Reply #10 on: December 12, 2014, 05:34:36 pm »
Can't seem to get debug working at all. I have all the correct files including tasklist.exe.

I can live with that not working, the bigger problem is that I can't seem to get any reaction out of my microcontroller.
I can upload that program but the LED doesn't come on, nor does the pin change its voltage from 0.00v.
 

Offline splin

  • Frequent Contributor
  • **
  • Posts: 999
  • Country: gb
Re: STM32F407 Discovery
« Reply #11 on: December 12, 2014, 06:47:37 pm »
Try running tasklist and gdbserver from a dos command prompt. If they don't start then hopefully you'll get some error messages that will help eg. wrong permissions etc.
 

Offline AndreasF

  • Frequent Contributor
  • **
  • Posts: 251
  • Country: gb
    • mind-dump.net
Re: STM32F407 Discovery
« Reply #12 on: December 12, 2014, 07:28:50 pm »
...I can upload that program but ...

This might be a stupid question, but how do you know this if nothing happens?

Also, in CoIDE, when you upload a file to the board via the "Debug" button, it is actually (for me at least) paused by the debugger, and you have to push the "play" button to make it run.
my random ramblings mind-dump.net
 

Offline CM800Topic starter

  • Frequent Contributor
  • **
  • Posts: 882
  • Country: 00
Re: STM32F407 Discovery
« Reply #13 on: December 12, 2014, 10:39:12 pm »
...I can upload that program but ...

This might be a stupid question, but how do you know this if nothing happens?

Also, in CoIDE, when you upload a file to the board via the "Debug" button, it is actually (for me at least) paused by the debugger, and you have to push the "play" button to make it run.
Well, It said that it had flashed and the data LED was flashing.

Try running tasklist and gdbserver from a dos command prompt. If they don't start then hopefully you'll get some error messages that will help eg. wrong permissions etc.

Will give that a try :)
 

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8221
  • Country: 00
Re: STM32F407 Discovery
« Reply #14 on: December 12, 2014, 11:40:53 pm »
I can confirm for you that on the F4 discovery board, your code runs and debugs as expected.
================================
https://dannyelectronics.wordpress.com/
 

Offline CM800Topic starter

  • Frequent Contributor
  • **
  • Posts: 882
  • Country: 00
Re: STM32F407 Discovery
« Reply #15 on: December 13, 2014, 12:20:43 am »
I can confirm for you that on the F4 discovery board, your code runs and debugs as expected.

Well, that makes me worry a little really. Thanks for checking though :)
 

Offline CM800Topic starter

  • Frequent Contributor
  • **
  • Posts: 882
  • Country: 00
Re: STM32F407 Discovery
« Reply #16 on: December 13, 2014, 12:36:05 am »
When setting up, was there anything you changed at all?

I can't seem to find gdbserver.exe on my computer, even in the GNU Tools ARM Embedded folder.
« Last Edit: December 13, 2014, 12:39:55 am by TCWilliamson »
 

Offline pyrohaz

  • Regular Contributor
  • *
  • Posts: 186
  • Country: gb
    • Harris' Electronics!
Re: STM32F407 Discovery
« Reply #17 on: December 17, 2014, 03:56:43 pm »
When setting up, was there anything you changed at all?

I can't seem to find gdbserver.exe on my computer, even in the GNU Tools ARM Embedded folder.

It should be present in your .../CoIDE/bin folder :)
 

Offline CM800Topic starter

  • Frequent Contributor
  • **
  • Posts: 882
  • Country: 00
Re: STM32F407 Discovery
« Reply #18 on: December 18, 2014, 10:25:46 pm »
Found it :)

Still can't get stuff running though. I'm gonna buy another board incase mine is faulty somehow.
 

Offline pyrohaz

  • Regular Contributor
  • *
  • Posts: 186
  • Country: gb
    • Harris' Electronics!
Re: STM32F407 Discovery
« Reply #19 on: December 18, 2014, 10:41:56 pm »
Found it :)

Still can't get stuff running though. I'm gonna buy another board incase mine is faulty somehow.

Before you do that! Download the ST STLink utility, plug it in and see if it connects to the board. If it does, you should be able to see what microcontroller you have and a few specs about it (SRAM and Flash) memory. If this succeeds, your board should be working successfully.
 

Offline CM800Topic starter

  • Frequent Contributor
  • **
  • Posts: 882
  • Country: 00
Re: STM32F407 Discovery
« Reply #20 on: December 18, 2014, 11:09:34 pm »
Yeh, It does seem to connect and all just fine... but the fact I can't program it etc is causing me some worry and no small amount of fustration...
 

Offline pyrohaz

  • Regular Contributor
  • *
  • Posts: 186
  • Country: gb
    • Harris' Electronics!
Re: STM32F407 Discovery
« Reply #21 on: December 19, 2014, 12:10:37 am »
Yeh, It does seem to connect and all just fine... but the fact I can't program it etc is causing me some worry and no small amount of fustration...

Are you using windows 7 or  windows 8? I sometimes have a few problems with the STLink under windows 8. If you're using windows 7, you could try installing CoIDE to your C:\ drive. Windows 8 has problems with creating and modifying files in the program files folder at times.
 

Offline CM800Topic starter

  • Frequent Contributor
  • **
  • Posts: 882
  • Country: 00
Re: STM32F407 Discovery
« Reply #22 on: December 19, 2014, 12:07:47 pm »
I've been using windows 7. As of now CoIDE is installed in the C drive but still does not seem to want to debug... not sure what else to try.


EDIT:
Don't know why I wrote 'Windows 8' I'm actually using windows 7.
« Last Edit: December 19, 2014, 12:39:29 pm by TCWilliamson »
 

Offline AndreasF

  • Frequent Contributor
  • **
  • Posts: 251
  • Country: gb
    • mind-dump.net
Re: STM32F407 Discovery
« Reply #23 on: December 19, 2014, 02:49:54 pm »
When setting up, was there anything you changed at all?
...

I'm pretty sure the only things I manually changed was setting the "toolchain path" (i.e. compiler etc), and selecting the correct hardware adapter for debug (ST-Link/V2).
my random ramblings mind-dump.net
 

Offline CM800Topic starter

  • Frequent Contributor
  • **
  • Posts: 882
  • Country: 00
Re: STM32F407 Discovery
« Reply #24 on: December 19, 2014, 05:48:10 pm »
I seem to have done all that and it all checks out... I still get these errors:
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf