thanks for your kind reply, 
 
Yes I should.
>From msp430commands.txt you can find below 

Command (0): setRTC() - Set Realtime Clock

------------------------------------------
 
> I2C Write (10 bytes)
    [0] = 10            ; Message length
    [1] = 0             ; Command index
    [2] = year (LSB)    ; ( in hex ) i.e. 2006 -> 0x2006 ( LSB=0x06 )
    [3] = year (MSB)    ; ( in hex ) i.e. 2006 -> 0x2006 ( MSB=0x20 )
    [4] = month         ; ( in hex ) i.e. Dec. -> 0x12
    [5] = day           ; ( in hex ) i.e. 31st -> 0x31
    [6] = hour          ; ( in hex ) i.e. 12   -> 0x12
    [7] = minute        ; ( in hex ) i.e. 30'  -> 0x30
    [8] = second        ; ( in hex ) i.e  45"  -> 0x45
    [9] = pm            ; 0 = AM, 1 = PM
 
> Wait 100 us.
 
> Done.
 
and have a look at the c file attached for the msp430lib and it seems hex usage 
is required 
 --------------------------
BEST REGARD
 



 



Date: Thu, 24 Dec 2009 13:12:17 +0200
Subject: Re: DM6446, Problem in RTC
From: alber...@gmail.com
To: mohameeed2...@hotmail.com
CC: davinci-linux-open-source@linux.davincidsp.com



are you sure you need to tell the numbers in hex?
Albert


2009/12/24 Mohamed AbdElwahed <mohameeed2...@hotmail.com>




 
i am using lsp1.2 in development which contains "msp430lib" 
that is used to control RTC and IR 
 
i am using the following commands to set the RTC as follow 
msp430lib_set_rtc(iYear,iMonth,iDay,iHour,iMinute,iSecond,iPm);
after formating the date like the following
year (LSB)    ; ( in hex ) i.e. 2006 -> 0x2006 ( LSB=0x06 )
year (MSB)    ; ( in hex ) i.e. 2006 -> 0x2006 ( MSB=0x20 )
month         ; ( in hex ) i.e. Dec. -> 0x12
day           ; ( in hex ) i.e. 31st -> 0x31
hour          ; ( in hex ) i.e. 12   -> 0x12
minute        ; ( in hex ) i.e. 30'  -> 0x30
second        ; ( in hex ) i.e  45"  -> 0x45
 
and get the RTC using 
msp430lib_get_rtc(&iYear,&iMonth,&iDay,&iHour,&iMinute,&iSecond,&iPm);
but 
when setting the clock to 28/2/2009 the next day from the RTC is 29/2/2009 
which is not valued 
when setting the clock to 28/12/2009 the next day from the RTC is 1/1/2009 
which is not valued 
Is there any help/URL/... to fix this problem?
 
------------------------
BEST REGARD


Windows Live: Make it easier for your friends to see what you’re up to on 
Facebook.
_______________________________________________
Davinci-linux-open-source mailing list
Davinci-linux-open-source@linux.davincidsp.com
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source



-- 
Albert Burbea
Harishonim 8
Ramat Gan 52502, Israel
Tel/Fax + 972-3-7526016
Mobile: +972-52-3541842
                                          
_________________________________________________________________
Windows Live: Friends get your Flickr, Yelp, and Digg updates when they e-mail 
you.
http://www.microsoft.com/middleeast/windows/windowslive/see-it-in-action/social-network-basics.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:en-xm:SI_SB_3:092010
MSP430 I2C Command Set (version 1.40, 12/21/06)

Usage:

The MSP430 interface is targets a 20KHz I2C clock frequency and a 50/50 I2C 
clock duty cycle.  The I2C clock must stay at 20KHz and below even if you are 
talking to a different device on the same I2C bus as the MSP430.  Similarly, 
you must wait 100 microseconds after an I2C command to any device on the I2C 
bus on which the MSP430 resides to allow for recovery after its address 
checking phase.


Version History:

