⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 msp430commands.txt

📁 TI公司DaVinci系列DSP评估板的原理图
💻 TXT
字号:
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.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -