cancel
Showing results for 
Search instead for 
Did you mean: 

[STM32F2xx] 120MHz + 3 wait state = bugs?

root
Associate II
Posted on August 09, 2011 at 08:41

Hello,

Since the beginning of the project on the STM32F205RG, I had hard faults from time to time.

These last days, I wrote a hard fault handler as described in Joseph Yiu's book to see why ... and the result was very unexpected.

I had hard fault from basically everywhere, any line of code (even in the STM periph library) ... and the type of fault was even more wierd ... illegal instruction, coprocessor request, etc ...

Somewhere in my code I write FLASH ... and sometimes I had a programming error with no obvious reason why. I've put a bearkpoint just where (in the periph library) the test is done to see if there was a programming error (doing a logical and between FLASH->SR and 0xEF), and surprise, when breakpoint triggered, the debugger showed me a FLASH->SR value of ... 0.

This could only mean a problem within the MCU ...

I was running at 120MHz with all prefetches etc and 3 flash wait states.

I switched to no optimization and 4 wait states ...

No more hard faults, not more flash programming errors, program was running - slower but - smooth.

I need to figure out which optimization made the MCU to act like this, but I'm a bit disappointed that ST claims some figures about flash and ART performances if it's not true ...

Regards,

Thomas.
14 REPLIES 14
root
Associate II
Posted on August 11, 2011 at 13:47

And the winner is ... CrashAndBurn.

I'm a complete idiot ... I messed up 2200pF and 2.2uF when assembling these boards (never solder 0402 caps at 1:00 in the morning !).

My problem now is the 2.2uF was missing only 2 caps ...and I sent 2 prototypes for testing. This means one prototype will work and the other will be unstable.

Need to call fedex to see if overnight works from France to USA :(

Thanks a lot !

Thomas.

[EDIT] Nobody near Muncie, Indiana with a good iron and 0402 (or 0603) 2.2uF (at least 1uF) caps, you may win a RC Helicopter ;)

js23
Associate III
Posted on August 11, 2011 at 16:42

Crashes are my speciality. :)

Anyway, there is one thing I nearly overlooked when doing my board design: The ESR if the 2.2uF caps must be in the range 0.1-2Ohm. If you use 0402 ceramics, you will be below that limit. Traces and vias might add a little bit, so maybe it will be fine. Paranoid as I am and to be absolutely safe, I added a 0.2Ohm resistor in series to the cap.

Regards,

Johannes

root
Associate II
Posted on August 11, 2011 at 17:27

Hello,

Thanks again for the advice.

It seems the 2 prototypes I sent are working (no MCU lockup), so they will try them in flight (safely).

I'll send you a video if it is a success :)

Thomas.

root
Associate II
Posted on August 12, 2011 at 20:36

NOTE: edited by moderator on Oct 6th, 2016

Ok I promised, here it is ...

We still have a bug in the piro-compensation (already fixed it in firmware but they didn't try the new firmware yet).

[[this link/image has been flagged as malicious by our security scan software and has been deleted]]

Hope you like it ;)

Thomas.

js23
Associate III
Posted on August 15, 2011 at 12:50

I am in SW/HW development since many years now and started flying RC helicopters a year ago so I have some serious doubts that this was a safe test and wonder how your not so safe tests will look like... :))

Anyway, you seem to have a very interesting job...

Johannes