Problems with RX8025 with Stalker V2

I’ve read with interest the difficulties that users of Stalker V2.0 are having writing stable code for the RX8025 RTC. Users have experienced the RTC “sticking” or producing rubbish dates intermittenly. There are posts from Raider suggesting that the Wire library is at the cause and I’ve had all sorts of problems trying to get to the bottom of this problem.

I have loaded the Stlker_Logger_AM06_Serial firmware to four Stalker V2.0 cards using Arduino V023 and it all went well until all cards finally failed with rubbish date values or the program hanging somewhere leaving the LED on. An example is attached below. I’ve tried using Arduino 1.0 but the code does not compile as various features have changed since V0023 such as the .send and .receive functions. I did change these to their new functions in V1.0 (.write and .read), but the RTC still failed. Next I have tried to impliment the I2C library as suggested by Raider, but I have not got that running either, and I suspect I have not coded the RX8025.cpp code correctly (see attached).

I’m determined to sort this out as I have a big pile of Stalker v2.1 modules that will otherwise have to go in the bin. Can anyone please save my grief by sharing some code that actually makes the Rx8025 on the Stalker v2 work?

RX8025.cpp code modified for the I2C library (but not working)

#include <I2C.h>
#include “RX8025.h”
//********************************************************************

//===============================================
#define RX8025_address 0x32

unsigned char RX8025_Control[2]=
{
0x20,0x00
};

//============================================
uint8_t bcd2bin (uint8_t val)
{
return val - 6 * (val >> 4);
}

uint8_t bin2bcd (uint8_t val)
{
return val + 6 * (val / 10);
}

//===============================================
void getRtcTime(void)
{
unsigned char i=0;
I2c.read(RX8025_address,0x00,7);

RX8025_time[0]= I2c.receive();
RX8025_time[1]= I2c.receive();
RX8025_time[2]= I2c.receive();
RX8025_time[3]= I2c.receive();
RX8025_time[4]= I2c.receive();
RX8025_time[5]= I2c.receive();
RX8025_time[6]= I2c.receive();

year = bcd2bin(RX8025_time[6]&0xff);
month = bcd2bin(RX8025_time[5]&0x1f);
date = bcd2bin(RX8025_time[4]&0x3f);
week = bcd2bin(RX8025_time[3]&0x07);
hour = bcd2bin(RX8025_time[2]&0x3f);
minute = bcd2bin(RX8025_time[1]&0x7f);
second = bcd2bin(RX8025_time[0]&0x7f);
}

//===============================================
void RX8025_init(void)
{
I2c.begin();
I2c.write(RX8025_address,0x0e,0x20);
I2c.write(RX8025_address,0x00);
//setRtcTime();
}

Sample from DATA.log showing intermittent rubbish dates. This used the Wire library.

10/11/11/Thursday 9:21:31
tep102_temperature = 32.63
CH_complete battery voltage = 4.16
--------------next–data---------------

10/11/11/Thursday 9:21:33
tep102_temperature = 32.63
CH_charging battery voltage = 4.16
--------------next–data---------------

10/11/11/Thursday 9:21:35
tep102_temperature = 32.63
CH_complete battery voltage = 4.16
--------------next–data---------------

10/11/11/Thursday 9:21:37
tep102_temperature = 32.63
CH_complete battery voltage = 4.17
--------------next–data---------------

165/25/4545:85:38
tep102_temperature = 32.63
CH_complete battery voltage = 4.16
--------------next–data---------------

10/11/11/Thursday 9:21:41
tep102_temperature = 32.63
CH_complete battery voltage = 4.16
--------------next–data---------------

10/11/11/Thursday 9:21:43
tep102_temperature = 32.63
CH_complete battery voltage = 4.16
--------------next–data---------------

10/11/11/Thursday 9:21:45
tep102_temperature = 32.63
CH_complete battery voltage = 4.17
--------------next–data---------------

