STM32F4 BSP usage

Steven Grunza steven.grunza at gmail.com
Thu Apr 18 00:21:02 UTC 2013


Hello,
  I'm trying to use the stm32f4 BSP for a robotics application.  I need to
program most of the internal hardware peripherals (PWM, QEI, Timers,
USARTs, etc).

  My code is starting to get a little hacked looking:

   uint32_t * pRCC_AHB1ENR;
   uint32_t * pRCC_APB1ENR;
   uint32_t * pRCC_APB2ENR;
   uint32_t * pGPIOA_MODER;
   uint32_t * pGPIOC_MODER;
   uint32_t * pGPIOA_OTYPER;
   uint32_t * pGPIOC_OTYPER;
   uint32_t * pGPIOA_OSPEEDR;
   uint32_t * pGPIOC_OSPEEDR;
   uint32_t * pGPIOA_PUPDR;
   uint32_t * pGPIOC_PUPDR;

   pRCC_AHB1ENR =  (uint32_t *) (0x40023800 + 0x30);
   pRCC_APB1ENR =  (uint32_t *) (0x40023800 + 0x40);
   pRCC_APB2ENR =  (uint32_t *) (0x40023800 + 0x44);
   pGPIOA_MODER =  (uint32_t *) (0x40020000 + 0x00);
   pGPIOC_MODER =  (uint32_t *) (0x40020800 + 0x00);
   pGPIOA_OTYPER = (uint32_t *) (0x40020000 + 0x04);
   pGPIOC_OTYPER = (uint32_t *) (0x40020800 + 0x04);
   pGPIOA_OSPEEDR =(uint32_t *) (0x40020000 + 0x08);
   pGPIOC_OSPEEDR =(uint32_t *) (0x40020000 + 0x08);
   pGPIOA_PUPDR =  (uint32_t *) (0x40020000 + 0x0C);
   pGPIOC_PUPDR =  (uint32_t *) (0x40020000 + 0x0C);

   // Enable GPIOA, GPIOC, and GPIOE clocks
#define RCC_GPIOA_EN 0x00000001
#define RCC_GPIOC_EN 0x00000004
#define RCC_GPIOE_EN 0x00000010

   *pRCC_AHB1ENR |= (RCC_GPIOA_EN | RCC_GPIOC_EN | RCC_GPIOE_EN);

Is there an example of how to use the BSP properly or is this the expected
way to access the internal registers of the STM32F4?


Steven G
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/users/attachments/20130417/e4709c78/attachment.html>


More information about the users mailing list