This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

hardware interface of Bluetooth(HC-05) and TM4C123GH6PM microcontroller

Other Parts Discussed in Thread: TM4C123GH6PM

hello,

             Actually am developing a blue-tooth(HC-05)driver using TM4C123GH6PM microcontroller to Connect blue-tooth module to send data from module to mobile... but here am struggling to receive the response for sent AT commands where the control will enter into the interrupt but it won't receive anything the value will be always zero... can anybody suggest me the solution...

Thank you

Pooja Jain C A

  • Hello Pooja,

    Resource on the forum exists

    e2e.ti.com/.../320533

    Also there are working TI Design of TM4C123x with other TI products. Wouldn't an already working solution be more useful.

    Regards
    Amit
  • Hai Amith,

                            Thank you for the reply... Actually i have used the PC6(Rx) and PC7(tx) pins for UART communication, i have changed the hardware interface also in the sense where i have connected the voltage divider of 1K & 2K ohm for PC7 pin. So once i got the response for all AT commands and i have sent the message also by using the Blueterm App but the thing now the blue-tooth module is not coming out of  communication mode for this particuler UART pins, where it will come out from the communication mode for other pins of UART but am not getting response for AT command...expecting a solution.... 

    Thanks & regards

    Pooja Jain C A

  • pooja jain c a said:
    i have changed the hardware interface also in the sense where i have connected the voltage divider of 1K & 2K ohm for PC7 pin

    What do you mean by voltage divider? Is the voltage specification different for the BT module?

    Regards

    Amit

  • Hello Amit

                         i should get 3.3V at Rx pin of modue and Tx pin of Microcontroller(Using UART3) but am getting always zero over there so i have connected voltage divider circuit to tx pin micro, where the Vs=5V, R1=1Kohm, R2=2Kohm and Vout=3.3V. that time i got the response for AT command and also i have sent the data to mobile from the module... after that the module went to communication mode... now it is difficult to come out from the Communication mode to AT mode.... but i can easily come out from Communication mode to AT mode if i use other UART..... 

  • Hello Pooja,

    That is not an expected way of making the UART work. Can you share the code for UART and it's IO configuration?

    Regards
    Amit
  • Hi Pooja ,

    Did you check the baudrate.?

    When HC05 first use (default ). In AT mode, the baudrate is 38400.

    The baudrate when communication is 9600 ( you can config it in AT mode)

    regards,
    Khoa
  • yeah am using UART driver so ill send the UART configuration...

    #include <stdint.h>
    #include <stdbool.h>
    #include <string.h>
    #include <stdlib.h>
    #include "inc/hw_uart.h"
    #include "inc/hw_ints.h"
    #include "inc/hw_memmap.h"
    #include "driverlib/debug.h"
    #include "driverlib/fpu.h"
    #include "driverlib/gpio.h"
    #include "driverlib/interrupt.h"
    #include "driverlib/pin_map.h"
    #include "driverlib/rom.h"
    #include "driverlib/sysctl.h"
    #include "inc/hw_types.h"
    #include "driverlib/sysctl.h"
    #include "driverlib/timer.h"
    #include "driverlib/uart.h"
    #include "inc/hw_gpio.h"
    #include "driverlib/watchdog.h"
    #include "UART_driver.h"
    #include "bluetooth.h"

    uint32_t g_Ui32SysClock;
    uint8_t g_Response_Char_Count;
    #define switch (*((volatile uint32_t *)0x40025004))

    void delay(void)
    {
    uint16_t i=0;
    for(i=0;i<10000;i++);
    }

    void UART2IntHandler(void)
    {
    uint32_t ui32Status;
    /*Initialize the status of interrupt*/
    g_Uart_Buffer[ g_Array_Pointer ] = UARTCharGetNonBlocking( UART3_BASE );

    g_Array_Pointer++;
    ui32Status = UARTIntStatus( UART3_BASE, true );

    if( g_Array_Pointer >= g_Response_Char_Count )
    {
    IntDisable( INT_UART3 );
    UARTIntDisable( UART3_BASE, UART_INT_RX | UART_INT_RT );

    }

    }



    int main()

    {


    UART_t UART0;

    SysCtlClockSet( SYSCTL_SYSDIV_1 | SYSCTL_USE_OSC | SYSCTL_OSC_MAIN |
    SYSCTL_XTAL_16MHZ );

    g_Ui32SysClock = SysCtlClockGet();

    UART0.ui32Base = UART3_BASE;
    UART0.ui32Source = UART_CLOCK_SYSTEM ;
    UART0.ui32BaudRate = 38400;
    UART0.ui32SysClock = g_Ui32SysClock;
    UART0.ui32Config = (UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE | UART_CONFIG_PAR_NONE);
    UART0.ui32GPIO_Peripheral = SYSCTL_PERIPH_GPIOC;
    UART0.ui32UART_Peripheral = SYSCTL_PERIPH_UART3;
    UART0.ui32UARTTx_PinConfig = GPIO_PC7_U3TX;
    UART0.ui32UARTRx_PinConfig = GPIO_PC6_U3RX;
    UART0.ui32UART_Port = GPIO_PORTC_BASE;
    UART0.ui8UART_Pins = (GPIO_PIN_6 |GPIO_PIN_7);
    UART0.interrupts = 1;
    UART0.ui32IntEnable = UART_INT_RX;


    uart_init( &UART0, UART2IntHandler );


    GPIOPadConfigSet(GPIO_PORTC_BASE, GPIO_PIN_7,
    GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD_WPU);


    g_Response_Char_Count = 10;
    IntEnable( INT_UART3 );
    UARTIntEnable( UART3_BASE, UART_INT_RX | UART_INT_RT );
    uart_send_string( UART3_BASE, ( uint8_t* )ATTENTION,
    strlen( ATTENTION ) );


    delay();


    IntEnable( INT_UART3 );
    UARTIntEnable( UART3_BASE, UART_INT_RX | UART_INT_RT );
    uart_send_string( UART3_BASE, ( uint8_t* )ORGL,
    strlen( ORGL ) );

    delay();

    IntEnable( INT_UART3 );
    UARTIntEnable( UART3_BASE, UART_INT_RX | UART_INT_RT );
    uart_send_string( UART3_BASE, ( uint8_t* )BAUDRATE,
    strlen( BAUDRATE ) );

    delay();
    IntEnable( INT_UART3 );
    UARTIntEnable( UART3_BASE, UART_INT_RX | UART_INT_RT );

    uart_send_string( UART3_BASE, ( uint8_t* )ROLE,
    strlen( ROLE ) );

    delay();
    IntEnable( INT_UART3 );
    UARTIntEnable( UART3_BASE, UART_INT_RX | UART_INT_RT );

    uart_send_string( UART3_BASE, ( uint8_t* )MODE,
    strlen( MODE ) );

    delay();
    IntEnable( INT_UART3 );
    UARTIntEnable( UART3_BASE, UART_INT_RX | UART_INT_RT );
    uart_send_string( UART3_BASE, ( uint8_t* )PASSWORD,
    strlen( PASSWORD ) );
    while(1){


    IntEnable( INT_UART3 );
    UARTIntEnable( UART3_BASE, UART_INT_RX | UART_INT_RT );
    uart_send_string( UART3_BASE, ( uint8_t* )HELLO,
    strlen( HELLO ) );}





    delay();

    uart_send_string( UART3_BASE, ( uint8_t* )RESET,
    strlen( RESET ) );

    delay();

    if( switch == 0 ){

    while(1){

    uart_send_string( UART3_BASE, ( uint8_t* )HELLO,
    strlen( HELLO ) );

    Clear_UART_Buffer();

    delay();





    }


    }

    }

    Thanks & regards

    Pooja Jain C A
  • Hello Khoa,
     
                                  Yeah have checked the baud-rate its working fine… but the thing is its not coming out of communication mode for the pin PC7 but its coming out for all other pin, there am not getting response for AT command…
     
    Regards
    Pooja Jain C A
     
  • Hello Pooja,

    Can you check the configuration of the GPIO Port C after uart_init is called?

    Regards
    Amit
  • Hai Amit

                      sorry for the delay... as u told after UART initialization i  have checked the PC6(Rx-micro) & PC7(Tx-micro), as per UART these two pins should be idle before transmitting or receiving but the thing is here only PC7 is getting 3.3V(High) and PC6 is getting 1.5, it shows micro is receiving some data from HC-05 module... and i think the issue is with HC-05 module...

    Thank you,

    Regards

    Pooja Jain C A

  • Hello Pooja

    Is the PC6 at 1.5V due to transmission or due to multiple drivers. A scope should tell you that not a DMM

    Regards
    Amit
  • Hai Amit

                         sorry for the delay, actually i have done the mistake there is no issue with the micro-controller its working fantastically...  if you look at the code what i have sent u previously u can find the while loop because of that while loop the module will keep on transmit the data to the micro-controller so am not able to come out from the communication mode... finally the module and the micro-controller are working good... thank u for the support...

    Regards

    Pooja Jain C A