Issues with uploading from Mac Studio: Solved

Hi all,

I've recently got a new Mac Studio (Apple M1 Max chip, Monterey 12.2) for work. I'm having issues uploading a few sets of existing arduino code to Adafruit Feather boards. It will attempt to upload the code, then stop, and the board will no longer be found on the ports list. Sometimes it will apparently successfully upload, but it will get errors in the Serial Monitor (eg. "error: couldnt create file" for a logging file). I can force upload Blink or similar (or whatever you call pressing the reset button while uploading) and then it will be recognised. Standard examples from libraries seem to work fine.

I can use my Macbook (2019, i5 chip, Big Sur 11.1) to upload the same code with no issues.

So far I've tried:
-different versions of the IDE, including the one that works on the Macbook (1.8.13).
-a couple of different USB-C to Micro USB cables (including genuine Apple ones as suggested in another post).

Anyone help with suggestions? I'm not getting any error codes to help me along.

Thanks

Does the same thing happen on a windows computer?

I tried it on 2 Windows computers and it fails on both of them as well. It's a couple of sets of logging code for different sensors, one that wasn't written by me (but is being used with permission of the author), and one written by me copying across the code that creates the csv file. I'm wondering whether that part of the code is the issue, since trying the code maybe 10 at most times this morning it's created 98 different new files. It should, and previously did, create a new file only when the unit is turned on or reset. My version also tags new files with current time and date. The huge numbers of extra csv files that are being created don't have this, just 1/1/00 at 2:00.

The relevant part is:

 // see if the card is present and can be initialized:
  if (!SD.begin(chipSelect)) {
    error("Card failed, or not present");
  }
  Serial.println("card initialized.");
  
  // create a new file
  char filename[] = "LOGGER00.CSV";
  for (uint8_t i = 0; i < 100; i++) {
    filename[6] = i/10 + '0';
    filename[7] = i%10 + '0';
    if (! SD.exists(filename)) {
      // only open a new file if it doesn't exist
      logfile = SD.open(filename, FILE_WRITE); 
      break;  // leave the loop!
    }
  }
  
  if (! logfile) {
    error("couldnt create file");
  }

I can post the whole lot of it could be useful, but I think this is the only bit that's in common between the 2 sets of problematic code.

Thanks

Ok, issue seems to be solved. It's related to the RTC. I started rebuilding the code from scratch, and as soon as I put: DateTime now= rtc.now(); into the loop and tried to run the code it failed. No error codes, just crashed the board. I foolishly copied this across from another set of logging code, and neglected to include:

  #ifndef ESP8266
    while (!Serial); // wait for serial port to connect. Needed for native USB
  #endif
 
  if (! rtc.begin()) {
    Serial.println("Couldn't find RTC");
    Serial.flush();
    while (1) delay(10);
  }

in the setup.

I've put it into both sets of logging code, and both now work on my Mac Studio and the Windows PC I tested it on.

Thanks

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.