AnsweredAssumed Answered

STM32F407 and HC-05(bluetooth)

Question asked by almeida.joao on Sep 28, 2015
Latest reply on Sep 28, 2015 by almeida.joao
Hello! First of all let me start by telling you that i'm a trully beginner.
So, im trying to receive a string like "hello world" in the termite .
I already can see the bluetooth hc-05 though my phone. I can connect the bluetooth on the termite however i cant receave anything from it.

My code is the following:

/* Includes ------------------------------------------------------------------*/
#include "stm32f4_discovery.h"
#include "stm32f4xx_gpio.h"
#include "stm32f4xx_rcc.h"
#include "stm32f4xx.h"
#include "stm32f4xx_usart.h"
#include <string.h>
#include <stdio.h>

GPIO_InitTypeDef              GPIO_InitStructure;
USART_InitTypeDef             USART_InitStructure;

void delay(unsigned long tempo) {
                                                    volatile unsigned long i;
                                                    i = tempo;
                                                   do i-- ;
                                                   while (i !=0);

void USART_put(USART_TypeDef* USARTx, volatile char *s){

        // wait until data register is empty
        while( !(USARTx->SR & 0x00000040) );
        USART_SendData(USARTx, *s);
        while(USART_GetFlagStatus(USART3, USART_FLAG_TC) == RESET)

void GPIO_USART_Configuration(void){
     RCC_APB1PeriphClockCmd(RCC_APB1Periph_USART3, ENABLE);
     RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOC, ENABLE);
     /* Configure USART Tx as alternate function  */
       GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
       GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
       GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;

       GPIO_InitStructure.GPIO_Pin = GPIO_Pin_10;
       GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;
       GPIO_Init(GPIOC, &GPIO_InitStructure);

     /* Connect PXx to USARTx_Tx*/
       GPIO_PinAFConfig(GPIOC, GPIO_PinSource10, GPIO_AF_USART3);

 void USART3_Configuration(void)

         USART_InitStructure.USART_BaudRate = 38400;
         USART_InitStructure.USART_WordLength = USART_WordLength_8b;
         USART_InitStructure.USART_StopBits = USART_StopBits_1;
         USART_InitStructure.USART_Parity = USART_Parity_No;
         USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None;
         USART_InitStructure.USART_Mode = USART_Mode_Tx;

         USART_Init(USART3, &USART_InitStructure);
         USART_Cmd(USART3, ENABLE); // enable USART2
void usart_inisialisasi()

int main(void) {


(obviously i tried to use usart_put but i cant use it correctly i think)

any help would be appreciated.

Thank you,