I soldered a crystal into the Teensy 3.2, and the Time program no longer runs. Prior to this it could be seen running in the serial console.
I removed the crystal, and nothing changed - the Time program still did not run.
I uploaded a different program trying to see if I just had a bad upload, and now its just confusing. The blink demo won't run, the time demo won't run, but I can run an OLED using I2C just fine.
Did a system reboot, and swapped USB cables just to be sure its not a communication issue.
I am presuming I overheated or shorted a nearby surface mount part. I can't find any evidence of that though. I was as quick as I could be with the heat, and kept my distance from other components. It seems like its just the RTC function that isn't working now or something.
Just some added info: Only external components I've run this with is the Adafruit 128x64 OLED, not including the crystal attempt.
The LED does occasionally try to blink, but it is extremely dim (barely visible in a dark room), and seems to be random.
<<Trying to delay the sinking feeling of knowing I just borked $25 and the time waiting for it to arrive within an hour of putting code to it>>
[] Complete Source Code (or a link to the code)
The Time Teensy3 example used to run, now does not.
I also included the two programs that I was running prior to the issues.
The first runs, and just graphs out random data on the oled (just wanted to see how it performed vs an atmel 328).
The second is a modified version of the Time example (the example unmodified does not run either so it has nothing to do with my modifications to the code, as even the modified version ran until the crystal). This just spits out the time on the OLED.
What is really puzzling me about this is that the Blink tutorial won't run now.
For some reason uploading any software now seems to take an age as well (several minutes).
[] Screenshot or the exact text of any error messages
I'll see if I can find my macro lense for my camera to get some upclose pix - maybe someone else spots my goofup where I didn't.
[] Which PJRC product you're using
Teensy 3.2
[] Part numbers of any other chips or modules + links to their info
Crystal was labeled "32.768" on scotch tape in my bin. Maybe I used something I should not have.
I believe it was salvaged from a watch, but it might have been from something else.
[] Wiring details - how exactly have you connected the hardware (a photo's worth 1000 words)
Already pulled the part so its a bit late for a picture.
[] Software setup, Arduino vs C+makefile, running on Windows, Mac or Linux?Versions?
Linux, 1.6.6
[] Any other information needed to reproduce the problem.....
I'm not sure this is a 'reproduce the problem' kind of thing, and more just someone confirming I did in fact bork it before I toss it in the bin.
========================== THIS RUNS =============================
//add smoothing
/*****
* last tampered with - 23 DEC 2015 05:43
*
* Changed boot charge readout from "***" to "**%" -- 04 JAN 2016 09:55
* Also messed with variable smoothing but its effectively back at prior defaults/settings -- 04 JAN 2016 10:05
*
* Changed OLED_RESET to pin 2 for Teensy3.2 -- 23JAN2016
* */
/* *************************************************** */
// OLED DISPLAY:
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#define OLED_RESET 2
Adafruit_SSD1306 display(OLED_RESET);
/* *************************************************** */
int sensorValue = 0;
int verticalValue = 0;
int count2 = 0;
/**** This is where you set your smoothing - 3 = really nice, 1 = none, 15 = really heavy smoothing ****/
const int numReadings = 3;
int readings[numReadings]; // the readings from the analog input
int readIndex = 0; // the index of the current reading
int total = 0; // the running total
int average = 0; // the average
//
int count = 0;
void setup()
{
display.begin(SSD1306_SWITCHCAPVCC, 0x3D); // initialize with the I2C addr 0x3D (for the 128x64)
// init done
display.clearDisplay();
display.drawFastHLine(0, 36, 128, 1); // starting x axis, y axis, length, color
display.drawFastHLine(0, 10, 128, 1); // starting x axis, y axis, length, color
display.drawFastHLine(0, 62, 128, 1); // starting x axis, y axis, length, color
// display.setTextSize(1);
// display.setTextColor(WHITE);
//display.setCursor(110, 0);
//display.println("**%"); // battery monitor display - show blank to give at least one cycle to calulate..
display.display();
}
void loop()
{
//sensorValue = random(12, 60);
// SMOOTHING BEGIN
// subtract the last reading:
total = total - readings[readIndex];
// read from the sensor:
readings[readIndex] = random(12, 60);
// add the reading to the total:
total = total + readings[readIndex];
// advance to the next position in the array:
readIndex = readIndex + 1;
// if we're at the end of the array...
if (readIndex >= numReadings)
{
// ...wrap around to the beginning:
readIndex = 0;
const int numReadings = random(1, 25); // randomize smoothing from 1-15, aka little to max smoothing
}
// calculate the average:
sensorValue = total / numReadings;
if(sensorValue >= 61)
{
sensorValue = 60;
}
// SMOOTHING END
//if (sensorValue >= 12 && sensorValue <= 60)
//{
verticalValue = sensorValue - 60;
if (count2 == 128)
{
count2 = 0;
display.clearDisplay();
display.drawFastHLine(0, 36, 128, 1); // starting x axis, y axis, length, color
display.drawFastHLine(0, 10, 128, 1); // starting x axis, y axis, length, color
display.drawFastHLine(0, 62, 128, 1); // starting x axis, y axis, length, color
// voltageMonitor(); // run voltage monitor and display value
}
//display.drawFastVLine(count2, sensorValue, verticalValue, WHITE); // instead of dot, a line
display.drawLine(count2, sensorValue, count2, 60, WHITE); // another option
count2++;
//}
display.display();
}
====================================================================
============================ THIS DOES NOT RUN ======================
/*
TimeRTC.pde
example code illustrating Time library with Real Time Clock.
http://www.pjrc.com/teensy/td_libs_Time.html
*/
#include <TimeLib.h>
/* *************************************************** */
// OLED DISPLAY:
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#define OLED_RESET 2
Adafruit_SSD1306 display(OLED_RESET);
/* *************************************************** */
// Teensy 3.0 has the LED on pin 13
const int ledPin = 13;
/* *************************************************** */
/* *************************************************** */
/* *************************************************** */
void setup() {
pinMode(ledPin, OUTPUT);
display.begin(SSD1306_SWITCHCAPVCC, 0x3D); // initialize with the I2C addr 0x3D (for the 128x64)
// init done
display.clearDisplay();
display.display();
display.setTextSize(1);
display.setTextColor(WHITE);
display.setCursor(0, 0);
// set the Time library to use Teensy 3.0's RTC to keep time
setSyncProvider(getTeensy3Time);
Serial.begin(115200);
while (!Serial); // Wait for Arduino Serial Monitor to open
delay(100);
if (timeStatus() != timeSet) {
Serial.println("Unable to sync with the RTC");
display.println("Unable to sync with the RTC");
} else {
Serial.println("RTC has set the system time");
display.println("RTC has set the system time");
}
display.display();
digitalWrite(ledPin, HIGH); // set the LED on
delay(2000);
digitalWrite(ledPin, LOW); // set the LED off
}
/* *************************************************** */
void loop() {
if (Serial.available()) {
time_t t = processSyncMessage();
if (t != 0) {
Teensy3Clock.set(t); // set the RTC
setTime(t);
digitalWrite(ledPin, HIGH); // set the LED on
}
}
digitalClockDisplay();
delay(1000);
digitalWrite(ledPin, LOW); // set the LED off
}
/* *************************************************** */
void digitalClockDisplay() {
// digital clock display of the time
Serial.print(hour());
printDigits(minute());
printDigits(second());
Serial.print(" ");
Serial.print(day());
Serial.print(" ");
Serial.print(month());
Serial.print(" ");
Serial.print(year());
Serial.println();
display.clearDisplay();
display.setTextSize(4);
display.setTextColor(WHITE);
display.setCursor(0, 0);
display.print(hour());
display.print(":");
display.print(minute());
display.setTextSize(1);
display.setTextColor(WHITE);
display.setCursor(0, 40);
display.println("");
display.print(day());
display.print(".");
display.print(monthShortStr(month()));
display.print(".");
display.print(year());
display.display();
}
time_t getTeensy3Time()
{
return Teensy3Clock.get();
}
/* code to process time sync messages from the serial port */
#define TIME_HEADER "T" // Header tag for serial time sync message
unsigned long processSyncMessage() {
unsigned long pctime = 0L;
const unsigned long DEFAULT_TIME = 1357041600; // Jan 1 2013
if (Serial.find(TIME_HEADER)) {
pctime = Serial.parseInt();
return pctime;
if ( pctime < DEFAULT_TIME) { // check the value is a valid time (greater than Jan 1 2013)
pctime = 0L; // return 0 to indicate that the time is not valid
}
}
return pctime;
}
void printDigits(int digits) {
// utility function for digital clock display: prints preceding colon and leading 0
Serial.print(":");
if (digits < 10)
Serial.print('0');
Serial.print(digits);
}
========================================================================================
I removed the crystal, and nothing changed - the Time program still did not run.
I uploaded a different program trying to see if I just had a bad upload, and now its just confusing. The blink demo won't run, the time demo won't run, but I can run an OLED using I2C just fine.
Did a system reboot, and swapped USB cables just to be sure its not a communication issue.
I am presuming I overheated or shorted a nearby surface mount part. I can't find any evidence of that though. I was as quick as I could be with the heat, and kept my distance from other components. It seems like its just the RTC function that isn't working now or something.
Just some added info: Only external components I've run this with is the Adafruit 128x64 OLED, not including the crystal attempt.
The LED does occasionally try to blink, but it is extremely dim (barely visible in a dark room), and seems to be random.
<<Trying to delay the sinking feeling of knowing I just borked $25 and the time waiting for it to arrive within an hour of putting code to it>>
[] Complete Source Code (or a link to the code)
The Time Teensy3 example used to run, now does not.
I also included the two programs that I was running prior to the issues.
The first runs, and just graphs out random data on the oled (just wanted to see how it performed vs an atmel 328).
The second is a modified version of the Time example (the example unmodified does not run either so it has nothing to do with my modifications to the code, as even the modified version ran until the crystal). This just spits out the time on the OLED.
What is really puzzling me about this is that the Blink tutorial won't run now.
For some reason uploading any software now seems to take an age as well (several minutes).
[] Screenshot or the exact text of any error messages
I'll see if I can find my macro lense for my camera to get some upclose pix - maybe someone else spots my goofup where I didn't.
[] Which PJRC product you're using
Teensy 3.2
[] Part numbers of any other chips or modules + links to their info
Crystal was labeled "32.768" on scotch tape in my bin. Maybe I used something I should not have.
I believe it was salvaged from a watch, but it might have been from something else.
[] Wiring details - how exactly have you connected the hardware (a photo's worth 1000 words)
Already pulled the part so its a bit late for a picture.
[] Software setup, Arduino vs C+makefile, running on Windows, Mac or Linux?Versions?
Linux, 1.6.6
[] Any other information needed to reproduce the problem.....
I'm not sure this is a 'reproduce the problem' kind of thing, and more just someone confirming I did in fact bork it before I toss it in the bin.
========================== THIS RUNS =============================
//add smoothing
/*****
* last tampered with - 23 DEC 2015 05:43
*
* Changed boot charge readout from "***" to "**%" -- 04 JAN 2016 09:55
* Also messed with variable smoothing but its effectively back at prior defaults/settings -- 04 JAN 2016 10:05
*
* Changed OLED_RESET to pin 2 for Teensy3.2 -- 23JAN2016
* */
/* *************************************************** */
// OLED DISPLAY:
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#define OLED_RESET 2
Adafruit_SSD1306 display(OLED_RESET);
/* *************************************************** */
int sensorValue = 0;
int verticalValue = 0;
int count2 = 0;
/**** This is where you set your smoothing - 3 = really nice, 1 = none, 15 = really heavy smoothing ****/
const int numReadings = 3;
int readings[numReadings]; // the readings from the analog input
int readIndex = 0; // the index of the current reading
int total = 0; // the running total
int average = 0; // the average
//
int count = 0;
void setup()
{
display.begin(SSD1306_SWITCHCAPVCC, 0x3D); // initialize with the I2C addr 0x3D (for the 128x64)
// init done
display.clearDisplay();
display.drawFastHLine(0, 36, 128, 1); // starting x axis, y axis, length, color
display.drawFastHLine(0, 10, 128, 1); // starting x axis, y axis, length, color
display.drawFastHLine(0, 62, 128, 1); // starting x axis, y axis, length, color
// display.setTextSize(1);
// display.setTextColor(WHITE);
//display.setCursor(110, 0);
//display.println("**%"); // battery monitor display - show blank to give at least one cycle to calulate..
display.display();
}
void loop()
{
//sensorValue = random(12, 60);
// SMOOTHING BEGIN
// subtract the last reading:
total = total - readings[readIndex];
// read from the sensor:
readings[readIndex] = random(12, 60);
// add the reading to the total:
total = total + readings[readIndex];
// advance to the next position in the array:
readIndex = readIndex + 1;
// if we're at the end of the array...
if (readIndex >= numReadings)
{
// ...wrap around to the beginning:
readIndex = 0;
const int numReadings = random(1, 25); // randomize smoothing from 1-15, aka little to max smoothing
}
// calculate the average:
sensorValue = total / numReadings;
if(sensorValue >= 61)
{
sensorValue = 60;
}
// SMOOTHING END
//if (sensorValue >= 12 && sensorValue <= 60)
//{
verticalValue = sensorValue - 60;
if (count2 == 128)
{
count2 = 0;
display.clearDisplay();
display.drawFastHLine(0, 36, 128, 1); // starting x axis, y axis, length, color
display.drawFastHLine(0, 10, 128, 1); // starting x axis, y axis, length, color
display.drawFastHLine(0, 62, 128, 1); // starting x axis, y axis, length, color
// voltageMonitor(); // run voltage monitor and display value
}
//display.drawFastVLine(count2, sensorValue, verticalValue, WHITE); // instead of dot, a line
display.drawLine(count2, sensorValue, count2, 60, WHITE); // another option
count2++;
//}
display.display();
}
====================================================================
============================ THIS DOES NOT RUN ======================
/*
TimeRTC.pde
example code illustrating Time library with Real Time Clock.
http://www.pjrc.com/teensy/td_libs_Time.html
*/
#include <TimeLib.h>
/* *************************************************** */
// OLED DISPLAY:
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#define OLED_RESET 2
Adafruit_SSD1306 display(OLED_RESET);
/* *************************************************** */
// Teensy 3.0 has the LED on pin 13
const int ledPin = 13;
/* *************************************************** */
/* *************************************************** */
/* *************************************************** */
void setup() {
pinMode(ledPin, OUTPUT);
display.begin(SSD1306_SWITCHCAPVCC, 0x3D); // initialize with the I2C addr 0x3D (for the 128x64)
// init done
display.clearDisplay();
display.display();
display.setTextSize(1);
display.setTextColor(WHITE);
display.setCursor(0, 0);
// set the Time library to use Teensy 3.0's RTC to keep time
setSyncProvider(getTeensy3Time);
Serial.begin(115200);
while (!Serial); // Wait for Arduino Serial Monitor to open
delay(100);
if (timeStatus() != timeSet) {
Serial.println("Unable to sync with the RTC");
display.println("Unable to sync with the RTC");
} else {
Serial.println("RTC has set the system time");
display.println("RTC has set the system time");
}
display.display();
digitalWrite(ledPin, HIGH); // set the LED on
delay(2000);
digitalWrite(ledPin, LOW); // set the LED off
}
/* *************************************************** */
void loop() {
if (Serial.available()) {
time_t t = processSyncMessage();
if (t != 0) {
Teensy3Clock.set(t); // set the RTC
setTime(t);
digitalWrite(ledPin, HIGH); // set the LED on
}
}
digitalClockDisplay();
delay(1000);
digitalWrite(ledPin, LOW); // set the LED off
}
/* *************************************************** */
void digitalClockDisplay() {
// digital clock display of the time
Serial.print(hour());
printDigits(minute());
printDigits(second());
Serial.print(" ");
Serial.print(day());
Serial.print(" ");
Serial.print(month());
Serial.print(" ");
Serial.print(year());
Serial.println();
display.clearDisplay();
display.setTextSize(4);
display.setTextColor(WHITE);
display.setCursor(0, 0);
display.print(hour());
display.print(":");
display.print(minute());
display.setTextSize(1);
display.setTextColor(WHITE);
display.setCursor(0, 40);
display.println("");
display.print(day());
display.print(".");
display.print(monthShortStr(month()));
display.print(".");
display.print(year());
display.display();
}
time_t getTeensy3Time()
{
return Teensy3Clock.get();
}
/* code to process time sync messages from the serial port */
#define TIME_HEADER "T" // Header tag for serial time sync message
unsigned long processSyncMessage() {
unsigned long pctime = 0L;
const unsigned long DEFAULT_TIME = 1357041600; // Jan 1 2013
if (Serial.find(TIME_HEADER)) {
pctime = Serial.parseInt();
return pctime;
if ( pctime < DEFAULT_TIME) { // check the value is a valid time (greater than Jan 1 2013)
pctime = 0L; // return 0 to indicate that the time is not valid
}
}
return pctime;
}
void printDigits(int digits) {
// utility function for digital clock display: prints preceding colon and leading 0
Serial.print(":");
if (digits < 10)
Serial.print('0');
Serial.print(digits);
}
========================================================================================