cancel
Showing results for 
Search instead for 
Did you mean: 

StdPeriphLib Question

wbarkley
Associate II
Posted on November 01, 2012 at 17:29

So does the whole family of STM32M0-STM32M4 have their own StdPeriphDriver offering?  Under the advisement of my hardware guide, I am trying to test out the Freescale Freedom board after I have developed on the STM32F0 Discovery.  I dont see anything on the Freescale side of the fence that comes close to providing the funtionality/ease of the std periph drivers st provides.  Do NXP's cortex offering come with Std Periph Drivers like ST?  Is Freescale the odd one out in not providing this?  I am just a noob and I could setup my I/O on either the Freescale or ST using the below code: (obviously pinouts are different but would the functions/structure work?):

    USART_InitTypeDef USART_InitStructure;

    

    /* SysTick end of count event each 1ms */

    RCC_ClocksTypeDef RCC_Clocks;

    RCC_GetClocksFreq(&RCC_Clocks);

  SysTick_Config(RCC_Clocks.HCLK_Frequency / 1000);

    

    //IO Port Config

  /* GPIOC Periph clock enable */

    RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOA, ENABLE);

    RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOB, ENABLE);

    RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOC, ENABLE);

    

    // Watch Dog clock enable, config, enable

    RCC_APB1PeriphClockCmd(RCC_APB1Periph_WWDG, ENABLE);

    WWDG_SetPrescaler(WWDG_Prescaler_1);

    WWDG_SetWindowValue(0x7F);

    WWDG_Enable(0x7F);

    

    /* Configure PA0 and PA1 in output pushpull mode for LED1 and LED2 */

  GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0 | GPIO_Pin_1;

  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;

  GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;

  GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;

  GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;

  GPIO_Init(GPIOA, &GPIO_InitStructure);

    

    /* Configure PA4, PA5, PA6, PA7, PA8 in input pushpull for sensor selector switch */

  GPIO_InitStructure.GPIO_Pin = GPIO_Pin_4 | GPIO_Pin_5 | GPIO_Pin_6 | GPIO_Pin_7 | GPIO_Pin_8;

  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN;

  GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;

  GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;

  GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_DOWN;

  GPIO_Init(GPIOA, &GPIO_InitStructure);

    

    /* Configure PB8, PB9, PB10, PB11, PB12, PB13 in output pushpull mode for relay outputs */

  GPIO_InitStructure.GPIO_Pin = GPIO_Pin_8 | GPIO_Pin_9 | GPIO_Pin_10 | GPIO_Pin_11 | GPIO_Pin_12 | GPIO_Pin_13;

  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;

  GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;

  GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;

  GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;

  GPIO_Init(GPIOB, &GPIO_InitStructure);

    

    /* Configure PC0, PC2, PC4, PC6, PC8 in output pushpull mode for 485 output enables DE */

    GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0 | GPIO_Pin_2 | GPIO_Pin_4 | GPIO_Pin_6 | GPIO_Pin_8;

  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;

  GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;

  GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;

  GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;

  GPIO_Init(GPIOC, &GPIO_InitStructure);

    

    /* Configure PC1, PC3, PC5, PC7, PC9 in output pushpull mode for 485 input enables RE'*/

    GPIO_InitStructure.GPIO_Pin = GPIO_Pin_1 | GPIO_Pin_3 | GPIO_Pin_5 | GPIO_Pin_7 | GPIO_Pin_9;

  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;

  GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;

  GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;

  GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;

  GPIO_Init(GPIOC, &GPIO_InitStructure);

    //End of IO Port Config

0 REPLIES 0