BLYNK
HOME       📲 GETTING STARTED       📗 DOCS       ❓HELP CENTER       👉 SKETCH BUILDER

Cmd error while connecting to blynk-cloud

Hi there,

I’m fairly new to Blynk and teensy. I’ve some experience with Arduino nano, uno and pro mini. For my new project i’d like to utilize a teensy 3.2, because of its capabilities and its form-factor. I took the teensy 3.2, because the specs told me, that it is capable of powering the esp01. In order to flash the ESPI used a dedicated serial-programmer.

But I’ve tried for hours to get the Blynk Blink and Blynk Push Data examples running and everything I was trying, I always get an “Cmd error” early after communication start. My app says ‘wasn’t online yet’. My ESP01 is connected to my local wifi. I can successful send pings to the IP shown in the log.

I flashed firmware of the ESP to

AT version:1.1.0.0(May 11 2016 18:09:56)
SDK version:1.5.4(baaeaebb) compile time:May 20 2016 15:06:44

as recommended at http://help.blynk.cc/en/articles/605485-esp8266-with-at-firmware .

As far as I understand the log output, the ‘cmd error occurs’, when trying to send my auth-token (XXX) to the blynk-cloud.

I don’t think there is a problem in the serial communication, because the initial log output seems to me the two devices (teensy and esp01) can talk to each other.

I’ve already read a ton of posts here. I’ve already changed bauds to higher and lower values, but now I run out of ideas…

The Wiring:

    Power Supply over Teensy-USB-Port

    Teensy Pin  -->  ESP Pin
    GND           -->  GND    
    0 (RX1)       -->  TXD
    1 (TX1)       -->   RXD 
    3.3V            -->   Vcc   --> CH_PD         

The log output:

[4310] 

    ___  __          __
   / _ )/ /_ _____  / /__
  / _  / / // / _ \/  '_/
 /____/_/\_, /_//_/_/\_\
        /___/ v0.6.1 on Teensy 3.2/3.1

[4810] Connecting to YYY

[7914] AT version:1.1.0.0(May 11 2016 18:09:56)

SDK version:1.5.4(baaeaebb)

compile time:May 20 2016 15:06:44

OK

[11057] +CIFSR:STAIP,"192.168.179.4"

+CIFSR:STAMAC,"48:3f:da:00:91:17"

[11057] Connected to WiFi

[21149] <[1D|00|01|00] XXX

[31184] Cmd error

[46293] <[1D|00|01|00] XXX

[56328] Cmd error


The sketch:


/*************************************************************
  Download latest Blynk library here:
    https://github.com/blynkkk/blynk-library/releases/latest

  Blynk is a platform with iOS and Android apps to control
  Arduino, Raspberry Pi and the likes over the Internet.
  You can easily build graphic interfaces for all your
  projects by simply dragging and dropping widgets.

    Downloads, docs, tutorials: http://www.blynk.cc
    Sketch generator:           http://examples.blynk.cc
    Blynk community:            http://community.blynk.cc
    Follow us:                  http://www.fb.com/blynkapp
                                http://twitter.com/blynk_app

  Blynk library is licensed under MIT license
  This example code is in public domain.

 *************************************************************
  WARNING!
    It's very tricky to get it working. Please read this article:
    http://help.blynk.cc/hardware-and-libraries/arduino/esp8266-with-at-firmware

  This example shows how value can be pushed from Arduino to
  the Blynk App.

  NOTE:
  BlynkTimer provides SimpleTimer functionality:
    http://playground.arduino.cc/Code/SimpleTimer

  App project setup:
    Value Display widget attached to Virtual Pin V5
 *************************************************************/

/* Comment this out to disable prints and save space */
#define BLYNK_DEBUG
#define BLYNK_PRINT Serial

#define PIN02 2

#include <ESP8266_Lib.h>
#include <BlynkSimpleShieldEsp8266.h>

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "XXX";

// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "YYY";
char pass[] = "ZZZ";

// Hardware Serial on Mega, Leonardo, Micro...
#define EspSerial Serial1

// or Software Serial on Uno, Nano...
//#include <SoftwareSerial.h>
//SoftwareSerial EspSerial(2, 3); // RX, TX

// Your ESP8266 baud rate:
#define ESP8266_BAUD 19200

ESP8266 wifi(&EspSerial);

BlynkTimer timer;

// This function sends Arduino's up time every second to Virtual Pin (5).
// In the app, Widget's reading frequency should be set to PUSH. This means
// that you define how often to send data to Blynk App.
/*
void myTimerEvent()
{
  Serial.println("myTimerEvent");
  // You can send any value at any time.
  // Please don't send more that 10 values per second.
  Blynk.virtualWrite(V5, millis() / 1000);
}
*/
void setup()
{
  // Debug console
  Serial.begin(9600);
  
  pinMode(PIN02, OUTPUT);
  // Test Output on Pin
  for (int i =0; i <4; i++) {
    digitalWrite(2, HIGH);
    delay(500);
    digitalWrite(2, LOW);
    delay(500);
  }

  // Set ESP8266 baud rate
  EspSerial.begin(ESP8266_BAUD);
  delay(10);

  Blynk.begin(auth, wifi, ssid, pass);
  // You can also specify server:
  //Blynk.begin(auth, wifi, ssid, pass, "blynk-cloud.com", 80);
  //Blynk.begin(auth, wifi, ssid, pass, IPAddress(192,168,1,100), 8080);

  // Setup a function to be called every second
//  timer.setInterval(1000L, myTimerEvent);
}

void loop()
{
  Blynk.run();
//  timer.run(); // Initiates BlynkTimer
}

There is a warning while compiling:

BlynkSimpleShieldEsp8266.h:45:27: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         if (buffer.free() < len) {
                           ^

Try changing g this to…

Blynk.begin(auth, wifi, ssid, pass, "blynk-cloud.com", 8080);

Pete.

Thx @PeteKnight , but did not helped :frowning:

I’ve tried to connect the ESP to Serial3, I’ve even installed a local blynk-server installation and tried to connect to it. Still the same behavior: It still does not connect to the blynk server.
I can see in the monitor of my router, the ESP ist logged into my Wifi. I can ping the IP given to ESP.

Strange behavior: I’ve tried to put some debug println ( Serial.println("End of setup"); ) statements in my code, but nothing is printed to my monitor? Does blynk block Serial?

Is there a way to enable more debug info? Where can I find a documentation of the blynk debug output?

I’m getting frustrated :roll_eyes:

I’ve just re-read your wiring description and lo0okled-up the Teensy pinouts and it seems that you have a wiring error.

This tells Blynk that you are using the Teensy’s second serial port (Serial = first port, Serial1 = second port etc, for communication with the ESP-01.

However, you’ve said that your ESP-01 is connected to the first serial port…

You should be using pins 7 & 8 to connect to your ESP-01.

However, if you had it mis-wired then I don’t think that you’d see the Blynk output that you posted, so I assume that you’ve tried a variety of combinations and has posted the output from a configuration that was different to what you’ve shared above.

Pete.

Once I had a wrong wiring. This gave the message ‘ESP8266 not found’