Go Down

Topic: Programming ESP8266 through Zero (Read 469 times) previous topic - next topic

Java_SE_Binary

So I got AT commands working on my Arduino Zero, but I am unable to figure out how to program the ESP8266 module through my Zero, everything I've tried has resulted in a failure. I did ground the GPIO 0 pin as instructed, so I'm unsure what I'm missing.

pert

Try selecting Tools > Upload Speed > 115200.

You might consider buying a USB to TTL serial adapter. It's much more convenient than trying to turn an Arduino board into an adapter. They are available from all the places you would purchase electronics components (eBay, Aliexpress, Amazon, Adafruit, Sparkfun, etc.) for a reasonable price. They most commonly use either the FT232 or the CH340 chip. It's a useful tool to have on hand. I prefer the ones that come with the "FTDI header" pinout:
  • DTR
  • RX
  • TX
  • VCC
  • CTS
  • GND

That is the most standardized pinout, which allows you to plug it right in to many boards (e.g. Pro Mini). Some have DTR and CTS swapped, but that doesn't matter. You will want one that allows you to select 5 V or 3.3 V.

Java_SE_Binary

Try selecting Tools > Upload Speed > 115200.

You might consider buying a USB to TTL serial adapter. It's much more convenient than trying to turn an Arduino board into an adapter. They are available from all the places you would purchase electronics components (eBay, Aliexpress, Amazon, Adafruit, Sparkfun, etc.) for a reasonable price. They most commonly use either the FT232 or the CH340 chip. It's a useful tool to have on hand. I prefer the ones that come with the "FTDI header" pinout:
  • DTR
  • RX
  • TX
  • VCC
  • CTS
  • GND

That is the most standardized pinout, which allows you to plug it right in to many boards (e.g. Pro Mini). Some have DTR and CTS swapped, but that doesn't matter. You will want one that allows you to select 5 V or 3.3 V.

Speed was already set correctly.

I'm not exactly trying to repurpose an Arduino to be an adapter, I'm currently attempting to add networking functionality to it. The ESP8266 will need to send data over the UART serial connection, and be able to connect to my Adafruit IO MQTT account. I've got all the code I need, its just the trouble of uploading it.

pert

I'm not exactly trying to repurpose an Arduino to be an adapter
OK, but that's exactly what the configuration in your previous thread does. It's making your fancy Zero into something inferior to a $1 USB to TTL serial adapter.

its just the trouble of uploading it.
Please do this:
  • File > Preferences > Show verbose output during: > compilation (uncheck) > upload (check) > OK
  • Sketch > Upload
  • After the upload fails you'll see a button on the right side of the orange bar "Copy error messages". Click that button.
  • Paste the error messages in a reply here USING CODE TAGS (</> button on the forum toolbar).

Java_SE_Binary

Code: [Select]
Arduino: 1.8.4 (Windows 10), Board: "Generic ESP8266 Module, 80 MHz, Flash, Enabled, ck, 26 MHz, 40MHz, QIO, 512K (no SPIFFS), 2, v2 Lower Memory, Disabled, None, Only Sketch, 115200"

Archiving built core (caching) in: C:\Users\Java\AppData\Local\Temp\arduino_cache_8101\core\core_esp8266_esp8266_generic_xtal_80,vt_flash,exception_enabled,ResetMethod_ck,CrystalFreq_26,FlashFreq_40,FlashMode_qio,eesz_512K,led_2,ip_lm2f,dbg_Disabled,lvl_None____,wipe_none,baud_115200_159e75d41891d1e4fb711824f439b28b.a
Sketch uses 312176 bytes (62%) of program storage space. Maximum is 499696 bytes.
Global variables use 28528 bytes (34%) of dynamic memory, leaving 53392 bytes for local variables. Maximum is 81920 bytes.
C:\Users\Java\AppData\Local\Arduino15\packages\esp8266\tools\esptool\2.5.0-3-20ed2b9/esptool.exe -vv -cd ck -cb 115200 -cp COM4 -ca 0x00000 -cf C:\Users\Java\AppData\Local\Temp\arduino_build_532219/MQTT.ino.bin
esptool v0.4.13-1-gf80ae31 - (c) 2014 Ch. Klippel <ck@atelier-klippel.de>
 setting board to ck
 setting baudrate from 115200 to 115200
 setting port from COM1 to COM4
 setting address from 0x00000000 to 0x00000000
 espcomm_upload_file
 espcomm_upload_mem
 setting serial port timeouts to 1000 ms
opening bootloader
resetting board
trying to connect
 flush start
 setting serial port timeouts to 1 ms
 setting serial port timeouts to 1000 ms
 flush complete
 espcomm_send_command: sending command header
 espcomm_send_command: sending command payload
 read 0, requested 1
trying to connect
 flush start
 setting serial port timeouts to 1 ms
 setting serial port timeouts to 1000 ms
 flush complete
 espcomm_send_command: sending command header
 espcomm_send_command: sending command payload
 read 0, requested 1
