6 years, 4 months ago.

Bluetooth HC-05 module with ST Nucleo F303K8

Hi all, I'm trying to perform a communication between an HC-05 module (zs-040 board) with an ST Nucleo F303K8 board. On the other hand, I was able to do that (in a simple and fast way) with the Nucleo F401RE. The code is the following:

bluetooth communication

#include "mbed.h"

Serial bt(D13,D12);
int num=0;
int main()
{
    bt.baud(9600);
   while(1) {
        wait_ms(2);
        bt.printf("%u\n", num);
        num++;
        if(num>50) {
            num=0;
        }
    }
} 

I've tried with serial1 and serial2 port without succes. I've also tried to use: bt.set_flow_control(Serial::Disabled,D2,D10); but the command is not well documented. My idea is that the difference between the F401RE and the F303K8 is the presence of the serial flow control. Anyone has some suggestion or idea to solve this problem? Thanks in advance.

1 Answer

6 years, 4 months ago.

Hello Michele,

UART2 is used for serial communication with your PC over the virtual serial port. However, UART1, for example at PA_9, PA_10, should do the job:

Serial bt(PA_9, PA_10);  // Tx, Rx

This link could be of help, too.

Best regards,

Zoltan

Hi Zoltan, thank you for your suggestion. Unfortunately I've tried with both UART1 and UART2 without success. Do you have some other hint? Best Regards Michele

posted by Michele Riccio 23 Feb 2018

Hello Michele,

  • Disconnect the Bluetooth module from the NUCLEO board.
  • Connect an FTDI or similar serial-to-USB converter to the NUCLEO's UART1 at PA_9, PA_10. A new serial port should be then available on the PC.
  • Open a serial terminal window on your PC to listen for serial data at the new serial port. Make sure the bit rate matches the one used on the NUCLEO side.
  • On the serial monitor check the data received.
posted by Zoltan Hudak 24 Feb 2018