sparkfun / SparkFun_Qwiic_OpenLog_Arduino_Library

Control the I2C based Qwiic OpenLog with ease! This library makes reading, writing, and even arithmetic easy.
Other
17 stars 9 forks source link

Unable to log data with OpenLog and a ESP32 Dev Module #21

Open StronglyTyped-SendKeys opened 11 months ago

StronglyTyped-SendKeys commented 11 months ago

Subject of the issue

In the Qwiic OpenLog Hookup Guide there is a note, "The Qwiic OpenLog utilizes clock stretching, which some I2C master devices like ESP32 can't handle. To avoid this, you may have to only send/read bytes one at a time to receive proper data."

I have attempted several methods to send bytes to one at a time but without any success. I also am not able to find an example of how to do this.

Your workbench

The OpenLog is also wired to 2 sensors, a SparkFun Micro Temperature Sensor - STTS22H (Qwiic) and a SparkFun Spectral UV Sensor - AS7331 (Qwiic) using 2 x 50mm Qwiic Cables.

I'm reasonably confident that the wiring is correct as I am able to read the values from the sensors and display them in the serial monitor.

Steps to reproduce

Tell us how to reproduce this issue. Please post stripped down example code demonstrating your issue. The following code shows the test that I attempted. Each section, A, B, C, D & E was run separately. However no log files were generated on the SD card.

I also ran the same code on a Arduino Mega 2560 and a log file was generated containing letters A, B, C and D but not E. The same FAT formatted SD card was used for both boards.

include "Wire.h"

include "SparkFun_Qwiic_OpenLog_Arduino_Library.h"

include "Arduino.h"

OpenLog myLog;

void setup() { Wire.begin(); //Initialize I2C myLog.begin(); Serial.begin(9600); }

void loop() {

//Section A
myLog.write('A');
Serial.println("A");
//Section A

//Section B
myLog.writeString("B");
Serial.println("B");
//Section B

//Section C
myLog.print('C');
Serial.println("C");
//Section C

//Section D
myLog.println("D");
Serial.println("D");
//Section D

//Section E    
Wire.beginTransmission(0x2A);
Wire.write('E'); 
Serial.println(Wire.endTransmission());  
//Section E  

delay(1000);
myLog.syncFile();
myLog.clearWriteError();
delay(1000);

}

Expected behavior

Tell us what should happen Ideally the OpenLog should work with the ESP32 using the same code as the Arduino Mega 2560 (ie with the Log.println() function) but if this is not possible due to problems with clock stretching then it should work with functions that write one byte at a time (presumably Log.write() or Log.writeString()).

Actual behavior

Tell us what happens instead. No log files are produced at all (not even empty files).