trying to connect
 flush start
 setting serial port timeouts to 1 ms
 setting serial port timeouts to 1000 ms
 flush complete
 espcomm_send_command: sending command header
 wrote 0, requested 8
error: failed sending 8 bytes
 espcomm_send_command: sending command payload
 wrote 0, requested 36
error: failed sending 36 bytes
 wrote 0, requested 1
error: failed sending 0xC0
 read 0, requested 1
resetting board
trying to connect
 flush start
 setting serial port timeouts to 1 ms
 setting serial port timeouts to 1000 ms
 flush complete
 espcomm_send_command: sending command header
 espcomm_send_command: sending command payload
 read 0, requested 1
trying to connect
 flush start
the selected serial port trying to connect
 does not exist or your board is not connected
 setting serial port timeouts to 1 ms
 setting serial port timeouts to 1000 ms
 flush complete
 espcomm_send_command: sending command header
 espcomm_send_command: sending command payload
 read 0, requested 1
trying to connect
 flush start
 setting serial port timeouts to 1 ms
 setting serial port timeouts to 1000 ms
 flush complete
 espcomm_send_command: sending command header
 wrote 0, requested 8
error: failed sending 8 bytes
 espcomm_send_command: sending command payload
 wrote 0, requested 36
error: failed sending 36 bytes
 wrote 0, requested 1
error: failed sending 0xC0
 read 0, requested 1
resetting board
trying to connect
 flush start
 setting serial port timeouts to 1 ms
 setting serial port timeouts to 1000 ms
 flush complete
 espcomm_send_command: sending command header
 espcomm_send_command: sending command payload
 read 0, requested 1
trying to connect
 flush start
 setting serial port timeouts to 1 ms
 setting serial port timeouts to 1000 ms
 flush complete
 espcomm_send_command: sending command header
 espcomm_send_command: sending command payload
 read 0, requested 1
trying to connect
 flush start
 setting serial port timeouts to 1 ms
 setting serial port timeouts to 1000 ms
 flush complete
 espcomm_send_command: sending command header
 wrote 0, requested 8
error: failed sending 8 bytes
 espcomm_send_command: sending command payload
 wrote 0, requested 36
error: failed sending 36 bytes
 wrote 0, requested 1
error: failed sending 0xC0
 read 0, requested 1
warning: espcomm_sync failed
error: espcomm_open failed
error: espcomm_upload_mem failed

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

Juraj

#5
Jan 17, 2019, 10:09 am Last Edit: Jan 17, 2019, 10:13 am by Juraj
so let start from the beginning. the Zero has native USB port configured as Serial and UART configured Serial1. I expect that you connected the esp8266 module to Serial1. so to flash the esp8266 you would need a SerialPassthrough sketch in Zero.

what do you want to flash into esp8266. you don't want to use AT firmware?

and if you still want to use and flash the esp8266 with Zero, you can use EspProxy
You can't write an Arduino sketch if you didn't learn programming. Not the language, but the concepts of programming - algorithms and data types.

Java_SE_Binary

so let start from the beginning. the Zero has native USB port configured as Serial and UART configured Serial1. I expect that you connected the esp8266 module to Serial1.
Half correct, I have the programming USB port configured as Serial. Using the Serial Monitor, I cannot get AT commands to work on the Native USB port, only on the Programming port.

what do you want to flash into esp8266. you don't want to use AT firmware?
I'm intending on flashing this, as I have no clue how I would do this through the AT stuff.

Code: [Select]
#include <ESP8266WiFi.h>
#include "Adafruit_MQTT.h"
#include "Adafruit_MQTT_Client.h"

#define WIFI_SSID "WirelessL"
#define WIFI_PASS "3038861117"

#define MQTT_SERV "io.adafruit.com"
#define MQTT_PORT 1883
#define MQTT_NAME "Java_SE_Binary"
#define MQTT_PASS "74ba791825fc48bfa7cdcd86c9b4c339"

WiFiClient client;
Adafruit_MQTT_Client mqtt(&client, MQTT_SERV, MQTT_PORT, MQTT_NAME, MQTT_PASS);

Adafruit_MQTT_Subscribe onoff = Adafruit_MQTT_Subscribe(&mqtt, MQTT_NAME "/f/onoff");

void setup()
{
  Serial.begin(115200);

  //Connect to WiFi
  Serial.print("\n\nConnecting Wifi... ");
  WiFi.begin(WIFI_SSID, WIFI_PASS);
  while (WiFi.status() != WL_CONNECTED)
  {
    delay(500);
  }

  Serial.println("OK!");

  //Subscribe to the onoff topic
  mqtt.subscribe(&onoff);

  pinMode(LED_BUILTIN, OUTPUT);
}

