Using ARDUINO and cloud communication to control 8 relays, it will always crash after getting 64 to 66 web page information

Go To Last Post
18 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello everyone. I come from a small company in China. Now I have developed a small project. The code is as follows.

My question is: why this code will crash and trigger the watchdog program when executed only 65 to 66 times?
I use arduino Uno development board .

 

My English is not very good, I need help from friends urgently. Thank you all

 

#include <Ethernet.h>

#include <SPI.h>

#include <avr/wdt.h>

int pin[] = {2, 3, 4, 5, 6, 7, 8, 9, A0, A1, A2, A3, A4, A5};

bool state[14];

String value = "";

byte mac[] = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0x02};

IPAddress ip(192, 168, 0, 31);

char cloudDn[] = "cloud.caffz.com";

char server[] = "www.caffz.com";

EthernetClient client;

void setup() {

  Serial.begin(4800);

  Serial.println("Hello CAFFZ!");

  initialize();

  wdt_enable(WDTO_8S);

}

void loop() {

  for (int i = 0; i < sizeof(state) / sizeof(state[0]); i++) {

    if (state[i]) {

      value.concat('1');

    } else {

      value.concat('0');

    }

  }

  request();

}

void initialize() {

  String command = "";

  for (int i = 0; i < sizeof(pin) / sizeof(pin[0]); i++) {

    pinMode(pin[i], OUTPUT);

    command.concat("0");

  }

  execute(command);

}

void execute(String command) {

  for (int i = 0; i < command.length(); i++) {

    if (command.charAt(i) == '0') {

      digitalWrite(pin[i], LOW);

      state[i] = false;

    } else if (command.charAt(i) == '1') {

      digitalWrite(pin[i], HIGH);

      state[i] = true;

    }

    //Serial.print("No.");

    //Serial.print(i + 1);

    //Serial.print(" ");

    //Serial.println(command.charAt(i));

  }

}

void check() {

  if (!Ethernet.begin(mac)) {

    Ethernet.begin(mac, ip);

  }

  Serial.print("local IP: ");

  Serial.println(Ethernet.localIP());

}

void request() {

  check();

  if (!client.connect(cloudDn, 12345)) {

    String str = getCloudIp();

    if (str != "") {

      int num[4];

      for (int i = 0; i < 4; i++) {

        int idx = str.indexOf(".");

        if (idx != -1) {

          num[i] = str.substring(0, idx).toInt();

          str = str.substring(idx + 1);

        } else {

          num[i] = str.toInt();

        }

      }

      IPAddress cloudIp(num[0], num[1], num[2], num[3]);

      if (!client.connect(cloudIp, 12345)) {

        return;

      }

    } else {

      return;

    }

  }

  client.print("GET /smartfarm2/a2268.php?c=control&a=select&number=226.8.3.1.1-8&value=");

  client.print(value);

  client.println("&token=www.caffz.com HTTP/1.1");

  client.println("Host: cloud.caffz.com");

  client.println("Connection: keep-alive");

  //client.println("Connection: close");

  client.println();

  unsigned long start = millis();

  String reply = "";

  int sign = 0;

  while (true) {

    while (client.available()) {

      char c = client.read();

      reply.concat(c);

      if (c == ' ') {

        if (sign == 0) {

          if (reply.indexOf("200") != -1) {

            sign = 1;

          } else {

            sign = -1;

          }

        } else if (sign == 1) {

          if (reply == " ") {

            sign = 2;

            delay(500);

          }

        }

        Serial.print(reply);

        reply = "";

      }

    }

    if (sign == 2 || millis() - start > 5000) {

      break;

    }

  }

  Serial.println(reply);

  client.stop();

  if (sign == 2) {

    execute(reply);

    wdt_reset();

  }

}