1.00:  Initial release (shipped with Rev C and Rev D DaVinci EVMs)
1.10:  Added:
         - Ability to get firmware version (command 7)
         - Sleep mode (command 8)
         - New versions of RTC get/set with PM field (commands 9 and 10)
         - RTC defaults to noon on Jan 1, 2004 on first powered boot based on 
magic num
       Fixed:
         - RTC count valid on battery power and across resets.
1.20:  Added:
         - Sleep mode turns all I/Os into inputs to save power
       Fixed:
         - Code for command 9 and 10 ordering matches this document accurately 
now.
1.30:  Changed:
         - Eliminated setRTC2/getRTC2 (commands 9, 10).
         - Modified setRTC and getRTC to pass 10 byte data with PM field
       Added:
         - Extra checks to prevent undefined commands from crashing the MSP430.
1.40:  Changed:
         - Sleep mode disables interrupts from the infrared and I2C modules in 
addition
           to disabling pins to guarantee that the MSP430 won't affect the I2C 
bus
           after a sleepMode() command when the host is trying to access other 
chips
           on the I2C bus.
         - sleepMode() command description has been fixed.  Version 1.30 of 
this file
           incorrectly stated that sleepMode() had an option to toggle sleep 
mode on
           and off.  The real implementation never had that option.  
sleepMode() always
           turns the MSP430 off.


MSP430 I2C address on DaVinci EVM: (hex)0x23, (decimal)35
------------------------------------------

MSP430 command set index
------------------------
0 - SET_RTC_PARAMS   - setRTC()         - Set realtime clock
1 - GET_RTC_PARAMS   - getRTC()         - Get realtime clock
2 - GET_IR_DATA      - getIRData()      - Get infrared data array
3 - GET_IR_VALUE     - getIRVal()       - Get last infrared value
4 - GET_INPUT_STATE  - getInputState()  - Get the input state of pins
5 - GET_EVENT        - getEvent()       - Get outstanding events
6 - SET_OUTPUT_STATE - setOutputState() - Set the output state of pins
7 - GET_VERSION      - getVersion()     - Get the firmware version
8 - SLEEP_MODE       - sleepMode()      - Set sleep mode





Command (0): setRTC() - Set Realtime Clock
------------------------------------------

> I2C Write (10 bytes)
    [0] = 10            ; Message length
    [1] = 0             ; Command index
    [2] = year (LSB)    ; ( in hex ) i.e. 2006 -> 0x2006 ( LSB=0x06 )
    [3] = year (MSB)    ; ( in hex ) i.e. 2006 -> 0x2006 ( MSB=0x20 )
    [4] = month         ; ( in hex ) i.e. Dec. -> 0x12
    [5] = day           ; ( in hex ) i.e. 31st -> 0x31
    [6] = hour          ; ( in hex ) i.e. 12   -> 0x12
    [7] = minute        ; ( in hex ) i.e. 30'  -> 0x30
    [8] = second        ; ( in hex ) i.e  45"  -> 0x45
    [9] = pm            ; 0 = AM, 1 = PM

> Wait 100 us.

> Done.




Command (1): getRTC() - Get Realtime Clock
------------------------------------------

> I2C Write (2 bytes)
    [0] = 2             ; Message length
    [1] = 1             ; Command index

> Wait 100 us.

> I2C Read (10 bytes)
    [0] = 10            ; Message length
    [1] = 1             ; Command index
    [2] = year (LSB)    ; ( in hex ) i.e. 2006 -> 0x2006 ( LSB=0x06 )
    [3] = year (MSB)    ; ( in hex ) i.e. 2006 -> 0x2006 ( MSB=0x20 )
    [4] = month         ; ( in hex ) i.e. Dec. -> 0x12
    [5] = day           ; ( in hex ) i.e. 31st -> 0x31
    [6] = hour          ; ( in hex ) i.e. 12   -> 0x12
    [7] = minute        ; ( in hex ) i.e. 30'  -> 0x30
    [8] = second        ; ( in hex ) i.e  45"  -> 0x45
    [9] = pm            ; 0 = AM, 1 = PM