void loop(){
  //Connect/Reconnect to MQTT
  MQTT_connect();

  //Read from our subscription queue until we run out, or
  //wait up to 5 seconds for subscription to update
  Adafruit_MQTT_Subscribe * subscription;
  while ((subscription = mqtt.readSubscription(5000)))
  {
    //If we're in here, a subscription updated...
    if (subscription == &onoff)
    {
      //Print the new value to the serial monitor
      Serial.print("onoff: ");
      Serial.println((char*) onoff.lastread);

      //If the new value is  "ON", turn the light on.
      //Otherwise, turn it off.
      if (!strcmp((char*) onoff.lastread, "ON"))
      {
        //active low logic
        digitalWrite(LED_BUILTIN, LOW);
      }
      else
      {
        digitalWrite(LED_BUILTIN, HIGH);
      }
    }
  }

  // ping the server to keep the mqtt connection alive
  if (!mqtt.ping()){    
    mqtt.disconnect();
  }
}

void MQTT_connect()
{
  int8_t ret;
  // Stop if already connected
  if (mqtt.connected())
  {
    return;
  }

  Serial.print("Connecting to MQTT... ");
  uint8_t retries = 3;
  while ((ret = mqtt.connect()) != 0) // connect will return 0 for connected
  {
    Serial.println(mqtt.connectErrorString(ret));
    Serial.println("Retrying MQTT connection in 5 seconds...");
    mqtt.disconnect();
    delay(5000);  // wait 5 seconds
    retries--;
    if (retries == 0)
    {
      // basically die and wait for WDT to reset me
      while (1);
    }
  }
  Serial.println("MQTT Connected!");
}


and if you still want to use and flash the esp8266 with Zero, you can use EspProxy
I gave it a try, and got a nice, nasty error. Will make another reply because character limits.

Java_SE_Binary

I gave it a try, and got a nice, nasty error. Will make another reply because character limits.
Code: [Select]
Arduino: 1.8.4 (Windows 10), Board: "Arduino/Genuino Zero (Native USB Port)"

Build options changed, rebuilding all
WARNING: library NeoSWSerial claims to run on (avr) architecture(s) and may be incompatible with your current board which runs on (samd) architecture(s).
C:\Users\Java\Documents\Arduino\libraries\NeoSWSerial\src\NeoSWSerial.cpp:511:6: error: #error MCU not supported by NeoSWSerial!

     #error MCU not supported by NeoSWSerial!

      ^

C:\Users\Java\Documents\Arduino\libraries\NeoSWSerial\src\NeoSWSerial.cpp: In member function 'void NeoSWSerial::listen()':

C:\Users\Java\Documents\Arduino\libraries\NeoSWSerial\src\NeoSWSerial.cpp:140:13: error: cannot convert 'volatile uint32_t* {aka volatile long unsigned int*}' to 'volatile uint8_t* {aka volatile unsigned char*}' in assignment

   rxPort    = portInputRegister( digitalPinToPort( rxPin ) );

             ^

C:\Users\Java\Documents\Arduino\libraries\NeoSWSerial\src\NeoSWSerial.cpp:143:13: error: cannot convert 'volatile uint32_t* {aka volatile long unsigned int*}' to 'volatile uint8_t* {aka volatile unsigned char*}' in assignment

   txPort    = portOutputRegister( digitalPinToPort( txPin ) );

             ^

C:\Users\Java\Documents\Arduino\libraries\NeoSWSerial\src\NeoSWSerial.cpp:155:7: error: 'TCCR2A' was not declared in this scope

       TCCR2A = 0x00;

       ^

C:\Users\Java\Documents\Arduino\libraries\NeoSWSerial\src\NeoSWSerial.cpp:156:7: error: 'TCCR2B' was not declared in this scope

       TCCR2B = 0x03;  // divide by 32

       ^

C:\Users\Java\Documents\Arduino\libraries\NeoSWSerial\src\NeoSWSerial.cpp:160:52: error: 'digitalPinToPCMSK' was not declared in this scope

   volatile uint8_t *pcmsk = digitalPinToPCMSK(rxPin);

                                                    ^

C:\Users\Java\Documents\Arduino\libraries\NeoSWSerial\src\NeoSWSerial.cpp:197:24: error: 'SREG' was not declared in this scope

     uint8_t prevSREG = SREG;

                        ^

C:\Users\Java\Documents\Arduino\libraries\NeoSWSerial\src\NeoSWSerial.cpp:198:9: error: 'cli' was not declared in this scope

     cli();

         ^

C:\Users\Java\Documents\Arduino\libraries\NeoSWSerial\src\NeoSWSerial.cpp:200:66: error: 'digitalPinToPCMSKbit' was not declared in this scope

       *pcmsk                    |= _BV(digitalPinToPCMSKbit(rxPin));

                                                                  ^

C:\Users\Java\Documents\Arduino\libraries\NeoSWSerial\src\NeoSWSerial.cpp:200:67: error: '_BV' was not declared in this scope

       *pcmsk                    |= _BV(digitalPinToPCMSKbit(rxPin));

                                                                   ^

