Skip to main content
navid ansari
Associate II
March 8, 2017
Question

STM32F030K6T6 does not have usart library . what should i do?where to find its library?

  • March 8, 2017
  • 1 reply
  • 447 views
Posted on March 08, 2017 at 11:33

hi

first i look here

0690X00000606VEQAY.png

but there is no usart driver.

this is my schematic

0690X00000606VFQAY.png

according to schematic i use pa2 and pa3 as usart.

please tell me if there is any library to init usart and use it.

if there is not .

datasheet give me something but its hard to understand . what to do?

first

Alternate function selection

/* This sequence select AF2 for GPIOA5, 8 and 9. This can be easily adapted
with another port by changing all GPIOA references by another GPIO port,
and the alternate function number can be changed by replacing 0x02 for
each pin by the targeted alternate function in the 2 last code lines. */
/* (1) Enable the peripheral clock of GPIOA */
/* (2) Select alternate function mode on GPIOA pin 5, 8 and 9 */
/* (3) Select AF2 on PA5 in AFRL for TIM2_CH1 */
/* (4) Select AF2 on PA8 and PA9 in AFRH for TIM1_CH1 and TIM1_CH2 */
RCC->AHBENR |= RCC_AHBENR_GPIOAEN; /* (1) */
GPIOA->MODER = (GPIOA->MODER & ~(GPIO_MODER_MODER5 | GPIO_MODER_MODER8
| GPIO_MODER_MODER9)) | GPIO_MODER_MODER5_1
| GPIO_MODER_MODER8_1 | GPIO_MODER_MODER9_1; /* (2) */
GPIOA->AFR[0] |= 0x02 << (5 * 4); /* (3) */
GPIOA->AFR[1] |= 0x02 | (0x02 << ((9 - 8) * 4)); /* (4) */�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?

but line 3 and line 4 is so hard to get . why 5*4 why ((9-8)*4)) :!

please somebody help me

    This topic has been closed for replies.

    1 reply

    Tesla DeLorean
    Guru
    March 8, 2017
    Posted on March 08, 2017 at 14:10

    Cross posting

    https://community.st.com/0D50X00009XkYZqSAN

    I'd use the STM32F0 SPL (Standard Peripheral Library), but that's me

    http://www.st.com/en/embedded-software/stsw-stm32html

    Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..