cancel
Showing results for 
Search instead for 
Did you mean: 

Bluetooth module echo problem

linas2
Associate II
Posted on February 10, 2013 at 20:24

Hello, i am working on labview communication with bluetooth module driven by STM32F4, and some how i can't make it work.

I can easy send data to labview, but not other way around, i have no idea where problem is. If i short bluetooth module Rx Tx line, i get same data i send, so problem is with STM32F4 itself. I have high levels if i do nothing, so pullup is ok. code is from forum, but other codes from internet do same thing, can't make echo

// STM32 USART3 (Tx PB.10, Rx PB.11) STM32F4 Discovery - sourcer32@gmail.com
#include ''stm32f4xx.h''
/**************************************************************************************/
void RCC_Configuration(void)
{
/* --------------------------- System Clocks Configuration -----------------*/
/* USART3 clock enable */
RCC_APB1PeriphClockCmd(RCC_APB1Periph_USART3, ENABLE);
/* GPIOB clock enable */
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOB, ENABLE);
}
/**************************************************************************************/
void GPIO_Configuration(void)
{
GPIO_InitTypeDef GPIO_InitStructure;
/*-------------------------- GPIO Configuration ----------------------------*/
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_10 | GPIO_Pin_11;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(GPIOB, &GPIO_InitStructure);
/* Connect USART pins to AF */
GPIO_PinAFConfig(GPIOB, GPIO_PinSource10, GPIO_AF_USART3);
GPIO_PinAFConfig(GPIOB, GPIO_PinSource11, GPIO_AF_USART3);
}
/**************************************************************************************/
void USART3_Configuration(void)
{
USART_InitTypeDef USART_InitStructure;
/* USARTx configuration ------------------------------------------------------*/
/* USARTx configured as follow:
- BaudRate = 9600 baud
- Word Length = 8 Bits
- Two Stop Bit
- Odd parity
- Hardware flow control disabled (RTS and CTS signals)
- Receive and transmit enabled
*/
USART_InitStructure.USART_BaudRate = 9600;
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_Rx | USART_Mode_Tx;
USART_Init(USART3, &USART_InitStructure);
USART_Cmd(USART3, ENABLE);
USART_ITConfig(USART3,USART_IT_RXNE,ENABLE);
}
/**************************************************************************************/
int main(void)
{
RCC_Configuration();
GPIO_Configuration();
USART3_Configuration();
while(1)
{
uint16_t Data;
while(USART_GetITStatus(USART3, USART_IT_RXNE) == RESET); // Wait for Char
Data = USART_ReceiveData(USART3); // Collect Char
while(USART_GetITStatus(USART3, USART_IT_TXE) == RESET); // Wait for Empty
USART_SendData(USART3, Data); // Echo Char
}
while(1); // Don't want to exit
}

Bluetooth module is cheap one from ebay BT_Module v1.2 Processor is clocked at 168MHz from 8MHz crystal #dte #null-modem #dce
11 REPLIES 11
linas2
Associate II
Posted on April 14, 2013 at 21:49

i don't use VISA, i use blue-tooth functions. it even start to search bluetooth module, and do all good stuff. change just address of device (you can found it in device section)

________________

Attachments :

X-Ray_UART.vi : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006I04U&d=%2Fa%2F0X0000000bT4%2FIQsgpCO.eZRfbTqQs.SbdDHUjhEXpKJ8aqucOENDzuI&asPdf=false
p3t3962
Associate
Posted on June 10, 2015 at 13:35

Hi Kilohercas,

Could you please post your code for communicating between NI and the STM board if you still have it?

Thanks, Pete