C:\Users\Java\Documents\Arduino\libraries\NeoSWSerial\src\NeoSWSerial.cpp:201:31: error: 'digitalPinToPCICR' was not declared in this scope

       *digitalPinToPCICR(rxPin) |= _BV(digitalPinToPCICRbit(rxPin));

                               ^

C:\Users\Java\Documents\Arduino\libraries\NeoSWSerial\src\NeoSWSerial.cpp:201:66: error: 'digitalPinToPCICRbit' was not declared in this scope

       *digitalPinToPCICR(rxPin) |= _BV(digitalPinToPCICRbit(rxPin));

                                                                  ^

C:\Users\Java\Documents\Arduino\libraries\NeoSWSerial\src\NeoSWSerial.cpp: In member function 'void NeoSWSerial::ignore()':

C:\Users\Java\Documents\Arduino\libraries\NeoSWSerial\src\NeoSWSerial.cpp:214:54: error: 'digitalPinToPCMSK' was not declared in this scope

     volatile uint8_t *pcmsk = digitalPinToPCMSK(rxPin);

                                                      ^

C:\Users\Java\Documents\Arduino\libraries\NeoSWSerial\src\NeoSWSerial.cpp:216:24: error: 'SREG' was not declared in this scope

     uint8_t prevSREG = SREG;

                        ^

C:\Users\Java\Documents\Arduino\libraries\NeoSWSerial\src\NeoSWSerial.cpp:217:9: error: 'cli' was not declared in this scope

     cli();

         ^

C:\Users\Java\Documents\Arduino\libraries\NeoSWSerial\src\NeoSWSerial.cpp:221:33: error: 'digitalPinToPCICR' was not declared in this scope

         *digitalPinToPCICR(rxPin) &= ~_BV(digitalPinToPCICRbit(rxPin));

                                 ^

C:\Users\Java\Documents\Arduino\libraries\NeoSWSerial\src\NeoSWSerial.cpp:221:69: error: 'digitalPinToPCICRbit' was not declared in this scope

         *digitalPinToPCICR(rxPin) &= ~_BV(digitalPinToPCICRbit(rxPin));

                                                                     ^

C:\Users\Java\Documents\Arduino\libraries\NeoSWSerial\src\NeoSWSerial.cpp:221:70: error: '_BV' was not declared in this scope

         *digitalPinToPCICR(rxPin) &= ~_BV(digitalPinToPCICRbit(rxPin));

                                                                      ^

C:\Users\Java\Documents\Arduino\libraries\NeoSWSerial\src\NeoSWSerial.cpp:222:50: error: 'digitalPinToPCMSKbit' was not declared in this scope

         *pcmsk &= ~_BV(digitalPinToPCMSKbit(rxPin));

                                                  ^

C:\Users\Java\Documents\Arduino\libraries\NeoSWSerial\src\NeoSWSerial.cpp: In member function 'virtual int NeoSWSerial::available()':

C:\Users\Java\Documents\Arduino\libraries\NeoSWSerial\src\NeoSWSerial.cpp:257:9: error: 'cli' was not declared in this scope

     cli();

         ^

C:\Users\Java\Documents\Arduino\libraries\NeoSWSerial\src\NeoSWSerial.cpp:262:9: error: 'sei' was not declared in this scope

     sei();

         ^

C:\Users\Java\Documents\Arduino\libraries\NeoSWSerial\src\NeoSWSerial.cpp: In member function 'void NeoSWSerial::attachInterrupt(NeoSWSerial::isr_t)':

C:\Users\Java\Documents\Arduino\libraries\NeoSWSerial\src\NeoSWSerial.cpp:285:21: error: 'SREG' was not declared in this scope

   uint8_t oldSREG = SREG;

                     ^

C:\Users\Java\Documents\Arduino\libraries\NeoSWSerial\src\NeoSWSerial.cpp:286:7: error: 'cli' was not declared in this scope

   cli();

       ^

C:\Users\Java\Documents\Arduino\libraries\NeoSWSerial\src\NeoSWSerial.cpp: In static member function 'static void NeoSWSerial::rxISR(uint8_t)':

C:\Users\Java\Documents\Arduino\libraries\NeoSWSerial\src\NeoSWSerial.cpp:308:16: error: 'TCNTX' was not declared in this scope

   uint8_t t0 = TCNTX;            // time of data transition (plus ISR latency)

                ^

C:\Users\Java\Documents\Arduino\libraries\NeoSWSerial\src\NeoSWSerial.cpp: In member function 'bool NeoSWSerial::checkRxTime()':

C:\Users\Java\Documents\Arduino\libraries\NeoSWSerial\src\NeoSWSerial.cpp:383:28: error: 'TCNTX' was not declared in this scope

       uint8_t  t0        = TCNTX; // now

                            ^

