cancel
Showing results for 
Search instead for 
Did you mean: 

stm32f1xx.h to stm32f4xx.h

ricardo
Associate II
Posted on June 17, 2013 at 14:52

I need to update this function to stm32f4xx.h.

void delay_us(u32 Nus)

    SysTick_SetReload(delay_fac_us * Nus);

    SysTick_CounterCmd(SysTick_Counter_Clear);

// error: 'SysTick_Counter_Clear' undeclared (first use in this function)

    SysTick_CounterCmd(SysTick_Counter_Enable);

// error: 'SysTick_Counter_Enable' undeclared (first use in this function)

    do

    {

        Status = SysTick_GetFlagStatus(SysTick_FLAG_COUNT);

    }while (Status != SET);

    SysTick_CounterCmd(SysTick_Counter_Disable);

SysTick_CounterCmd(SysTick_Counter_Clear);

}

For documentation, do not come to a conclusion.

/ ************************************************* ******************************

* Function Name: SysTick_CounterCmd

* Description: Enables or disables the SysTick counter.

* Input: - SysTick_Counter: new state of the SysTick counter.

* This parameter can be one of the Following values:

* - SysTick_Counter_Disable: Disable counter

* - SysTick_Counter_Enable: Enable counter

* - SysTick_Counter_Clear: Clear counter value to 0

* Output: None

* Return: None

************************************************** ***************************** /

void SysTick_CounterCmd (u32 SysTick_Counter)

{

   / * Check the parameters * /

   assert_param (IS_SYSTICK_COUNTER (SysTick_Counter));

   if (SysTick_Counter == SysTick_Counter_Enable)

   {

     SysTick-> CTRL | = SysTick_Counter_Enable;

   }

   else if (SysTick_Counter == SysTick_Counter_Disable)

   {

     SysTick-> CTRL & = SysTick_Counter_Disable;

   }

   else / * SysTick_Counter SysTick_Counter_Clear == * /

   {

     SysTick-> VAL = SysTick_Counter_Clear;

   }

}
7 REPLIES 7
Posted on June 17, 2013 at 15:49

You'd want to review CMSIS library examples, the way SysTick is configured was changed.

I would also generally recommend just having a ticker interrupt running all the time rather than stopping/starting for delays. For fine delays, one could also spin on one of the cores counters (DWT_CYCCNT). From STM32F4xx_DSP_StdPeriph_Lib_V1.1.0\Project\STM32F4xx_StdPeriph_Examples\SysTick\SysTick_Example

/* Setup SysTick Timer for 1 msec interrupts.
------------------------------------------
1. The SysTick_Config() function is a CMSIS function which configure:
- The SysTick Reload register with value passed as function parameter.
- Configure the SysTick IRQ priority to the lowest value (0x0F).
- Reset the SysTick Counter register.
- Configure the SysTick Counter clock source to be Core Clock Source (HCLK).
- Enable the SysTick Interrupt.
- Start the SysTick Counter.
2. You can change the SysTick Clock source to be HCLK_Div8 by calling the
SysTick_CLKSourceConfig(SysTick_CLKSource_HCLK_Div8) just after the
SysTick_Config() function call. The SysTick_CLKSourceConfig() is defined
inside the misc.c file.
3. You can change the SysTick IRQ priority by calling the
NVIC_SetPriority(SysTick_IRQn,...) just after the SysTick_Config() function
call. The NVIC_SetPriority() is defined inside the core_cm4.h file.
4. To adjust the SysTick time base, use the following formula:
Reload Value = SysTick Counter Clock (Hz) x Desired Time base (s)
- Reload Value is the parameter to be passed for SysTick_Config() function
- Reload Value should not exceed 0xFFFFFF
*/
if (SysTick_Config(SystemCoreClock / 1000))
{
/* Capture error */
while (1);
}

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
ricardo
Associate II
Posted on June 17, 2013 at 17:25

Do not want to change the use of hardware in the program. It's a big program, and first I want to upgrade to stm32f4xx, do tests and then analyze best.

Sorry for my english.

ricardo
Associate II
Posted on June 17, 2013 at 20:24

where can I download the STM32F4xx DSP_StdPeriph_Lib_V1.1.0?

Posted on June 17, 2013 at 22:00

where can I download the STM32F4xx DSP_StdPeriph_Lib_V1.1.0?

You can find all these materials by Googling the part# of the STM32 you have, and going to the ''Design Resources'' tab.

http://www.st.com/web/en/catalog/tools/PF257901

Do not want to change the use of hardware in the program. It's a big program, and first I want to upgrade to stm32f4xx, do tests and then analyze best.

You appear to be using an old STM32F1 V2.xx library, there are things there that don't map cleanly to the V3.xx CMSIS compatible release. This is further compounded by moving to the F4 series parts which are architecturally quite different from the F1 series parts.

I've ported things back-and-forth between a couple of the libraries and parts. You learn to keep the hardware abstraction away from the application code.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
ricardo
Associate II
Posted on June 18, 2013 at 14:03

This difficult. I bought the kit http://www.wvshare.com/product/Open407I-C-Package-B.htm to learn and perform some tests, but the examples are using the stm32F1 library. I want to upgrade to STM32F4, to stay compatible with processor kit, STM32F407IGT6.

Already sought help on google but have not found a solution for this case.

I am also trying to open the help file stm32f4xx_dsp_stdperiph_lib_um.chm but is not displaying the data, only the indices. It happens to you ?

Posted on June 18, 2013 at 15:37

The help file works for me on Win7 Pro x64

Do you have it on a network drive, or set read-only?

[DEAD LINK /public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/FYI%20Problems%20with%20STM32%20Help%20Files%20%28.chm%29%20and%20Keil%20uVision&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B&currentviews=710]https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=%2Fpublic%2FSTe2ecommunities%2Fmcu%2FLists%2Fcortex_mx_stm32%2FFYI%20Problems%20with%20STM32%20Help%20Files%20%28.chm%29%20and%20Keil%20uVision&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B¤tviews=710

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
ricardo
Associate II
Posted on June 19, 2013 at 14:32

I fo.und the solution. In properties,disable warning that the file came from another computer