String getCloudIp() {

  if (client.connect(server, 80)) {

    client.println("GET /czip/ip.php HTTP/1.1");

    client.println("Host: www.caffz.com");

    client.println("Connection: keep-alive");

    //client.println("Connection: close");

    client.println();

    unsigned long start = millis();

    String reply = "";

    int sign = 0;

    while (true) {

      while (client.available()) {

        char c = client.read();

        reply.concat(c);

        if (c == ' ') {

          if (sign == 0) {

            if (reply.indexOf("200") != -1) {

              sign = 1;

            } else {

              sign = -1;

            }

          } else if (sign == 1) {

            if (reply == " ") {

              sign = 2;

              delay(500);

            }

          }

          Serial.print(reply);

          reply = "";

        }

      }

      if (sign == 2 || millis() - start > 5000) {

        break;

      }

    }

    Serial.print("cloud IP: ");

    Serial.println(reply);

    client.stop();

    if (sign == 2) {

      return reply;

    }

  }

  return "";

}

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Sounds like there could be a memory leak ?

 

The first step would be to instrument your code - so that you can see what's happening when it's running normally, what changes when it goes wrong, and where it is going wrong.

 

Thread here about building-in debug facilities for your systesm: https://www.avrfreaks.net/forum/...

 

See also: https://www.avrfreaks.net/commen...

 

EDIT

 

I can see a lot of value.concat() and command.concat() calls - but where do you clear those strings ?

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
Last Edited: Fri. Oct 2, 2020 - 08:03 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

thank you very much

 

I will recheck according to your suggestion

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I have a gratitude, can you help me modify the code. I want to know how to clean up the memory, such as value.concat() and command.concat()

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

aren't those just standard C++ String stuff?

 

EDIT

 

Maybe not: http://www.cplusplus.com/reference/string/string/ - the '+' operator does concatenation

 

EDIT 2

 

It's Arduino: https://www.arduino.cc/reference/en/language/variables/data-types/string/functions/concat/

 

Note that it has a success/fail return - you should be checking that!

 

I would suggest that you look at all the methods you're using, and ensure that you check all return values.

 

EDIT 3

 

Arduino Strings tutorial/examples: https://www.arduino.cc/en/Tutorial/BuiltInExamples#8-strings

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
Last Edited: Fri. Oct 2, 2020 - 10:04 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

china-caffz wrote:

void execute(String command) {

I'm not a C++ expert, but isn't that putting a copy of the entire string onto the stack ?

 

So, if you're constantly appending to that string, and never clear it, you're going to blow up the stack sooner or later ?

 

Wouldn't it be better to use a reference ?

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

A few general remarks:

  • you are using HTTP GET requests in the cloud/internet context. Be aware and cautious with caching (on the server or intermediate) which could give unexpected results.
  • you are resolving DNS for each request using an HTTP DNS resolver in the loop. This could result in quit a big number of requests which could lead to too many requests responses. Is the IP likely to change that often? You might want to cache the ip on your end.
  • as you are working in the cloud/internet using plain HTTP connections is not a good idea. You should always go for SSL/TLS connections. Otherwise it becomes easy to spoof and make your relays do different things that you wanted. In that case you have chosen the wrong workhorse to do the job because SSL on the Arduino is a no go. You would be better of looking at an ARM/Rpi for this.
  • you, as a client, are polling the cloud service for commands. Depending on the frequency on which the command change, this might generate lost of traffic for little change. You'd better not be on a metered connection for this. Would it be possible to push the commands from the cloud service towards your device as this would save lots of traffic. You would obviously need to move towards ARM for this also.

 

In your code you start/stop your client for each request. Can't you keep it and reuse?

 

When you are blocking for the HTTP response this could take a while and be out of your control. Is your wdt prepared for that?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello everyone, I am here again.
After my imperfect debugging, I think that the watchdog time is set globally which caused this problem.
I tried to observe the memory consumed by the microcontroller, and the stable output number is 1184, which proves that there is no leakage of memory.
After I turned off the watchdog function, the microcontroller restarted without refreshing 65 times. Instead, it continued to run for 30 minutes.

 

this my code

#include <Ethernet.h>
#include <SPI.h>
#include <avr/wdt.h>

int pin[] = {2, 3, 4, 5, 6, 7, 8, 9, A0, A1, A2, A3, A4, A5};
bool state[14];
String value = "";
byte mac[] = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0x52};
IPAddress ip(192, 168, 0, 52);
char cloudDn[] = "cloud.caffz.com";
char server[] = "www.caffz.com";
EthernetClient client;