In file included from C:\Users\Java\Documents\Arduino\libraries\NeoSWSerial\src/NeoSWSerial.h:4:0,

                 from C:\Users\Java\Documents\Arduino\libraries\NeoSWSerial\src\NeoSWSerial.cpp:32:

C:\Users\Java\Documents\Arduino\libraries\NeoSWSerial\src\NeoSWSerial.cpp: In member function 'virtual size_t NeoSWSerial::write(uint8_t)':

C:\Users\Java\Documents\Arduino\libraries\NeoSWSerial\src\NeoSWSerial.cpp:531:50: error: 'digitalPinToPCICRbit' was not declared in this scope

   uint8_t PCIbit = bit(digitalPinToPCICRbit(rxPin));

                                                  ^

C:\Users\Java\AppData\Local\Arduino15\packages\arduino\hardware\samd\1.6.20\cores\arduino/Arduino.h:120:25: note: in definition of macro 'bit'

 #define bit(b) (1UL << (b))

                         ^

C:\Users\Java\Documents\Arduino\libraries\NeoSWSerial\src\NeoSWSerial.cpp:533:22: error: 'SREG' was not declared in this scope

   uint8_t prevSREG = SREG;

                      ^

C:\Users\Java\Documents\Arduino\libraries\NeoSWSerial\src\NeoSWSerial.cpp:534:7: error: 'cli' was not declared in this scope

   cli();        // send the character with interrupts disabled

       ^

C:\Users\Java\Documents\Arduino\libraries\NeoSWSerial\src\NeoSWSerial.cpp:536:18: error: 'TCNTX' was not declared in this scope

     uint8_t t0 = TCNTX; // start time

                  ^