> Wait 100 us.

> Done.




Command (2): getIRData() - Get entire Infrared buffer
-----------------------------------------------------

> I2C Write 2 bytes
    [0] = 2                 ; Message length
    [1] = 2                 ; Command index

> Wait 100 us.

> I2C Read [variable length]
    [0] = message length    ; Message length
    [1] = 2                 ; Command index
    [2] = 1st IR value (LSB)
    [3] = 1st IR value (MSB)
    [4] = 2nd IR value (LSB)
    [5] = 2nd IR value (MSB)
    [6] = 3rd IR value (LSB)
    [7] = 3rd IR value (MSB)
    ...

> Wait 100 us.

> Done.




Command (3): getIRVal() - Get last Infrared value
-------------------------------------------------

> I2C Write 2 bytes
    [0] = 2             ; Message length
    [1] = 3             ; Command index

> Wait 100 us.

> I2C Read 4 bytes
    [0] = 4             ; Message length
    [1] = 3             ; Command index
    [2] = IR value (LSB)
    [3] = IR value (MSB)

> Wait 100 us.

> Done.




Command (4): getInputState() - Get port 2 and port 3 input state
----------------------------------------------------------------

> I2C Write 2 bytes
    [0] = 2             ; Message length
    [1] = 4             ; Command index

> Wait 100 us.

> I2C Read 4 bytes
    [0] = 4             ; Message length
    [1] = 4             ; Command index
    [2] = P2 state      ; Bit 4: CF CD.2   ( 1: No Card )( 0: Card Found )
                        ; Bit 3: CF CD.1   ( 1: No Card )( 0: Card Found )
                        ; Bit 2: MS/Pro CD ( 1: No Card )( 0: Card Found )
                        ; Bit 1: SD/MMC CD ( 1: No Card )( 0: Card Found )
    [3] = P3 state      ; Bit 6: SD/MMC WP ( 1: WP on )  ( 0: WP off )
                        ; Bit 2: xD CD     ( 1: No Card )( 0: Card Found )
                        ; Bit 1: SM CD     ( 1: No Card )( 0: Card Found )

> Wait 100 us.

> Done.




Command (5): getEvent() - Get outstanding events
------------------------------------------------

> I2C Write 2 bytes
    [0] = 2             ; Message length
    [1] = 5             ; Command index

> Wait 100 us.

> I2C Read 3 bytes
    [0] = 3             ; Message length
    [1] = 5             ; Command index
    [2] = Events        ; ( 1: State Change )
                        ; ( 2: IR Data )

> Wait 100 us.

> Done.




Command (6): setOutputState() - Set port 2 and port3 output state
-----------------------------------------------------------------

> I2C Write 4 bytes
    [0] = 4             ; Message length
    [1] = 6             ; Command index
    [2] = P2 state      ; All bits are ignored
    [3] = P3 state      ; Bit 3: CF_PWR_ON ( 1: POWER ON ) ( 0: POWER OFF )
                        ; Bit 0: SM_CE     ( 1: SM CE OFF )( 0: SM CE ON )

> Wait 100 us.

> Done.




Command (7): Get Version - Get firmware version
------------------------------------------------

> I2C Write 2 bytes
    [0] = 2             ; Message length
    [1] = 7             ; Command index

> Wait 100 us.

> I2C Read 3 bytes
    [0] = 3             ; Message length
    [1] = 7             ; Command index
    [2] = Version       ; 1 = This version (first firmware with version support)

> Wait 100 us.

> Done.



Command (8): Sleep Mode - Put MSP430 to sleep, stop driving outputs
-----------------------------------------------------------------

> I2C Write 3 bytes
    [0] = 2             ; Message length
    [1] = 8             ; Command index

> Wait 100 us.

> Done.

Attachment: msp430lib.c
Description: Binary data

_______________________________________________
Davinci-linux-open-source mailing list
Davinci-linux-open-source@linux.davincidsp.com
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source

Reply via email to