cancel
Showing results for 
Search instead for 
Did you mean: 

Register read write and Externaml memory test with STM32F4 DISCOVERY

hiharsh
Associate II
Posted on January 27, 2014 at 16:31

Hi All,

I just started working with STM32F4DISCOVERY Eval board. I am completely new to mCOs2 as well. I am coming from a Linux world where we have boot loader, Kernel and File system. I am trying to achieve the following things.

I would appreciate your pointers if possible with sample code.

1) Read write / registers of STM3240 processor.

2) Run memory test to confirm that external memory is in good state, I am planning to run standard walking1/0 pattern.

3) Configure GPIO and run PWM.

#stm32 #discovery #registers #external-memory
6 REPLIES 6
Posted on January 27, 2014 at 16:49

3) [DEAD LINK /public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/STM32F4%20Generation%20PWM&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B&currentviews=136]https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=%2Fpublic%2FSTe2ecommunities%2Fmcu%2FLists%2Fcortex_mx_stm32%2FSTM32F4%20Generation%20PWM&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B¤tviews=136

1) Processor or Peripheral registers, suggest you review Cortex-M4 documentation, learn some basic assembler skills. ST has a Programming Manual, ARM has a Technical Reference Manual (TRM), and Joseph Yiu has a good non-data sheet (alternate) perspective. I think ST has some ISO libraries dealing with this kind of stuff, but you really should understand what you're doing at a bare-metal level for any of this to be useful.

2) External to what? The STM32F4-DISCO has no external memory.
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
hiharsh
Associate II
Posted on January 28, 2014 at 19:35

Hi Clive,

Thank you for the reply. I was able to generate PWM on Timer14 by tweaking the code provided in the link, However, I didn't understand the following part of the code.

Period = (SystemCoreClock / 8000000);
What is the value of the SystemCoreClock above?


 

/* Time base configuration */
TIM_TimeBaseStructure.TIM_Prescaler = 0; // Dump 1X clock into timer
TIM_TimeBaseStructure.TIM_Period = Period - 1;
TIM_TimeBaseStructure.TIM_ClockDivision = 0;

How do we set desired frequency and duty cycle? any examples? showing the system clock, period and Prescaler values? Also, what does the following part of the code do? Since, I disabled the part in my code but it still worked.

TIM_OCInitStructure.TIM_OutputNState = TIM_OutputNState_Enable;
TIM_OCInitStructure.TIM_OCNPolarity = TIM_OCNPolarity_High;
TIM_OCInitStructure.TIM_OCNIdleState = TIM_OCIdleState_Reset;

Posted on January 28, 2014 at 20:31

SystemCoreClock is a variable defined in the system_stm32f4xx.c file from your project which defines the clocking sources, and PLL settings running the device and the buses.

Prescaler and Period are factors you divide into the TIMCLK for the timer.

If you want the time base to be 1 MHz from a 168 MHz source, then Prescaler = 168 - 1; from that 1 MHz source you could get to 50 Hz output (Update Rate) with a Period = 20000 - 1;

Setting the Pulse (width) to 10000 (half of your 20000 1 MHz ticks) would get you a 50/50 duty. While 5000 would get you 25/75.

TIM1/TIM8 are more complex timers, and have additional configuration parameters, which are often better set, than left to contain random junk in the case of auto/local variables allocated from the stack.
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on January 28, 2014 at 20:34

AN3307

Application note

Guidelines for obtaining IEC 60335 Class B certification for any STM32 application

http://www.st.com/st-web-ui/static/active/en/resource/technical/document/application_note/CD00290100.pdf

AN4187

Application note

Using the CRC peripheral in the STM32 family

http://www.st.com/st-web-ui/static/active/en/resource/technical/document/application_note/DM00068118.pdf

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
hiharsh
Associate II
Posted on January 29, 2014 at 19:25

Hi Clive,

Thank you very much for the detailed responses.

I have a couple of more questions at this point of time.

1) I realized the other day, that we are using the STM32F407IGH6 based Eval board, which I reported as the Discovery board. Now a days, we are developing our applications and test code based on the STM32F407IGH6 Eval board.  Recently our hardware team decided to change the processor to STM32F427IGH6, so how do we port the entire code base to this new processor?We are worried about the bspInit and cpuInit and other probable pin/connection changes.

What would be the best way to tackle the issue?

2) I read the application note that you sent via the link,  As I said, we are on

STM32F427IGH6 but the package is not supported but can be ported to this

STM32F427IGH6 processor, so where do I get the software package to run the startup/runtime test described in the application notes?

Posted on January 29, 2014 at 19:42

2) You want to contact ST directly via your local rep or FAE. I don't work for ST, and this forum isn't the best conduit to get engineering support from ST, the classic sales/distribution/support channels should be used.

1) Well, you'd want to enumerate the board/chip changes. Make sure you modify your project, and it's defines, memory setting, scatter files, or linker scripts to reflect the new CPU. Use the most current ST firmware library with support for the F427 and 2MB flash, etc. How complicated that all gets will depend on the project, and the development tools being used. I've ported code between STM32 families, and major FW library releases, usually takes under a day to get the core work done. Then again you've got to read the manuals, understand the product and the board schematics.
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..