Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - dblewis76

Pages: 1
1
General Discussion / Re: MicroSD fails to initialize
« on: August 17, 2022, 04:03:54 PM »
Thank you RĂ©na. That worked and I can now write to the SD card.

2
General Discussion / Re: MicroSD fails to initialize
« on: August 14, 2022, 11:01:43 PM »
I have the same issue using the MicroSD with the TinyScreen+. I aslo have the
older TinyScreen and I can write and read the SD card from the TinyScreen. I
created the TinyScreen+ "stack" as follows:

Top card: TinyScreen+
Next card: TinyGPS
Next card: MicroSD
(I have also tried this scenario without the TinyGPS with no difference)

And the TinyScreen stack:

Top card: TinyScreen
Next card: Ribbon cable
Next card: TinyUSB
Next card: TinyDuino

The ribbon cable is connected between the two stacks, both microprocessors are
powered off.

I compiled the simple SD_Write sketch below with these settings for the ATmega328P
(I am using the Eclipse plugin Sloeber):

Platform folder: .../arduino/hardware/avr/1.8.3
Board: Arduino Nano
Upload Protocol: Default
Port: /dev/cu.usbserial-DO00BU5U
Processor: ATmega328P (Old Bootloader)

I plugged the serial USB into my Mac and the TinyScreen.
I inserted the SD card in the MicroSD and powered on the TinyScreen.
I loaded the ATmega328P sketch into the TinyDuino and was able to
write a file to the SD card. I was then able to read the file back on my Mac.

I compiled the simple SD_Write sketch below with these settings for the SAMD21:
Platform folder: .../arduino/hardware/samd/1.8.11
Board: Arduino Zero (Native USB Port)
Upload Protocol: Default
Port: /dev/cu.usbmodem14101

Then I powered off the TinyScreen, removed the ribbon cable, moved the serial cable to the TinyScreen+ and
powered on the TinyScreen+. I loaded the SAMD21 sketch to the TinyScreen+, but
it failed to recognize the SD card and/or reader.

To summarize, the sketch is compiled for the TinyScreen (ATmega328P) and it is able
to write the SD card. The file written can be read back on my Mac. The exact same sketch is
compiled for the TimyScreen+ (SAMD21) simpy by changing the board configuration in the IDE.
It does not recognize the MicroSD card.

Output from TinyScreen:

   dataFile: 1
   Write error: 0
   Wrote header: Date,Time,Latitude,Longitude,Alt,Speed,Course
   bytes written: 47
   dataFile: 1
   Write error: 0
   Wrote header: Date,Time,Latitude,Longitude,Alt,Speed,Course
   bytes written: 47

Data written to the file GPS.csv:

   Date,Time,Latitude,Longitude,Alt,Speed,Course
   1
   Date,Time,Latitude,Longitude,Alt,Speed,Course
   2
   Date,Time,Latitude,Longitude,Alt,Speed,Course
   3


Output from TinyScreen+:

   No SD card
   dataFile: 0
   SD card failed


Simple SD_Write sketch:

//-------------------------------------------------------------------------------
//  TinyCircuits GPS TinyShield Display Example
//  Last updated 7 April 2016
// 
//  This example uses the TinyGPS library, originally written by Mikal Hart and
//  currently forked and updated at https://github.com/florind/TinyGPS to support
//  Glonass, slightly modified to work with the GPS TinyShield.
//
//  Some GPS modules have been shipped with 4800 baud instead of 9600- try this if
//  you see bad data.
//
//  TinyCircuits, http://TinyCircuits.com
//
//-------------------------------------------------------------------------------


#include <SPI.h>
#include <SD.h>
#include <errno.h>
#include <string.h>
#include <time.h>

const int RXPin = A1, TXPin = A0;
const int chipSelect = 10;
bool cardPresent   = false;
bool doClearScreen = false;
bool logInfo       = true;
bool logHeader     = true;
const uint32_t SerialBaud = 9600*2;

const char* header = "Date,Time,Latitude,Longitude,Alt,Speed,Course";
//                    00/00/2000 21:04:02 ,33.303665,-111.982444,1157.81,-1.00,****

// Make program compatibile for all TinyCircuits processor boards
#if defined(ARDUINO_ARCH_SAMD)
  #define SerialMonitor SerialUSB
#else
  #define SerialMonitor Serial
#endif

SDLib::File dataFile;

static void smartdelay(unsigned long ms)
{
  unsigned long start = millis();
  do
  {
  } while (millis() - start < ms);
}

// The serial connection to the GPS device
//SoftwareSerial gpsDev(RXPin, TXPin);
void setup()
{
  SerialMonitor.begin(SerialBaud);//Note: Set Serial Monitor rate to 57600
  delay(100);

  // see if the card is present and can be initialized:
  if (SD.begin(chipSelect)) {
    cardPresent = true;
    smartdelay(1000);
  }
  else
  {
   SerialMonitor.println("No SD card");
   smartdelay(1000);
  }

}

time_t now = 0;
void loop()
{
   dataFile = SD.open("gps.csv", FILE_WRITE );
   SerialMonitor.print("dataFile: ");
   SerialMonitor.println(dataFile);
   if( ! dataFile )
   {
      SerialMonitor.println("SD card failed");
      while(1);
   }
   size_t written = dataFile.println(header);
   ++now;
    dataFile.println(now);

   SerialMonitor.print("Write error: ");
   SerialMonitor.println(dataFile.getWriteError());
   SerialMonitor.print("Wrote header: ");
   SerialMonitor.println(header);
   SerialMonitor.print("bytes written: ");
   SerialMonitor.println(written);

   dataFile.close();

   smartdelay(500);
}

3
TinyDuino Processors & TinyShields / Serial does not become ready
« on: May 20, 2017, 08:36:37 PM »
Using the TinyDuino, TinyDisplay and USB card I created a very simple Serial sketch and the serial device does not become ready so if I print something it is garbage. Garbage is output at the 4 second rate in the attached sketch. Input on the Mac serial device is attached in the screen shot. I use the same serial device and cable to program the TinyDuino which works fine.

So, it turns out that when I set the serial baud rate thusly:

Serial.begin(9600);

I have to create a serial port with a baud rate of 4800 and unset "Set DTR and RST".

Works fine now.

BTW this is with the "http://www.baeyens.it/eclipse/V3/" Eclipse plugin and behaves the same in OS X El Capitan and Windows 10.

4
TinyDuino Processors & TinyShields / Re: Two Dual Motor TinyShield
« on: January 20, 2017, 10:01:41 PM »
Where do I find complete documentation on using the MotorDriver class?

Pages: 1
SMF spam blocked by CleanTalk