Trouble connecting STM32 blue pill via BLE - Invalid token

Hello all,

I have a problem connecting stm32 blue pill with HC-06 to blynk app in android.

Details :
• Hardware: STM32F103C8T6, HC-06
• Smartphone: Samsung S8, Android 9
• Blynk app v2.27.14
• Blynk Library v0.6.1

When I try to connect I get the following output in the serial monitor

    [27000] Connecting...
    [35878] >[1D|00|01|00] 
    [35912] >Q2CFJlNUH5eNLWDhqQOFAlcP28Uhwlge
    [35912] Invalid token
    [35912] <[00|00|01|00|09]

I’ve tried to change HC-06 to HC-05, but it didn’t help.
The last lib version (0.6.1) has fix for similar issue, but it doesn’t seem to work for me.

Can anyone help me to figure out what might be the cause of my problem?

Thank you!


#include <Arduino.h>

#define BLYNK_PRINT Serial

#include <BlynkSimpleSerialBLE.h>

char auth[] = "Q2CFJlNUH5eNLWDhqQOFAlcP28Uhwlge";

void setup() {
  Blynk.begin(Serial3, auth);

void loop() {;


Thanks for the report. Have you tried without BLYNK_USE_DIRECT_CONNECT ? Also can you try our beta app’s version (open google play app, search for blynk, on blynk page - scroll till ‘joint beta’ section), as it has logging support (about screen has button ‘send logs’) - so I can check the logs from your device.


Thank you for your reply.

With beta app the serial output remains same as in stable app version

[7851] >[1D|00|01|00] 
[7884] >2a537FkGkxaBmBvqlFud5d6kj8HIMK8s
[7884] Invalid token
[7884] <[00|00|01|00|09]
[9000] Connecting...

Without BLYNK_USE_DIRECT_CONNECT it says Login timeout on both stable and beta versions.

[46490] Connecting...
[46490] <[1D|00|01|00] ca537FkGkxaBmBv
[46530] <qlFud5d6kj8HIMK8s
[49571] Login timeout

I’ve sent the logs file via email as you suggested.

1 Like


I see that hardware sends another token for login: ca537FkGkxaBmBvqlFud5d6kj8HIMK8s
And due to the difference between device’s token and received token - app understands this situation as failed authentication.

Yeah I see your point.
This is strange since the code now is as following:

char auth[] = "2a537FkGkxaBmBvqlFud5d6kj8HIMK8s";

Do you know why the first symbol changes after transferring?

Which environment do you use for sketch compilation?
@vshymanskyy any thoughts on this issue?

I use MacOS Catalina + VSCode + platformio
Here is my platformio.ini file

platform = ststm32
board = genericSTM32F103C8
debug_tool = stlink
framework = arduino
lib_deps = 

Not sure, may be related but he gets his token cut so it cannot be authenticated and I get junk data while using BLE. I also use Visual Code + PlatformIO but I tried with Arduino IDE and same results, I doubt so it is platform related: Junk data appears in serial monitor and breaks blynk

Could you also try the beta build and send logs from your app after this junk data reproduces?

How to obtain logs that may be helpful for you? I defined:

#define BLYNK_PRINT Serial1

But nothing appears in serial monitor.

I mean install Blynk app beta (open google play app, search for blynk, on blynk page - scroll till ‘joint beta’ section), and send logs from it (about screen has button ‘send logs’)

OK, sent to your email. The log contains 1 intentional disconnection and re-connection, as this is one of scenario when auth token appears in serial monitor. After connection other junk data appears.

As already stated in your other topic, that is due to your own bad code, not because of a Blynk issue.