Pmod RTCC Coding

Hi all, Im new here. Im doing my FYP and is using Pmod RTCC from Digilent. I was wondering if there is anyone on here who is familiar with this device. As I would appreciate any help with understanding how it works. It will be amazing if there is a sample code I could use to test the RTCC.

Im using LabVIEW and LINX to create the code and is having some error issue (error 5000). I have attached pictures of my code below. Rtcc write subVI, Rtcc read subVI and Pmod SubVI.
The error occurred at Rtcc read -> I2C write operation.

Any form of help will be greatly appreciated. Thank you.

Google for: mcp79410 arduino

You'll find some code to operate this RTC and the data sheet is here:

What is your task ? to write a library for it or simply to set up a simulation ?

I'd probably buy one and use real hardware to play with it.

OK. So you are interested only in the basic functions of this RTC module. That is, you want to be able to set it with the current time and date (say through a user interface which you develop on the Raspberry Pi), then you want to read it from time to time to get a current time stamp. Is that it ?

Just out of curiosity, why have you chosen this particular RTC module ? Those based on a DS3231 chip appear to be much more widely used, at least for hobby developments.

6v6gt:
OK. So you are interested only in the basic functions of this RTC module. That is, you want to be able to set it with the current time and date (say through a user interface which you develop on the Raspberry Pi), then you want to read it from time to time to get a current time stamp. Is that it ?

Just out of curiosity, why have you chosen this particular RTC module ? Those based on a DS3231 chip appear to be much more widely used, at least for hobby developments.

Yes, in my school project my task is to use the basic functions of this Pmod. Yes, I just want to set it with the current time and date through Raspberry pi, correct.

My supervisor has tasked me to learn about this RTC module and I try but still having trouble developing the code. I know about the DS3231 and LabVIEW has a sample code for this RTC module and not Pmod.

Can you demonstrate that you are able, from your Rpi, to contact an I2C slave ?

I've just looked briefly at one of the Arduino libraries for the main chip on your module, the MCP79410, and found this:

#define MCP7941x_RTC_I2C_ADDR 0x6F

so the slave should be contactable on 0x6F.

My experience with the Rpi is limited to SPI using http://wiringpi.com/ (C++) .
If you have basic problems with I2C together with a RPi, then this is probably not the right forum for optimal support. If, however, you get to the stage of presenting the problem as a general C++ / I2C / MCP79410 problem, then you have a better chance of getting some help here.

6v6gt:
Can you demonstrate that you are able, from your Rpi, to contact an I2C slave ?

I've just looked briefly at one of the Arduino libraries for the main chip on your module, the MCP79410, and found this:

#define MCP7941x_RTC_I2C_ADDR 0x6F

so the slave should be contactable on 0x6F.

My experience with the Rpi is limited to SPI using http://wiringpi.com/ (C++) .
If you have basic problems with I2C together with a RPi, then this is probably not the right forum for optimal support. If, however, you get to the stage of presenting the problem as a general C++ / I2C / MCP79410 problem, then you have a better chance of getting some help here.

Thank you for looking through the Arduino library. I have made a short video of my front panel on the TMP3 sensor, which is also using I2C communication. My Rpi is communicating well with TMP3's slave address and is able to display the temperature value.

I will try the 0x6F slave address on the rtcc code now.
Oh, I think my problem is about finding the rtcc correct addresses. Because the datasheet is too overwhelming for me to break it down and understand.
Link to TMP3 I2C video : Pmod SubVI vi Front Panel on RPi 3 - YouTube

I think my problem is on the rtc slave address. As Im not sure which to use and the datasheet is quite overwhelming for me to break it down and understand. I know the basic of I2C just unsure about the address I used in my code.

The entire Arduino library is here. It seems very simple. GitHub - ichilton/mcp7941x_arduino: Arduino Library for the Microchip MCP7941x Real Time Clock IC's

For the time functions, you simply send the I2C address of the clock part, then either send or receive 7 bytes depending on whether you are getting or setting a time. Each byte is BCD encoded and each represents a time element (hours, minutes, seconds etc.)

It is clear from the TMP3 demo that you have no basic problem with I2C.

6v6gt:
The entire Arduino library is here. It seems very simple. GitHub - ichilton/mcp7941x_arduino: Arduino Library for the Microchip MCP7941x Real Time Clock IC's

For the time functions, you simply send the I2C address of the clock part, then either send or receive 7 bytes depending on whether you are getting or setting a time. Each byte is BCD encoded and each represents a time element (hours, minutes, seconds etc.)

It is clear from the TMP3 demo that you have no basic problem with I2C.

Thanks for the link to Arduino library. I have tried out the slave address 0x6F and there is no more error 5000.
However, now there is no time display showing on the time stamp.

But I don't quite understand why 0x6F

idelle:
Thanks for the link to Arduino library. I have tried out the slave address 0x6F and there is no more error 5000.
However, now there is no time display showing on the time stamp.

But I don't quite understand why 0x6F and why is EEPROM 0x57 (01010111). When in the datasheet, EEPROM control byte is 1010111

01010111 and 1010111 are identical. A missing leading bit is treated as 0.

You may have to enable the clock before you see anything other than 0 for the time.
The enabling is done by forcing the high order bit of the "seconds" byte to 1.

Have you got any Rpi code to post here showing your attempt to interface to this module ?

6v6gt:
01010111 and 1010111 are identical. A missing leading bit is treated as 0.

You may have to enable the clock before you see anything other than 0 for the time.
The enabling is done by forcing the high order bit of the "seconds" byte to 1.

Have you got any Rpi code to post here showing your attempt to interface to this module ?

Ohhhh, ok. I see it now. I put EEPROM as 0x57. But why 0x6F for the slave address of the chip? Is it default? Or chosen

I tested the code in my RTCC Write SubVI and I got only the Date. However, now I can't run Live because my Rpi is having connection issues with LabVIew. I do have a picture of my code.

It sounds like you have more or less got it, at least for the date/time functionality.
If you start wanting to use the EEPROM to store and retrieve data, it will get a bit more interesting and you may have to find another library example.

It is still not totally clear to me how much of what you have done has been simulated and how much has been done on real hardware.

6v6gt:
It sounds like you have more or less got it, at least for the date/time functionality.
If you start wanting to use the EEPROM to store and retrieve data, it will get a bit more interesting and you may have to find another library example.

It is still not totally clear to me how much of what you have done has been simulated and how much has been done on real hardware.

Kinda, I used EEPROM bcos in that code you shared, he defined EEPROM I2C Slave address. At first, I used SRAM by following the datasheet but my supervisor suggested EEPROM. So I'll try both I guess. I connected EEPROM to the first write operation then the SRAM to the 2nd write operation.

As of now, the rpi is having connection issues with Labview Project Exploere, Im not sure why because on VNC it is working fine. I'm now waiting to get new hardware to try and maybe update you with the results I get from my code.

I have attached a picture of the connection between rpi, tmp3 and rtcc.

idelle:
Kinda, I used EEPROM bcos in that code you shared, he defined EEPROM I2C Slave address. At first, I used SRAM by following the datasheet but my supervisor suggested EEPROM. So I'll try both I guess. I connected EEPROM to the first write operation then the SRAM to the 2nd write operation.

As of now, the rpi is having connection issues with Labview Project Exploere, Im not sure why because on VNC it is working fine. I'm now waiting to get new hardware to try and maybe update you with the results I get from my code.

I have attached a picture of the connection between rpi, tmp3 and rtcc.

I got the pi to work, but Im having the same error (error 5000) again. Not sure why.

I have the code attached below.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.