10/11/11/Thursday 9:21:47
tep102_temperature = 32.63
CH_complete battery voltage = 4.17
--------------next–data---------------

10/11/11/Thursday 9:21:49
tep102_temperature = 32.63
CH_complete battery voltage = 4.16
--------------next–data---------------

10/11/11/Thursday 9:21:51
tep102_temperature = 32.63
CH_complete battery voltage = 4.17
--------------next–data---------------

10/11/11/Thursday 9:21:53
tep102_temperature = 32.63
CH_complete battery voltage = 4.17
--------------next–data---------------

10/11/11/Thursday 9:21:55
tep102_temperature = 32.63
CH_complete battery voltage = 4.16
--------------next–data---------------

10/11/11/Thursday 9:21:58
tep102_temperature = 32.63
CH_complete battery voltage = 4.17
--------------next–data---------------

10/11/11/Thursday 9:22:0
tep102_temperature = 32.63
CH_complete battery voltage = 4.17
--------------next–data---------------

10/11/11/Thursday 9:22:2
tep102_temperature = 32.63
CH_complete battery voltage = 4.16
--------------next–data---------------

10/11/11/Thursday 9:22:4
tep102_temperature = 32.63
CH_complete battery voltage = 4.16
--------------next–data---------------

10/11/11/Thursday 9:22:6
tep102_temperature = 32.63
CH_complete battery voltage = 4.16
--------------next–data---------------

10/11/11/Thursday 9:22:8
tep102_temperature = 32.56
CH_complete battery voltage = 4.17
--------------next–data---------------

10/11/11/Thursday 9:22:10
tep102_temperature = 32.56
CH_complete battery voltage = 4.16
--------------next–data---------------

10/11/11/Thursday 9:22:12
tep102_temperature = 32.56
CH_sleeping battery voltage = 4.16
--------------next–data---------------

10/11/11/Thursday 9:22:14
tep102_temperature = 32.56
CH_complete battery voltage = 4.16
--------------next–data---------------

10/11/11/Thursday 9:22:16
tep102_temperature = 32.56
CH_complete battery voltage = 4.16
--------------next–data---------------

165/25/4545:85:18
tep102_temperature = 32.56
CH_complete battery voltage = 4.16
--------------next–data---------------

My experience with the version 2.0 is that there are two problems. The first, is that if you add pull-up resistors to connector J12, all the code works. I used 4.7K ohm resistors between Pin4 & Pin3 to 3.3v Pin1. The need for the resistors shows itself by the clock completely disappering from the I2C bus. If you search the bus for devices, the temperature chip is the only one found.

The second problem is with the wiring library, not being able to send a restart condition. From the RX8025 Application Manual page 29, if you wish to use method (2) and pick the register to start you need to send Sr, a restart condition from the Master. The code here uses method (3) and starts at Fh register and throws that first register away when reading time. Wayne Truchsess dsscircuits.com/ has a nice rewrite of the Arduino I2C Master Library that has the restart function. He also has a nice article on the Effects of Varying I2C Pull-Up Resistors.

Hope this helps.

I can add some code if needed using the I2C library, but it is in IDE 0023. Haven’t found a need to load Arduino 1.0 yet.

Many thanks for your comments Raider. Yes, I would appreciate seeing your code for V0023. I’m using both versions at the moment but don’t want to go anywhere untested using V1.0 before I am sure it works using the code supplied by someone like yourself whom knows what they are doing with the Arduino language.

Attached are three library files I2C, R8025, & TMP102, each with an example folder, with pde files. Place the three folders in your arduino library folder, and open the example files. These are just a rework of the files here, using the I2C library with the restart function.

Good luck.
Example_Stalker_v2.0.zip (17.7 KB)

Hello,

Where can I find the J11? Do you mean the jumper INTA_PD2? 4.7 kohms to Pin 3 & 4 at the RTC?

Thank you very much