<div dir="ltr">Hello,<div style> 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). </div><div style><br></div>
<div style> My code is starting to get a little hacked looking:</div><div style><br></div><div style><div> uint32_t *<span class="" style="white-space:pre"> </span>pRCC_AHB1ENR;</div><div> uint32_t *<span class="" style="white-space:pre"> </span>pRCC_APB1ENR;</div>
<div> uint32_t *<span class="" style="white-space:pre"> </span>pRCC_APB2ENR;</div><div> uint32_t *<span class="" style="white-space:pre"> </span>pGPIOA_MODER;</div><div> uint32_t *<span class="" style="white-space:pre"> </span>pGPIOC_MODER;</div>
<div> uint32_t *<span class="" style="white-space:pre"> </span>pGPIOA_OTYPER;</div><div> uint32_t *<span class="" style="white-space:pre"> </span>pGPIOC_OTYPER;</div><div> uint32_t *<span class="" style="white-space:pre"> </span>pGPIOA_OSPEEDR;</div>
<div> uint32_t *<span class="" style="white-space:pre"> </span>pGPIOC_OSPEEDR;</div><div> uint32_t *<span class="" style="white-space:pre"> </span>pGPIOA_PUPDR;</div><div> uint32_t *<span class="" style="white-space:pre"> </span>pGPIOC_PUPDR;</div>
<div><br></div><div> pRCC_AHB1ENR = (uint32_t *) (0x40023800 + 0x30);</div><div> pRCC_APB1ENR = (uint32_t *) (0x40023800 + 0x40);</div><div> pRCC_APB2ENR = (uint32_t *) (0x40023800 + 0x44);</div><div> pGPIOA_MODER = (uint32_t *) (0x40020000 + 0x00);</div>
<div> pGPIOC_MODER = (uint32_t *) (0x40020800 + 0x00);</div><div> pGPIOA_OTYPER = (uint32_t *) (0x40020000 + 0x04);</div><div> pGPIOC_OTYPER = (uint32_t *) (0x40020800 + 0x04);</div><div> pGPIOA_OSPEEDR =(uint32_t *) (0x40020000 + 0x08);</div>
<div> pGPIOC_OSPEEDR =(uint32_t *) (0x40020000 + 0x08);</div><div> pGPIOA_PUPDR = (uint32_t *) (0x40020000 + 0x0C);</div><div> pGPIOC_PUPDR = (uint32_t *) (0x40020000 + 0x0C);</div><div><br></div><div> // Enable GPIOA, GPIOC, and GPIOE clocks</div>
<div>#define RCC_GPIOA_EN<span class="" style="white-space:pre"> </span>0x00000001</div><div>#define RCC_GPIOC_EN<span class="" style="white-space:pre"> </span>0x00000004</div><div>#define RCC_GPIOE_EN<span class="" style="white-space:pre"> </span>0x00000010</div>
<div><br></div><div> *pRCC_AHB1ENR |= (RCC_GPIOA_EN | RCC_GPIOC_EN | RCC_GPIOE_EN);</div><div><br></div><div style>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?</div>
<div style><br></div><div style><br></div><div style>Steven G</div></div></div>