Hello,
I am using HC-05 Bluetooth module connected using UART3 with Stellaris launchpad. I want to perform an half duplex communication. ie only transmitting from Bluetooth device. I ll see the transmitted data in an bluetooth terminal App installed in android phone. I wrote a program for UART Transmitter.
Whenever i connect my Bluetooth device to launchpad, there was a problem arises. After debugging, the data is transmitted from board but i am unable to receive the transmitted data in Bluetooth App. It seems that there won't be any issue in the program. I thought that there might have prob in Bluetooth module but i have tested with MSP430 launchpad and it was working fine. Even i have connected a voltage divider of 2k and 1k between my TX pin of MCU and Gnd.
Herewith i have enclosed my program. Kindly verify and help me in this regard since i was struggling for a week..
#include "inc/lm4f120h5qr.h"
#include "inc/hw_memmap.h"
#include "inc/hw_types.h"
#include "driverlib/sysctl.h"
#include "driverlib/uart.h"
#include "driverlib/gpio.h"
#include "utils/uartstdio.h"
#include "driverlib/pin_map.h"
unsigned int in,q;
unsigned int i,t=0;
void bluetooth_init();
void bluetooth_transmit();
void main(){
SYSCTL_RCGC2_R = SYSCTL_RCGC2_GPIOB|SYSCTL_RCGC2_GPIOE|SYSCTL_RCGC2_GPIOC; //Enable clock for PORTF
while(1){
bluetooth_init();
delay(200);
bluetooth_transmit();
delay(2000);
}}
void delay(unsigned int value){
int i,j;
for(i=0;i<value;i++){
for(j=0;j<100;j++);
}}
void bluetooth_init(){
SysCtlClockSet(SYSCTL_SYSDIV_10 | SYSCTL_USE_OSC | SYSCTL_OSC_MAIN |SYSCTL_XTAL_16MHZ);
SysCtlPeripheralEnable(SYSCTL_PERIPH_UART3);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOC);
GPIOPinConfigure(GPIO_PC6_U3RX);
GPIOPinConfigure(GPIO_PC7_U3TX);
GPIOPinTypeUART(GPIO_PORTC_BASE, GPIO_PIN_6 | GPIO_PIN_7);
UARTConfigSetExpClk(UART3_BASE, SysCtlClockGet(),9600,(UART_CONFIG_WLEN_8 |UART_CONFIG_STOP_ONE |UART_CONFIG_PAR_NONE));
UARTEnable(UART3_BASE);
}
void bluetooth_transmit(){
unsigned int i;
for(i=0;i<11;i++){
UARTCharPut(UART3_BASE,'a');
}
}
Thanks,
Revathi.T