spaceconcordia / space-jobs

1 stars 0 forks source link

Setting RTC returns control_alarm from system #8

Open SpaceShawn opened 9 years ago

SpaceShawn commented 9 years ago

Firstly and fortunately, setting the RTC seems to be successful.

However, when we execute the following code to write a new time to the external RTC we receive a control_alarm from linux

  1 #include "i2c-device.h"
  2 #include <time.h>
  3 #include <iostream>
  4 using namespace std;
  5 int main()
  6 {
  7     time_t rawtime = 1457041793;
  8 
  9     cout << rawtime;
 10     struct tm * time_info = localtime(&rawtime);
 11     struct rtc_time rt = { time_info->tm_sec, time_info->tm_min, time_info->tm_hour, time_info->tm_mday, time_info->tm_mon, time_info->tm_year, time_info->tm_wday,time_info->tm_yday,time_info->tm_isdst};
 12 
 13     cout << "Testing RTC" << endl;
 14     I2CDevice::I2CWriteToRTC(rt,0);
 15     cout << I2CDevice::error_msg << endl;
 16 
 17 }
./rtc-test
1457041793Testing RTC
Writing to RTC
Done writting to RTC
0
[ 6397.413590] control_alarm 0

Shawn, have you seen this before or know what it means?

shawn97 commented 9 years ago

i have not seen this before. i checked the data sheet and the ds1307 does not have an alarm, does this occur multiple times?

On Fri, Mar 13, 2015 at 5:16 PM, SpaceShawn notifications@github.com wrote:

Assigned #8 https://github.com/spaceconcordia/space-jobs/issues/8 to @shawn97 https://github.com/shawn97.

— Reply to this email directly or view it on GitHub https://github.com/spaceconcordia/space-jobs/issues/8#event-252682235.

Shawn Stoute

Spacecraft: CD&H Hardware Lead of ConSat-1 Space Concordia http://spaceconcordia.ca/lunabotics-home/ C: (438) 933-6352

SpaceShawn commented 9 years ago

Yes it happens every time the code is run. It's unclear what the alarm means, whether it's an acknowledgement notice or an indication of a problem. Linux is usually silent when a task is successful

shawn97 commented 9 years ago

I tried looking it up, but there is barely any hits. The only thing I can think if is that if there is an alarm in the strict. It must have set it to 0 automatically.

Have you tried to set the alarm to 0 in the struct ?? On 14 Mar 2015 11:47, "SpaceShawn" notifications@github.com wrote:

Yes it happens every time the code is run. It's unclear what the alarm means, whether it's an acknowledgement notice or an indication of a problem. Linux is usually silent when a task is successful

— Reply to this email directly or view it on GitHub https://github.com/spaceconcordia/space-jobs/issues/8#issuecomment-80543362 .

SpaceShawn commented 9 years ago

There is no alarm in a tm structure, it's just a characterization of a date and time. The output is a reaction from Linux or I2C to interaction with the hardware.

We should test this on the PC to see if it is Q6 specific, how easy would it be to hook the RTC up to mustang?

shawn97 commented 9 years ago

Hmm. Not that easy. Get a beagle bone black or raspberry pi. On 15 Mar 2015 10:37, "SpaceShawn" notifications@github.com wrote:

There is no alarm in a tm structure, it's just a characterization of a date and time. The output is a reaction from Linux or I2C to interaction with the hardware.

We should test this on the PC to see if it is Q6 specific, how easy would it be to hook the RTC up to mustang?

— Reply to this email directly or view it on GitHub https://github.com/spaceconcordia/space-jobs/issues/8#issuecomment-81046024 .