STM32F407 Discovery - Page 1
Forum section: electronics / projects

author: CM800
author_rank: Frequent Contributor
timestamp: December 10, 2014, 12:36:28 pm
content: Heya,A while back I brought an STM32F407 Cortex M4 Discovery boardI 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.

author: AndreasF
author_rank: Frequent Contributor
timestamp: December 10, 2014, 10:05:19 pm
content: 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 explainedhereand 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).

author: dannyf
author_rank: Super Contributor
timestamp: December 11, 2014, 12:11:01 am
content: 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.

author: CM800
author_rank: Frequent Contributor
timestamp: December 11, 2014, 03:50:19 pm
content: 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

author: pyrohaz
author_rank: Regular Contributor
timestamp: December 11, 2014, 07:02:21 pm
content: Quote from: dannyf on December 11, 2014, 12:11:01 amCompletely 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 downloadCreate a new project with your selected microcontroller (STM32F407 in this case!)Include required peripheral files on the repository listPlug in STM32F407 discovery boardCompile 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

author: dannyf
author_rank: Super Contributor
timestamp: December 11, 2014, 07:41:26 pm
content: 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.

author: pyrohaz
author_rank: Regular Contributor
timestamp: December 11, 2014, 07:43:07 pm
content: Quote from: dannyf on December 11, 2014, 07:41:26 pm+1

author: CM800
author_rank: Frequent Contributor
timestamp: December 11, 2014, 11:46:16 pm
content: Okay. Something isn't working.Code:#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.

author: dannyf
author_rank: Super Contributor
timestamp: December 12, 2014, 02:46:43 am
content: 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.

author: pyrohaz
author_rank: Regular Contributor
timestamp: December 12, 2014, 03:45:39 am
content: Quote from: TCWilliamson on December 11, 2014, 11:46:16 pmI 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.

author: CM800
author_rank: Frequent Contributor
timestamp: December 12, 2014, 05:34:36 pm
content: 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.

author: splin
author_rank: Frequent Contributor
timestamp: December 12, 2014, 06:47:37 pm
content: 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.

author: AndreasF
author_rank: Frequent Contributor
timestamp: December 12, 2014, 07:28:50 pm
content: Quote from: TCWilliamson on December 12, 2014, 05:34:36 pmThis 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.

author: CM800
author_rank: Frequent Contributor
timestamp: December 12, 2014, 10:39:12 pm
content: Quote from: AndreasF on December 12, 2014, 07:28:50 pmWell, It said that it had flashed and the data LED was flashing.Quote from: splin on December 12, 2014, 06:47:37 pmWill give that a try

author: dannyf
author_rank: Super Contributor
timestamp: December 12, 2014, 11:40:53 pm
content: I can confirm for you that on the F4 discovery board, your code runs and debugs as expected.

author: CM800
author_rank: Frequent Contributor
timestamp: December 13, 2014, 12:20:43 am
content: Quote from: dannyf on December 12, 2014, 11:40:53 pmWell, that makes me worry a little really. Thanks for checking though

author: CM800
author_rank: Frequent Contributor
timestamp: December 13, 2014, 12:36:05 am
content: 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.

author: pyrohaz
author_rank: Regular Contributor
timestamp: December 17, 2014, 03:56:43 pm
content: Quote from: TCWilliamson on December 13, 2014, 12:36:05 amIt should be present in your .../CoIDE/bin folder

author: CM800
author_rank: Frequent Contributor
timestamp: December 18, 2014, 10:25:46 pm
content: Found itStill can't get stuff running though. I'm gonna buy another board incase mine is faulty somehow.

author: pyrohaz
author_rank: Regular Contributor
timestamp: December 18, 2014, 10:41:56 pm
content: Quote from: TCWilliamson on December 18, 2014, 10:25:46 pmBefore 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.

author: CM800
author_rank: Frequent Contributor
timestamp: December 18, 2014, 11:09:34 pm
content: 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...

author: pyrohaz
author_rank: Regular Contributor
timestamp: December 19, 2014, 12:10:37 am
content: Quote from: TCWilliamson on December 18, 2014, 11:09:34 pmAre 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.

author: CM800
author_rank: Frequent Contributor
timestamp: December 19, 2014, 12:07:47 pm
content: 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.

author: AndreasF
author_rank: Frequent Contributor
timestamp: December 19, 2014, 02:49:54 pm
content: Quote from: TCWilliamson on December 13, 2014, 12:36:05 amI'm pretty sure the only things I manually changed wassettingthe "toolchain path" (i.e. compiler etc), andselectingthe correct hardware adapter for debug (ST-Link/V2).

author: CM800
author_rank: Frequent Contributor
timestamp: December 19, 2014, 05:48:10 pm
content: I seem to have done all that and it all checks out... I still get these errors:

author: pyrohaz
author_rank: Regular Contributor
timestamp: December 20, 2014, 02:01:53 pm
content: When you installed the toolchain, did you add the path as an environmental variable?

author: AndreasF
author_rank: Frequent Contributor
timestamp: December 20, 2014, 07:45:37 pm
content: Way out of my league here, but my guess is that there is something on your computer that interferes with gdbserver setting up a remote connection to the target. There is a "GDBserverParam.ini" file in the "..CoIDE\bin" folder. Maybe try changing the port number at the bottom. Maybe something (firewall?) blocks that particular port? (see the footnote in the GDB/GDBserverdocumentation)Edit: Those appear to be the same settings as in the project configuration itself, so maybe it's easier to just change them there.

author: CM800
author_rank: Frequent Contributor
timestamp: December 23, 2014, 07:13:44 pm
content: And the plot thickens....my STM32F051 board arrived today. That completely worked and was just fine... however this bored still doesn't work...The debug on the new board works, but it doesn't on the original STM32F407 board.

author: pyrohaz
author_rank: Regular Contributor
timestamp: December 24, 2014, 05:09:15 pm
content: Quote from: TCWilliamson on December 23, 2014, 07:13:44 pmHow odd! Maybe try using the STLink section of the STM32F0 board for the STM32F4 processor and see if that makes a difference? If so, the STLink section of your STM32F4 might be messed up though the fact you could detect the processor with the STLink utility is quite odd. I'm sorry I can't be much more helpful!

author: CM800
author_rank: Frequent Contributor
timestamp: December 28, 2014, 09:02:12 pm
content: Quote from: pyrohaz on December 24, 2014, 05:09:15 pmI'm afraid that hasn't made any difference... Really not sure what to do now. I might buy another STM32F4 board, they arn't that expensive.

author: dannyf
author_rank: Super Contributor
timestamp: December 28, 2014, 09:18:35 pm
content: What's the chance of 3 boards not working?I think the issue isn't with the boards.

author: CM800
author_rank: Frequent Contributor
timestamp: December 30, 2014, 12:49:04 am
content: There arn't 3 boards not working... I don't think you have read the thread correctly.I have 2 STM boards, one is an STM32F407.... the other an STM32F051The 407 does not work however the 051 does work. I'm trying to work out what is wrong with the 407. I believe it may have been static'd to death as I have had it laying about for a long time.