/*
int freeRam () 
{
  extern int __heap_start, *__brkval; 
  int v; 
  return (int) &v - (__brkval == 0 ? (int) &__heap_start : (int) __brkval); 
}
*/
void setup() {
  Serial.begin(4800);
  Serial.println("Hello CAFFZ!");
 // Serial.println(freeRam());  
  initialize();
 // wdt_enable(WDTO_8S);
    
}

void loop() {
 /* for (int i = 0; i < sizeof(state) / sizeof(state[0]); i++) {
    if (state[i]) {
      value.concat('1');
    } else {
      value.concat('0');
    }
  
  }*/
  wdt_disable();
   request();
  wdt_enable(WDTO_8S);
   wdt_reset();
   //delay(1500);
 
}


void initialize() {
  String command = "";
  for (int i = 0; i < sizeof(pin) / sizeof(pin[0]); i++) {
    pinMode(pin[i], OUTPUT);
    command.concat("0");
  }
  execute(command);
}

void execute(String command) {
  for (int i = 0; i < command.length(); i++) {
    if (command.charAt(i) == '0') {
      digitalWrite(pin[i], LOW);
      state[i] = false;
    } else if (command.charAt(i) == '1') {
      digitalWrite(pin[i], HIGH);
      state[i] = true;
    }
    //Serial.print("No.");
    //Serial.print(i + 1);
    //Serial.print("\t");
    //Serial.println(command.charAt(i));
  }
}

void check() {
  if (!Ethernet.begin(mac)) {
    Ethernet.begin(mac, ip);
  }
  Serial.print("local IP: ");
  Serial.println(Ethernet.localIP());
}

void request() {
  check();
  if (!client.connect(cloudDn, 12345)) {
    String str = getCloudIp();
    if (str != "") {
      int num[4];
      for (int i = 0; i < 4; i++) {
        unsigned long idx = str.indexOf(".");
        if (idx != -1) {
          num[i] = str.substring(0, idx).toInt();
          str = str.substring(idx + 1);
        } else {
          num[i] = str.toInt();
        }
      }
      IPAddress cloudIp(num[0], num[1], num[2], num[3]);
      if (!client.connect(cloudIp, 12345)) {
        return;
      }
    } else {
      return;
    }
   
  }
  client.print("GET /smartfarm2/a2268.php?c=control&a=select&number=226.8.3.1.1-8&value=");
  client.print(value);
  client.println("&token=www.caffz.com HTTP/1.1");
  client.println("Host: cloud.caffz.com");
  client.println("Connection: keep-alive");
  //client.println("Connection: close");
  client.println();
  unsigned long start = millis();
  String reply = "";
  int sign = 0;
  while (true) {
    while (client.available()) {
      char c = client.read();
      reply.concat(c);
      if (c == '\n') {
        if (sign == 0) {
          if (reply.indexOf("200") != -1) {
            sign = 1;
          } else {
            sign = -1;
          }
        } else if (sign == 1) {
          if (reply == "\r\n") {
            sign = 2;
            delay(500);
          }
        }
        Serial.print(reply);
        reply = "";
      }
    }
    if (sign == 2 || millis() - start > 5000) {
      break;
    }
  }
  Serial.println(reply);
  client.stop();
  if (sign == 2) {
    execute(reply);
  
  }

  //  wdt_reset();
}

String getCloudIp() {
  if (client.connect(server, 80)) {
    client.println("GET /czip/ip.php HTTP/1.1");
    client.println("Host: www.caffz.com");
    client.println("Connection: keep-alive");
    //client.println("Connection: close");
    client.println();
    unsigned long start = millis();
    String reply = "";
    int sign = 0;
    while (true) {
      while (client.available()) {
        char c = client.read();
        reply.concat(c);
        if (c == '\n') {
          if (sign == 0) {
            if (reply.indexOf("200") != -1) {
              sign = 1;
            } else {
              sign = -1;
            }
          } else if (sign == 1) {
            if (reply == "\r\n") {
              sign = 2;
              delay(500);
            }
          }
          Serial.print(reply);
          reply = "";
        }
      }
      if (sign == 2 || millis() - start > 5000) {
        break;
      }
    }
    Serial.print("cloud IP: ");
    Serial.println(reply);
    client.stop();
    if (sign == 2) {
      return reply;
    }
  }
  return "";

}

 

 

