chipKIT® Development Platform

Inspired by Arduino™

Using the onboard RTC on MAX32

Created Thu, 06 Oct 2011 21:56:06 +0000 by Ddall


Ddall

Thu, 06 Oct 2011 21:56:06 +0000

Hello Anyone knows how to get the RTC working on a MAX32 board?

I already have a 32.768Khz Oscillator, but I can't figure out how I'm supposed to wire it ("something something pin75"), or what kind of code I need to run. Note: I tried looking at the MAX32 Network Shield, but I didn't see any mention of the oscillator on the board schematics, or any relevant code with the libraries. Thanks!


majenko

Wed, 09 Nov 2011 19:24:33 +0000

The oscillator would need to connect between pins 73 and 74 on the microcontroller.

The Max32 doesn't have provision to connect these pins to a crystal as they are in use as part of the IOL connector J14.


Ddall

Thu, 17 Nov 2011 12:22:45 +0000

The Max32 doesn't have provision to connect these pins to a crystal as they are in use as part of the IOL connector J14.

Does this mean I have to make hardware modifications to the board to get the oscillator working? Can I use this with the RTC library or do I need a different library?

Thanks


majenko

Sat, 19 Nov 2011 12:00:55 +0000

Yes, it would require some major reworking of the board to use the built-in RTCC.

Not something I'd want to have a go at.

You'd be much better off using an off-board RTC like the DS1306 ( [url]http://www.maxim-ic.com/datasheet/index.mvp/id/2687[/url]) which communicates through SPI.

I guess the onboard one may work with my RTCC library for the Uno32 ([url]http://www.chipkit.org/forum/viewtopic.php?f=7&t=539[/url]) but I haven't got a Max32 to actually test it on. I think the RTCC modules in the two chips are the same.


Ddall

Sun, 20 Nov 2011 17:03:35 +0000

That's what I thought I read in this thread http://www.chipkit.org/forum/viewtopic.php?f=17&t=196 Looking more closely at the MAX32 Network Shield I found this: http://www.digilentinc.com/Products/Detail.cfm?NavPath=2,892,942&Prod=CHIPKIT-NETWORK-SHIELD

(...) and a 32.768Khz oscillator to allow use of the Real Time Clock/Calendar (RTCC) peripheral in the PIC32 microcontroller.

The reference manual: > 32.768Khz Oscillator A 32.768Khz oscillator is provided to use as a clock source for the Real Time Clock/Calendar (RTCC) peripheral in the PIC32MX796 microcontroller on the Max32 board. The output of this oscillator connects to pin 12 or connector J11. On the Max32 board, this signal connects to signal RC13, which connects to pin 73 on the PIC32 microcontroller. This pin provides the secondary oscillator input, which can be used to clock the RTCC in the PIC32 microcontroller.

I'll try this with the uno32 RTCC library


majenko

Sun, 20 Nov 2011 23:31:44 +0000

I think the shield will be doing more that just providing the crystal. I think it has its own oscillator which provides a square wave at 32768Hz to the oscillator input of the PIC.

This is certainly doable.


Ddall

Mon, 21 Nov 2011 18:26:08 +0000

I'm going to sound like a complete noob here but: Crystal != Oscilator ? :oops:


Jacob Christ

Mon, 21 Nov 2011 21:49:33 +0000

I'm going to sound like a complete noob here but: Crystal != Oscilator ? :oops:

A crystal will not oscillate on its own, to make it oscillate a driver is connected to it. The PIC32 osc inputs provide this driver (as can be seen on in Figure 8.1 of the Oscillator section of the PIC32 3xx/4xx family manual).

The input to the osc pins can be driven with an external oscillator (crystal + driver), which is a good idea in this case, since just adding the crystal so far from the driver in the PIC32 may cause instability in the circuit (or worse, no oscillation at all). By providing the driver the signal going to the PIC32 is amplified and can go the distance. The local loop of the crystal and driver on the shield is stable because of the short trace runs.

I don't know how this is implemented, but it can be done with discrete components or with a crystal oscillator chip that have both a driver and crystal in a single package (they tend to be a bit pricey in my opinion though).

Jacob