C:\Users\Java\Documents\Arduino\libraries\NeoSWSerial\src\NeoSWSerial.cpp:561:13: error: 'PCI_FLAG_REGISTER' was not declared in this scope

         if (PCI_FLAG_REGISTER & PCIbit) {

             ^

exit status 1
Error compiling for board Arduino/Genuino Zero (Native USB Port).

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

Juraj

#8
Jan 17, 2019, 07:00 pm Last Edit: Jan 17, 2019, 07:01 pm by Juraj
Code: [Select]
Arduino: 1.8.4 (Windows 10), Board: "Arduino/Genuino Zero (Native USB Port)"

Build options changed, rebuilding all
WARNING: library NeoSWSerial claims to run on (avr) architecture(s) and may be incompatible with your current board which runs on (samd) architecture(s).
C:\Users\Java\Documents\Arduino\libraries\NeoSWSerial\src\NeoSWSerial.cpp:511:6: error: #error MCU not supported by NeoSWSerial!

     #error MCU not supported by NeoSWSerial!

      ^

C:\Users\Java\Documents\Arduino\libraries\NeoSWSerial\src\NeoSWSerial.cpp: In member function 'void NeoSWSerial::listen()':

C:\Users\Java\Documents\Arduino\libraries\NeoSWSerial\src\NeoSWSerial.cpp:140:13: error: cannot convert 'volatile uint32_t* {aka volatile long unsigned int*}' to 'volatile uint8_t* {aka volatile unsigned char*}' in assignment

   rxPort    = portInputRegister( digitalPinToPort( rxPin ) );

             ^

C:\Users\Java\Documents\Arduino\libraries\NeoSWSerial\src\NeoSWSerial.cpp:143:13: error: cannot convert 'volatile uint32_t* {aka volatile long unsigned int*}' to 'volatile uint8_t* {aka volatile unsigned char*}' in assignment

   txPort    = portOutputRegister( digitalPinToPort( txPin ) );

             ^

C:\Users\Java\Documents\Arduino\libraries\NeoSWSerial\src\NeoSWSerial.cpp:155:7: error: 'TCCR2A' was not declared in this scope

       TCCR2A = 0x00;

       ^

C:\Users\Java\Documents\Arduino\libraries\NeoSWSerial\src\NeoSWSerial.cpp:156:7: error: 'TCCR2B' was not declared in this scope

       TCCR2B = 0x03;  // divide by 32

       ^

C:\Users\Java\Documents\Arduino\libraries\NeoSWSerial\src\NeoSWSerial.cpp:160:52: error: 'digitalPinToPCMSK' was not declared in this scope

   volatile uint8_t *pcmsk = digitalPinToPCMSK(rxPin);

                                                    ^

C:\Users\Java\Documents\Arduino\libraries\NeoSWSerial\src\NeoSWSerial.cpp:197:24: error: 'SREG' was not declared in this scope

     uint8_t prevSREG = SREG;

                        ^

C:\Users\Java\Documents\Arduino\libraries\NeoSWSerial\src\NeoSWSerial.cpp:198:9: error: 'cli' was not declared in this scope

     cli();

         ^

C:\Users\Java\Documents\Arduino\libraries\NeoSWSerial\src\NeoSWSerial.cpp:200:66: error: 'digitalPinToPCMSKbit' was not declared in this scope

       *pcmsk                    |= _BV(digitalPinToPCMSKbit(rxPin));

                                                                  ^

C:\Users\Java\Documents\Arduino\libraries\NeoSWSerial\src\NeoSWSerial.cpp:200:67: error: '_BV' was not declared in this scope

       *pcmsk                    |= _BV(digitalPinToPCMSKbit(rxPin));

                                                                   ^

C:\Users\Java\Documents\Arduino\libraries\NeoSWSerial\src\NeoSWSerial.cpp:201:31: error: 'digitalPinToPCICR' was not declared in this scope

       *digitalPinToPCICR(rxPin) |= _BV(digitalPinToPCICRbit(rxPin));

                               ^

C:\Users\Java\Documents\Arduino\libraries\NeoSWSerial\src\NeoSWSerial.cpp:201:66: error: 'digitalPinToPCICRbit' was not declared in this scope

       *digitalPinToPCICR(rxPin) |= _BV(digitalPinToPCICRbit(rxPin));

                                                                  ^

C:\Users\Java\Documents\Arduino\libraries\NeoSWSerial\src\NeoSWSerial.cpp: In member function 'void NeoSWSerial::ignore()':

C:\Users\Java\Documents\Arduino\libraries\NeoSWSerial\src\NeoSWSerial.cpp:214:54: error: 'digitalPinToPCMSK' was not declared in this scope

     volatile uint8_t *pcmsk = digitalPinToPCMSK(rxPin);

                                                      ^

C:\Users\Java\Documents\Arduino\libraries\NeoSWSerial\src\NeoSWSerial.cpp:216:24: error: 'SREG' was not declared in this scope

     uint8_t prevSREG = SREG;

                        ^

C:\Users\Java\Documents\Arduino\libraries\NeoSWSerial\src\NeoSWSerial.cpp:217:9: error: 'cli' was not declared in this scope

     cli();

         ^

C:\Users\Java\Documents\Arduino\libraries\NeoSWSerial\src\NeoSWSerial.cpp:221:33: error: 'digitalPinToPCICR' was not declared in this scope

         *digitalPinToPCICR(rxPin) &= ~_BV(digitalPinToPCICRbit(rxPin));

                                 ^

C:\Users\Java\Documents\Arduino\libraries\NeoSWSerial\src\NeoSWSerial.cpp:221:69: error: 'digitalPinToPCICRbit' was not declared in this scope

         *digitalPinToPCICR(rxPin) &= ~_BV(digitalPinToPCICRbit(rxPin));

                                                                     ^

C:\Users\Java\Documents\Arduino\libraries\NeoSWSerial\src\NeoSWSerial.cpp:221:70: error: '_BV' was not declared in this scope

         *digitalPinToPCICR(rxPin) &= ~_BV(digitalPinToPCICRbit(rxPin));

                                                                      ^

C:\Users\Java\Documents\Arduino\libraries\NeoSWSerial\src\NeoSWSerial.cpp:222:50: error: 'digitalPinToPCMSKbit' was not declared in this scope

         *pcmsk &= ~_BV(digitalPinToPCMSKbit(rxPin));

                                                  ^

C:\Users\Java\Documents\Arduino\libraries\NeoSWSerial\src\NeoSWSerial.cpp: In member function 'virtual int NeoSWSerial::available()':

C:\Users\Java\Documents\Arduino\libraries\NeoSWSerial\src\NeoSWSerial.cpp:257:9: error: 'cli' was not declared in this scope

     cli();

         ^

C:\Users\Java\Documents\Arduino\libraries\NeoSWSerial\src\NeoSWSerial.cpp:262:9: error: 'sei' was not declared in this scope

     sei();

         ^

C:\Users\Java\Documents\Arduino\libraries\NeoSWSerial\src\NeoSWSerial.cpp: In member function 'void NeoSWSerial::attachInterrupt(NeoSWSerial::isr_t)':

C:\Users\Java\Documents\Arduino\libraries\NeoSWSerial\src\NeoSWSerial.cpp:285:21: error: 'SREG' was not declared in this scope

   uint8_t oldSREG = SREG;

                     ^

C:\Users\Java\Documents\Arduino\libraries\NeoSWSerial\src\NeoSWSerial.cpp:286:7: error: 'cli' was not declared in this scope

   cli();

       ^

C:\Users\Java\Documents\Arduino\libraries\NeoSWSerial\src\NeoSWSerial.cpp: In static member function 'static void NeoSWSerial::rxISR(uint8_t)':

C:\Users\Java\Documents\Arduino\libraries\NeoSWSerial\src\NeoSWSerial.cpp:308:16: error: 'TCNTX' was not declared in this scope

   uint8_t t0 = TCNTX;            // time of data transition (plus ISR latency)

                ^

C:\Users\Java\Documents\Arduino\libraries\NeoSWSerial\src\NeoSWSerial.cpp: In member function 'bool NeoSWSerial::checkRxTime()':

C:\Users\Java\Documents\Arduino\libraries\NeoSWSerial\src\NeoSWSerial.cpp:383:28: error: 'TCNTX' was not declared in this scope

       uint8_t  t0        = TCNTX; // now

                            ^

In file included from C:\Users\Java\Documents\Arduino\libraries\NeoSWSerial\src/NeoSWSerial.h:4:0,

                 from C:\Users\Java\Documents\Arduino\libraries\NeoSWSerial\src\NeoSWSerial.cpp:32:

C:\Users\Java\Documents\Arduino\libraries\NeoSWSerial\src\NeoSWSerial.cpp: In member function 'virtual size_t NeoSWSerial::write(uint8_t)':

C:\Users\Java\Documents\Arduino\libraries\NeoSWSerial\src\NeoSWSerial.cpp:531:50: error: 'digitalPinToPCICRbit' was not declared in this scope

   uint8_t PCIbit = bit(digitalPinToPCICRbit(rxPin));

                                                  ^

C:\Users\Java\AppData\Local\Arduino15\packages\arduino\hardware\samd\1.6.20\cores\arduino/Arduino.h:120:25: note: in definition of macro 'bit'

 #define bit(b) (1UL << (b))

                         ^

C:\Users\Java\Documents\Arduino\libraries\NeoSWSerial\src\NeoSWSerial.cpp:533:22: error: 'SREG' was not declared in this scope

   uint8_t prevSREG = SREG;

                      ^

C:\Users\Java\Documents\Arduino\libraries\NeoSWSerial\src\NeoSWSerial.cpp:534:7: error: 'cli' was not declared in this scope

   cli();        // send the character with interrupts disabled

       ^

C:\Users\Java\Documents\Arduino\libraries\NeoSWSerial\src\NeoSWSerial.cpp:536:18: error: 'TCNTX' was not declared in this scope

     uint8_t t0 = TCNTX; // start time

                  ^

C:\Users\Java\Documents\Arduino\libraries\NeoSWSerial\src\NeoSWSerial.cpp:561:13: error: 'PCI_FLAG_REGISTER' was not declared in this scope

         if (PCI_FLAG_REGISTER & PCIbit) {

             ^

exit status 1
Error compiling for board Arduino/Genuino Zero (Native USB Port).

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.


are you a coder or a copy/paster? that sketch is for AVR, but it needs only small changes. you have hardware Serial1. remove the software serial part
You can't write an Arduino sketch if you didn't learn programming. Not the language, but the concepts of programming - algorithms and data types.

Java_SE_Binary

are you a coder or a copy/paster? that sketch is for AVR, but it needs only small changes. you have hardware Serial1. remove the software serial part
Fixed and uploaded. ESP still is not responding to upload attempts.

Juraj

did you tyr the Se
Fixed and uploaded. ESP still is not responding to upload attempts.
is the esp8266 in flashing mode? (io 0 LOW at boot)

did you try SerialPassthrough sketch? (from basic examples)
You can't write an Arduino sketch if you didn't learn programming. Not the language, but the concepts of programming - algorithms and data types.

Java_SE_Binary

did you tyr the Se
is the esp8266 in flashing mode? (io 0 LOW at boot)

did you try SerialPassthrough sketch? (from basic examples)
GPIO 0 is connected to the ground pin of my Arduino.

SerialPassthrough sketch with the baudrates changed to 115200 does not work.

Juraj

so I have a MKR Zero and I flashed now the esp8266 over SerialPassthrough at first try. MKR Zero has only native USB port
You can't write an Arduino sketch if you didn't learn programming. Not the language, but the concepts of programming - algorithms and data types.

Java_SE_Binary

When I try going through the Arduino Zero's Native USB port, I get this error message.

Code: [Select]
Arduino: 1.8.4 (Windows 10), Board: "Generic ESP8266 Module, 80 MHz, Flash, Enabled, ck, 26 MHz, 40MHz, DOUT, 1M (no SPIFFS), 2, v2 Lower Memory, Disabled, None, Only Sketch, 115200"

Archiving built core (caching) in: C:\Users\Java\AppData\Local\Temp\arduino_cache_52649\core\core_esp8266_esp8266_generic_xtal_80,vt_flash,exception_enabled,ResetMethod_ck,CrystalFreq_26,FlashFreq_40,FlashMode_dout,eesz_1M,led_2,ip_lm2f,dbg_Disabled,lvl_None____,wipe_none,baud_115200_159e75d41891d1e4fb711824f439b28b.a
Sketch uses 312176 bytes (30%) of program storage space. Maximum is 1023984 bytes.
Global variables use 28528 bytes (34%) of dynamic memory, leaving 53392 bytes for local variables. Maximum is 81920 bytes.
C:\Users\Java\AppData\Local\Arduino15\packages\esp8266\tools\esptool\2.5.0-3-20ed2b9/esptool.exe -vv -cd ck -cb 115200 -cp COM8 -ca 0x00000 -cf C:\Users\Java\AppData\Local\Temp\arduino_build_868622/MQTT.ino.bin
esptool v0.4.13-1-gf80ae31 - (c) 2014 Ch. Klippel <ck@atelier-klippel.de>
setting board to ck
setting baudrate from 115200 to 115200
setting port from COM1 to COM8
setting address from 0x00000000 to 0x00000000
espcomm_upload_file
espcomm_upload_mem
setting serial port timeouts to 1000 ms
opening bootloader
resetting board
trying to connect
flush start
setting serial port timeouts to 1 ms
setting serial port timeouts to 1000 ms
flush complete
espcomm_send_command: sending command header
wrote 0, requested 8
error: failed sending 8 bytes
espcomm_send_command: sending command payload
wrote 0, requested 36
error: failed sending 36 bytes
wrote 0, requested 1
error: failed sending 0xC0
read 0, requested 1
trying to connect
flush start
setting serial port timeouts to 1 ms
setting serial port timeouts to 1000 ms
flush complete
wrote 0, requested 1
error: failed sending 0xC0
espcomm_send_command: sending command header
wrote 0, requested 8
error: failed sending 8 bytes
espcomm_send_command: sending command payload
wrote 0, requested 36
error: failed sending 36 bytes
wrote 0, requested 1
error: failed sending 0xC0
read 0, requested 1
trying to connect
flush start
setting serial port timeouts to 1 ms
setting serial port timeouts to 1000 ms
flush complete
wrote 0, requested 1
error: failed sending 0xC0
espcomm_send_command: sending command header
wrote 0, requested 8
error: failed sending 8 bytes
espcomm_send_command: sending command payload
wrote 0, requested 36
error: failed sending 36 bytes
wrote 0, requested 1
error: failed sending 0xC0
read 0, requested 1
resetting board
trying to connect
flush start
setting serial port timeouts to 1 ms
setting serial port timeouts to 1000 ms
flush complete
wrote 0, requested 1
error: failed sending 0xC0
espcomm_send_command: sending command header
wrote 0, requested 8
error: failed sending 8 bytes
espcomm_send_command: sending command payload
wrote 0, requested 36
error: failed sending 36 bytes
wrote 0, requested 1
error: failed sending 0xC0
read 0, requested 1
trying to connect
flush start
setting serial port timeouts to 1 ms
setting serial port timeouts to 1000 ms
flush complete
wrote 0, requested 1
error: failed sending 0xC0
espcomm_send_command: sending command header
wrote 0, requested 8
error: failed sending 8 bytes
espcomm_send_command: sending command payload
wrote 0, requested 36
error: failed sending 36 bytes
wrote 0, requested 1
error: failed sending 0xC0
read 0, requested 1
trying to connect
flush start
setting serial port timeouts to 1 ms
setting serial port timeouts to 1000 ms
flush complete
wrote 0, requested 1
error: failed sending 0xC0
espcomm_send_command: sending command header
wrote 0, requested 8
error: failed sending 8 bytes
espcomm_send_command: sending command payload
wrote 0, requested 36
error: failed sending 36 bytes
wrote 0, requested 1
error: failed sending 0xC0
read 0, requested 1
resetting board
trying to connect
flush start
setting serial port timeouts to 1 ms
setting serial port timeouts to 1000 ms
flush complete
wrote 0, requested 1
error: failed sending 0xC0
espcomm_send_command: sending command header
wrote 0, requested 8
error: failed sending 8 bytes
espcomm_send_command: sending command payload
wrote 0, requested 36
error: failed sending 36 bytes
wrote 0, requested 1
error: failed sending 0xC0
read 0, requested 1
trying to connect
flush start
setting serial port timeouts to 1 ms
setting serial port timeouts to 1000 ms
flush complete
wrote 0, requested 1
error: failed sending 0xC0
espcomm_send_command: sending command header
wrote 0, requested 8
error: failed sending 8 bytes
espcomm_send_command: sending command payload
wrote 0, requested 36
error: failed sending 36 bytes
wrote 0, requested 1
error: failed sending 0xC0
read 0, requested 1
trying to connect
flush start
setting serial port timeouts to 1 ms
setting serial port timeouts to 1000 ms
flush complete
wrote 0, requested 1
error: failed sending 0xC0
espcomm_send_command: sending command header
wrote 0, requested 8
error: failed sending 8 bytes
espcomm_send_command: sending command payload
wrote 0, requested 36
error: failed sending 36 bytes
wrote 0, requested 1
error: failed sending 0xC0
read 0, requested 1
warning: espcomm_sync failed
error: espcomm_open failed
error: espcomm_upload_mem failed
error: espcomm_upload_mem failed

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.


The current settings for upload are attached, as those are what the board reported when I called AT+RST. Not sure if I have them quite set correctly.



Go Up