1
\$\begingroup\$

I am using a PIC16f887 oscillating on an external crystal of 20MHZ

The code is simple

void main() {
    uart_init();
    while (1) {
         uart_puts("test for bluetooth connection", 0);
         uart_puts("success", 0);
    }
}

The Bluetooth module is on 9600 Baud rate.

And I've used both BlueTerm on Android and HyperTerminal on PC, all I got was either no data at all or truncated data for only serveral seconds before it went freezed again.

I wanna know what's causing this? Is it because the Bluetooth module is broken in some way?

\$\endgroup\$
  • \$\begingroup\$ We have this very module up and running, no problems AFAIK. Could it be a baud rate mismatch? Do AT commands work? mbed.org/users/edodm85/notebook/HC-05-bluetooth \$\endgroup\$ – Dzarda Feb 14 '14 at 10:38
  • \$\begingroup\$ which two should match? UART and bluetooth or bluetooth and the receiver app? I'm thinking the latter one. \$\endgroup\$ – longtengaa Feb 14 '14 at 10:40
  • \$\begingroup\$ The latter one? You shouldn't even care about the bluetooth protocol. Leave that to the module. Just make sure your PIC's UART is spot on 9600. \$\endgroup\$ – Dzarda Feb 14 '14 at 10:42
  • \$\begingroup\$ Then UART and Bluetooth module should be on 9600? Do I have to also set the baud rate 9600 in BlueTerm or HyperTerminal? \$\endgroup\$ – longtengaa Feb 14 '14 at 11:05
  • \$\begingroup\$ Yes the UART is what matters. The terminal's baud rate, if I get it correctly, doesn't matter. \$\endgroup\$ – Dzarda Feb 14 '14 at 11:52
1
\$\begingroup\$

Connect the module to a computer with a FTDI or similar cable. Power the module on. Then connect pin 34 to VCC. This will put the module into command mode at 9600 baud. If you connect the pin before the module powers on, it will be at 38400 baud.

Use hyperterminal to connect to the module over the correct COM port. Make sure your terminal application is set to send LF+CR at the end of a line. Send the command "AT" and you should get a reply of "OK". Next, send the command "AT+INIT" and now the module should be setup for bluetooth communication.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.