the code ,i running is ok. At least 30 minutes, no problem .

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

thank you #7 friend.

 

i think ARM is very good plan. but i project is very small. just control my farm equipment, Such as showering . Nothing more .

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

china-caffz wrote:
project is very small. just control my farm equipment, Such as showering . Nothing more .

That's the trivial part.

 

You seem to have underestimated how much code goes into an internet link with Ethernet,  TCP/IP, HTTP, etc, etc - that's the part that warrants the ARM.

 

Remember also that "ARM" covers a wide spectrum nowadays - from Cortex-M0 (about the level of a high-end AVR) to the Cortex-A series running linux ...

 

Your application wouldn't need anything more than a Cortex-M3 - and there are suitable Arduinos for that ...

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

china-caffz wrote:
I tried to observe the memory consumed by the microcontroller

how did you do that?

 

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

my friend ,the final version code for me.

 

#include <Ethernet.h>
#include <SPI.h>
#include <avr/wdt.h>

int pin[] = {2, 3, 4, 5, 6, 7, 8, 9, A0, A1, A2, A3, A4, A5};
bool state[14];
String value = "";
byte mac[] = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0x52};
IPAddress ip(192, 168, 0, 52);
char cloudDn[] = "cloud.caffz.com";
char server[] = "www.caffz.com";
EthernetClient client;

void wdt_setup(int ii) {
      // ii为看门狗超时时间,支持以下数值:
      // 0=16毫秒, 1=32毫秒,2=64毫秒,3=128毫秒,4=250毫秒,5=500毫秒
      // 6=1秒 ,7=2秒, 8=4秒, 9=8秒
      byte bb;
      if (ii > 9 ) ii = 9;
      bb = ii & 7;
      if (ii > 7) bb |= (1 << 5);
      bb |= (1 << WDCE);
      //开始设置看门狗中断   
      MCUSR &= ~(1<<WDRF);  //清除复位标志
      WDTCSR |= (1<<WDCE) | (1<<WDE);
      //设置新的看门狗超时时间
      WDTCSR = bb;
      //设置为定时中断而不是复位
      WDTCSR |= _BV(WDIE); 
      //别忘了设置【看门狗唤醒执行函数】
}

ISR(WDT_vect){
               request();    //唤醒后执行的代码
}
/*
int freeRam () 
{
  extern int __heap_start, *__brkval; 
  int v; 
  return (int) &v - (__brkval == 0 ? (int) &__heap_start : (int) __brkval); 
}
*/
void setup() {
  Serial.begin(4800);
  Serial.println("Hello CAFFZ!");
 // Serial.println(freeRam());  
  initialize();
 // wdt_enable(WDTO_8S);
    
}

void loop() {
 /* for (int i = 0; i < sizeof(state) / sizeof(state[0]); i++) {
    if (state[i]) {
      value.concat('1');
    } else {
      value.concat('0');
    }
  
  }*/
 
  //wdt_enable(WDTO_2S);

               request();    //唤醒后执行的代码


  
//  wdt_reset();
 // wdt_disable();

   //delay(1500);
 
}




void initialize() {
  String command = "";
  for (int i = 0; i < sizeof(pin) / sizeof(pin[0]); i++) {
    pinMode(pin[i], OUTPUT);
    command.concat("0");
  }
  execute(command);
}

void execute(String command) {
  for (int i = 0; i < command.length(); i++) {
    if (command.charAt(i) == '0') {
      digitalWrite(pin[i], LOW);
      state[i] = false;
    } else if (command.charAt(i) == '1') {
      digitalWrite(pin[i], HIGH);
      state[i] = true;
    }
    //Serial.print("No.");
    //Serial.print(i + 1);
    //Serial.print("\t");
    //Serial.println(command.charAt(i));
  }
}

void check() {
  if (!Ethernet.begin(mac)) {
    Ethernet.begin(mac, ip);
  }
  Serial.print("local IP: ");
  Serial.println(Ethernet.localIP());
}

