cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F101CB problem with USART3

czakol
Associate
Posted on November 02, 2011 at 10:16

Hi,

I'm using:

- uVision 4 

- STM32F10x_StdPeriph_Lib_V3.5.0

-> STM32F10x_StdPeriph_Template

-> STM32F10x_StdPeriph_Examples -> USART -> Printf

I try to send data via USART3 and it doesn't work.

What i change for USART3:

1) I choose STM32100B-EVAL

2) Set in options device -> STM32F101CB

3) Check startup_stm32f10x_md_vl Include_target_build (but in STM32100B-EVAL template it was checked)

4) In stm32_eval.h file:

typedef enum 

{

  COM1 = 0,

  COM2 = 1,

  COM3 = 2

} COM_TypeDef;   

5) In stm32100b_eval.h

/* ------------------------ USART 3 ------------------------------ */

#define EVAL_COM3                                        USART3

#define EVAL_COM3_CLK                              RCC_APB1Periph_USART3

#define EVAL_COM3_TX_PIN                         GPIO_Pin_10

#define EVAL_COM3_TX_GPIO_PORT          GPIOB

#define EVAL_COM3_TX_GPIO_CLK            RCC_APB2Periph_GPIOB

#define EVAL_COM3_RX_PIN                        GPIO_Pin_11

#define EVAL_COM3_RX_GPIO_PORT          GPIOB

#define EVAL_COM3_RX_GPIO_CLK            RCC_APB2Periph_GPIOB

#define EVAL_COM3_IRQn                              USART1_IRQn

6) In stm32100b_eval.c

USART_TypeDef* COM_USART[COMn] = {EVAL_COM1, EVAL_COM2, EVAL_COM3}; 

GPIO_TypeDef* COM_TX_PORT[COMn] = {EVAL_COM1_TX_GPIO_PORT, EVAL_COM2_TX_GPIO_PORT, EVAL_COM3_TX_GPIO_PORT};

GPIO_TypeDef* COM_RX_PORT[COMn] = {EVAL_COM1_RX_GPIO_PORT, EVAL_COM2_RX_GPIO_PORT, EVAL_COM3_RX_GPIO_PORT};

const uint32_t COM_USART_CLK[COMn] = {EVAL_COM1_CLK, EVAL_COM2_CLK, EVAL_COM3_CLK};

const uint32_t COM_TX_PORT_CLK[COMn] = {EVAL_COM1_TX_GPIO_CLK, EVAL_COM2_TX_GPIO_CLK, EVAL_COM3_TX_GPIO_CLK};

const uint32_t COM_RX_PORT_CLK[COMn] = {EVAL_COM1_RX_GPIO_CLK, EVAL_COM2_RX_GPIO_CLK, EVAL_COM3_RX_GPIO_CLK};

const uint16_t COM_TX_PIN[COMn] = {EVAL_COM1_TX_PIN, EVAL_COM2_TX_PIN, EVAL_COM3_TX_PIN};

const uint16_t COM_RX_PIN[COMn] = {EVAL_COM1_RX_PIN, EVAL_COM2_RX_PIN, EVAL_COM3_RX_PIN};

7) In stm32100b_eval.c -> In function STM_EVAL_COMInit ()

  else 

  {

      RCC_APB1PeriphClockCmd(COM_USART_CLK[COM], ENABLE); 

  }

And that is all I think this shoud work correct but it isn't...

Could somebody help me with this?

Greetings
0 REPLIES 0