Sparkfun QWIIC OpenLog sd writer with Arduino R4

I am using this logger in combination with QWIIC BM280 and Clock boards attached to an Arduino R4 wifi. The BM280 and clock boards work fine but nothing (including Wire1)I have tried will induce the OpenLog to respond to the example sketches. This seems to be a common problem judging by other entries on this and other boards.

Have there been any successful uses of ths logger with the R4?

I grabbed my R4 an Qwiic Opelog to test with and can confirm they work together, although I had a hiccup myself: ensure the card is 32gb or smaller (FAT32)…mine was 128gb and caused me some unnecessary tail-chasin’

Here’s a modified version of the openlog example1 that worked for my R4 (note Wire1 changes)

/*
  This example shows how to record various text and variables to Qwiic OpenLog.
  
  Modified for Arduino UNO R4 WiFi - Uses Wire1 for Qwiic connector
  
  By: Nathan Seidle @ SparkFun Electronics
  Date: January 11th, 2020
  Modified: 2024 for Uno R4 WiFi
  License: This code is public domain but you buy me a beer if you use this 
  and we meet someday (Beerware license).

  Feel like supporting our work? Buy a board from SparkFun!
  https://www.sparkfun.com/products/15165

  This example records everything to 'log.txt'. You can change this by changing
  the name of fileName variable. For example, 'data.log' or '1.txt'.

  Recording to other files is as easy as: myLog.print("Hello world!");

  Don't forget to take the SD card out and see the results on your computer!
*/

#include <Wire.h>
#include <SparkFun_Qwiic_OpenLog_Arduino_Library.h>
OpenLog myLog; //Create instance

int fileNumber = 1; //Keeps track of which file number we are on
String fileName; //The file name we will write to

void setup() {
  Serial.begin(115200);
  while (!Serial); // Wait for Serial connection (optional but helpful)
  Serial.println("START");
  Serial.println("OpenLog Example 1 - Writing Log");

  // MODIFIED: Use Wire1.begin() for UNO R4 WiFi Qwiic connector
  Wire1.begin(); 
  
  // ADDED: Small delay to let OpenLog initialize SD card
  delay(100);
  
  Serial.println("Wire1 initialized for Qwiic connector");

  // MODIFIED: Pass the I2C address AND Wire1 to the begin() function
  // Default address is 0x2A (42 in decimal)
  if (myLog.begin(42, Wire1) == false) {
    Serial.println("OpenLog not detected. Freezing...");
    while (1);
  }
  Serial.println("OpenLog detected!");

  // MODIFIED: Removed getFileNumber() call - this method doesn't exist in the library
  // Instead, we'll just use a fixed filename or increment manually
  fileName = "log" + String(fileNumber) + ".txt";
  
  //Create a new file for this logging session
  myLog.create(fileName); //Create file if it does not exist

  Serial.print("Logging to: ");
  Serial.println(fileName);
}

void loop() {
  //Record some strings
  myLog.println("This is recorded to the OpenLog");
  myLog.println("This is the second line");

  //Record some variables
  int temp = 24;
  myLog.print("Temperature: ");
  myLog.println(temp);

  //Record millis
  myLog.print("millis: ");
  myLog.println(millis());

  //Record a comma separated line
  myLog.print(millis());
  myLog.print(",");
  myLog.print(temp);
  myLog.print(",");
  myLog.println("Status: OK");

  Serial.println("Data recorded. Check SD card.");
  
  delay(1000); //Don't pound the I2C bus too hard
}

Also note I did need to push the reset button after uploading before anything appeared in the serial monitor

Thanks so much for taking the trouble to look into this. I won’t be able to get back to it for a couple of days but will let you know the outcome.

JG