void request() {
  check();
  if (!client.connect(cloudDn, 12345)) {
    String str = getCloudIp();
    if (str != "") {
      int num[4];
      for (int i = 0; i < 4; i++) {
        unsigned long idx = str.indexOf(".");
        if (idx != -1) {
          num[i] = str.substring(0, idx).toInt();
          str = str.substring(idx + 1);
        } else {
          num[i] = str.toInt();
        }
      }
      IPAddress cloudIp(num[0], num[1], num[2], num[3]);
      if (!client.connect(cloudIp, 12345)) {
        return;
      }
    } else {
      return;
    }
   
  }
  client.print("GET /smartfarm2/a2268.php?c=control&a=select&number=226.8.3.1.1-8&value=");
  client.print(value);
  client.println("&token=www.caffz.com HTTP/1.1");
  client.println("Host: cloud.caffz.com");
  client.println("Connection: keep-alive");
  //client.println("Connection: close");
  client.println();
  unsigned long start = millis();
  String reply = "";
  int sign = 0;
  while (true) {
    while (client.available()) {
      char c = client.read();
      reply.concat(c);
      if (c == '\n') {
        if (sign == 0) {
          if (reply.indexOf("200") != -1) {
            sign = 1;
          } else {
            sign = -1;
          }
        } else if (sign == 1) {
          if (reply == "\r\n") {
            sign = 2;
            delay(500);
          }
        }
        Serial.print(reply);
        reply = "";
      }
    }
    if (sign == 2 || millis() - start > 5000) {
      break;
    }
  }
  Serial.println(reply);
  client.stop();
  if (sign == 2) {
    execute(reply);
  
  }

  //  wdt_reset();
}

String getCloudIp() {
  if (client.connect(server, 80)) {
    client.println("GET /czip/ip.php HTTP/1.1");
    client.println("Host: www.caffz.com");
    client.println("Connection: keep-alive");
    //client.println("Connection: close");
    client.println();
    unsigned long start = millis();
    String reply = "";
    int sign = 0;
    while (true) {
      while (client.available()) {
        char c = client.read();
        reply.concat(c);
        if (c == '\n') {
          if (sign == 0) {
            if (reply.indexOf("200") != -1) {
              sign = 1;
            } else {
              sign = -1;
            }
          } else if (sign == 1) {
            if (reply == "\r\n") {
              sign = 2;
              delay(500);
            }
          }
          Serial.print(reply);
          reply = "";
        }
      }
      if (sign == 2 || millis() - start > 5000) {
        break;
      }
    }
    Serial.print("cloud IP: ");
    Serial.println(reply);
    client.stop();
    if (sign == 2) {
      return reply;
    }
  }
  return "";

}

 

 

 

i change wdt  function.

 

 

I changed the watchdog function to wake up. The single-chip microcomputer currently works well. I will observe for a while and tell you whether this problem is solved. My personal feeling is that the watchdog time has not returned to 0, so after a total of 65 refreshes, the microcontroller was forced to restart.
It is also possible that the AVR watchdog of ARDUINIO has a forced restart mechanism.

 

 

Thank you very much for your reply, which gave me ideas to solve this problem.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

It is very cheap to buy a piece of ARDUINO in China, only RMB 12. It's less than 2 dollars. And the package is delivered to my home. So I like to use this microcontroller.

Last Edited: Fri. Oct 2, 2020 - 05:36 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0


china-caffz wrote:
ARDUINO ...  I like to use this microcontroller.

 

You do know that an Arduino is not a microcontroller? It contains a microcontroller, but it is not just a microcontroller.

 

Arduinos are also available based on ARM microcontrollers:

 

https://store.arduino.cc/arduino...

 

https://store.arduino.cc/arduino...

 

https://store.arduino.cc/arduino...

 

 

etc, etc, ...

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You may want to look to see what one of these ARM based Arduino DUE cost in your country, glad to here your problem may be solved.

https://store.arduino.cc/usa/due

Jim

 

 

(Possum Lodge oath) Quando omni flunkus, moritati.

"I thought growing old would take longer"

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thank you for your reply. I think DUE is worth trying to buy and use.

If I don’t come here, I don’t know that the world is so big and there are so many Microchip products.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Arduino isn't a Microchip (or even Atmel) product

 

Arduinos are available with non-Microchip/Atmel chips

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
Last Edited: Fri. Oct 2, 2020 - 07:02 PM