Setting up the board.h for STM32F100
Posted: Thu Apr 18, 2013 11:09 am
Hi,
whereas the setting up for STM32F4 is quite clear in board.h, in my opinion it is a little bit confusing for STM32F100.
I have taken the example for the DiscoveryVL board and I am trying to modify it. My board.h looks like
Where CHx stands for TIM acting as a PWM.
How should I define VAL_GPIOACRL for PWM? and for the ADC? the same for I2C and JTAG (specially here, because I want to communicate with the micro after the set up).
So far it works for JTAG just assigning an '8' to their pins, but according to the doc in the file this is a "Digital input with PullUp or PullDown resistor depending on ODR.". But JTDO is
an output isnt it?
I would like to do not put any initialization code outside of the board.{c, h} (beside of adcStart or pwmStart)
Can I start this peripherals directly in board.h just with the default defines? or should I write some "palSetGroupMode" and "AFIO->MAPR | blabla" in board.c?
EDIT
-------
Also about the clock. My external clock is 24MHz. According to the documentation the SYSCLK can not be higher than 24MHz. Then I would like a Prediv equal to 1, or just HSE as a SYSCLK, but
the value 1 is not allowed for STM32_PLLMUL_VALUE.
Setting STM32_PLLMUL_VALUE = 2, and STM32_PLLXTPRE = STM32_PLLXTPRE_DIV2 works, is that right in order to have a SYSCLK of 24MHz? I do not know whether this is the configuration with higher accuracy.
Thanks in advance!
whereas the setting up for STM32F4 is quite clear in board.h, in my opinion it is a little bit confusing for STM32F100.
I have taken the example for the DiscoveryVL board and I am trying to modify it. My board.h looks like
Code: Select all
/*
* IO pins assignments.
*/
#define GPIOA_CH1 0
#define GPIOA_CH2 1
#define GPIOA_USART2_TX 2
#define GPIOA_USART2_RX 3
#define GPIOA_ADC1_IN4 4
#define GPIOA_ADC1_IN5 5
#define GPIOA_CH5 6
#define GPIOA_CH6 7
#define GPIOA_JTMS 13
#define GPIOA_JTCK 14
#define GPIOA_JTDI 15
#define GPIOB_JTDO 3
#define GPIOB_NJTRST 4
#define GPIOB_SAFETY 5
Where CHx stands for TIM acting as a PWM.
How should I define VAL_GPIOACRL for PWM? and for the ADC? the same for I2C and JTAG (specially here, because I want to communicate with the micro after the set up).
So far it works for JTAG just assigning an '8' to their pins, but according to the doc in the file this is a "Digital input with PullUp or PullDown resistor depending on ODR.". But JTDO is
an output isnt it?
I would like to do not put any initialization code outside of the board.{c, h} (beside of adcStart or pwmStart)
Can I start this peripherals directly in board.h just with the default defines? or should I write some "palSetGroupMode" and "AFIO->MAPR | blabla" in board.c?
EDIT
-------
Also about the clock. My external clock is 24MHz. According to the documentation the SYSCLK can not be higher than 24MHz. Then I would like a Prediv equal to 1, or just HSE as a SYSCLK, but
the value 1 is not allowed for STM32_PLLMUL_VALUE.
Setting STM32_PLLMUL_VALUE = 2, and STM32_PLLXTPRE = STM32_PLLXTPRE_DIV2 works, is that right in order to have a SYSCLK of 24MHz? I do not know whether this is the configuration with higher accuracy.
Thanks in advance!