Teensy 3.6 external ds1307 RTC


#1

I was almost out of memory on the teensy 3.2 so i grabbed a teensy 3.6 ( two actually)…

Once mounted on the matrix shield ( plugs into the shield with female headers so i can swap between teensy versions without soldering) i now have more than enough memory but the clock no longer works…

I went back to the matrix clock example and loaded that with the same result (“DS1307 read error! Please check the circuitry.”)…

The teensy 3.2 pinout matches exactly the teensy 3.6 as far as the matrix shield connections go… The only difference is im plugging a 3.6 in instead of a 3.2 into the shield… I have the RTC connected correctly as if it wasnt the teensy 3.2 wouldnt work…

Any ideas would be very much appreciated…
Thanks
Daniel


#2

I went to just the basic rtc example and changed the pins to the default ones 18 and 19 and the rtc now works. So it seems i cant use 16 and 17 for I2c ( perhaps my teensy 3.6 is damaged on those pins although both have the issue)

My question now is how can i use pins 18 and 19 running smartmatrix as i am not using those pins and when i try it just freezes?

I remarked out the below to return to pins 18 and 19 but i must be missing something else somewhere?

CORE_PIN16_CONFIG = (PORT_PCR_MUX(2) | PORT_PCR_PE | PORT_PCR_PS);
CORE_PIN17_CONFIG = (PORT_PCR_MUX(2) | PORT_PCR_PE | PORT_PCR_PS);


#3

Hi Dan, this is a teensy question that I don’t have an answer to, but I bet someone on the teensy forum knows. I bet there’s a register change needed to move the pins, and the 3.6 registers are different.


#4

Thanks Louis sorry about that… i thought you might know as there is a note in the code saying that the pins were changed to use 16 and 17 from 18 and 19. As the default is 18 and 19 i thought deleting the below code would make it revert back to 18 and 19 but i think smartmatrix is using pins 18 and 19 or expecting something on them as the code compiles fine without the code below but as soon as it runs its locks up…
They are listed as IR and WIFI on the shield, should i be able to change these pins or are they reserved in the smartmatrix code?

/* I2C Changes Needed for SmartMatrix Shield */
// switch pins to use 16/17 for I2C instead of 18/19, after calling matrix.begin()//
pinMode(18, INPUT);
pinMode(19, INPUT);
CORE_PIN16_CONFIG = (PORT_PCR_MUX(2) | PORT_PCR_PE | PORT_PCR_PS);
CORE_PIN17_CONFIG = (PORT_PCR_MUX(2) | PORT_PCR_PE | PORT_PCR_PS);

Thanks for the info, i’ll hunt around the teensy forum and see if i cant find something…


#5

Hi Dan, sorry, I didn’t fully understand your questions. You’re right, it should work on pins 18 and 19.

You should just be able to use the two pinMode lines, and delete the CORE_PIN lines, to get I2C working on 18/19.

Any chance you can try I2C with 18/19 with no SmartMatrix code, or no SmartMatrix Shield attached?


#6

Gday Louis’

No problem im hassling you with too many questions anyway…

If i run anything else that has the default 18 and 19 as the i2c pins its all good and runs fine. Its only the smartmatrix code that appears to not work…

If i remark out as below the core_pin lines in the matrix clock example ( which i assumed would just default the teensy back to 18 and 19 for i2c) the code compiles but the teensy does not run… It would usually first display SET TIME on the panel and then display the time. when the core_pin lines are remarked out not even the SET TIME is displayed and nothing on the serial monitor either…

pinMode(18, INPUT);
pinMode(19, INPUT);
//CORE_PIN16_CONFIG = (PORT_PCR_MUX(2) | PORT_PCR_PE | PORT_PCR_PS);
//CORE_PIN17_CONFIG = (PORT_PCR_MUX(2) | PORT_PCR_PE | PORT_PCR_PS);

I tried this on both the teensy 3.2 and teensy 3.6 both with and without the shield but both lock up when the code runs…


#7

I just remarked out all of the below code on the matrixclock example and the rtc now works on pins 18 and 19 but very very erratically… Again just with the smartmatrix code its erratic if i use the rtc example its fine… It will flash up STOPPED on the display and in the serial monitor will show “The ds1307 is stopped” and on the next read will again show the correct time and will freeze sometimes also.
Im not sure whats happening its very strange that any other program will be fine using 18 and 19 but smartmatrix has troubles.

//pinMode(18, INPUT);
//pinMode(19, INPUT);
//CORE_PIN16_CONFIG = (PORT_PCR_MUX(2) | PORT_PCR_PE | PORT_PCR_PS);
//CORE_PIN17_CONFIG = (PORT_PCR_MUX(2) | PORT_PCR_PE | PORT_PCR_PS);


#8

Strange… I put this in the Github issue tracker and I’ll look at it when I have time, sorry I can’t try to fix this for you right now.


#9

No problem Louis, thanks for the help…

I might try to use the internal RTC as it now has the crystal built in…

Using the teensy 3.6 makes everything so much smoother on the display at 64 x 64, hopefully i can use the internal rtc as it would be a shame to lose all the extra memory and speed…