Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

How to get silabs Si1141 out of suspended mode

Status
Not open for further replies.

jokkeedk

Newbie level 1
Joined
Mar 20, 2015
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
7
Trying to read the PS1 values. But as im running the following code it keeps saying on "chip_stat" that its suspended.

Code:
main (void){

    init(); // Configuration initialization
    si1141_init(); // Si1141 sensor initialization

    __delay_ms(30); // Delay to ensure Si1141 is completely booted, must be atleast 25ms

    si1141_WriteToRegister(REG_IRQ_STATUS, 0xFF); // Clear interrupt source

    signed int status;

    while(1){

        WriteToI2C(0x5A<<1); // Slave address
        PutByteI2C(0x30); // chip_stat
        ReadFromI2C(0x5A<<1); // Slave address
        if((status = GetByteI2C(0x30)) == Sw_I2C_ERROR) // part_id
        {
            return Sw_I2C_ERROR;
        }
        Stop_I2C();
        status++;;
    }
}

The code im using to read the PS1 values is the following. Im reading the value 16705. Which keeps being the same on all measurements.

The value should go up and down from 0 - 32767, as it measures more or less movement.

Code:
signed int si1141_ReadFromRegister(unsigned char reg){
    signed int data;

    WriteToI2C(0x5A<<1); // Slave address
    ReadFromI2C(0x5A<<1); // Slave address
    if((data = GetByteI2C(Sw_I2C_LAST)) == Sw_I2C_ERROR)
    {
        return Sw_I2C_ERROR;
    }
    Stop_I2C();
    return data;
}

main (void){

    init(); // Configuration initialization
    si1141_init(); // Si1141 sensor initialization

    __delay_ms(30); // Delay to ensure Si1141 is completely booted, must be atleast 25ms

    si1141_WriteToRegister(REG_IRQ_STATUS, 0xFF); // Clear interrupt source

    signed int PS1;

    while(1){        

    PS1 = si1141_ReadFromRegister(REG_PS1_DATA0) + (256 * si1141_ReadFromRegister(REG_PS1_DATA1)); // Proximity CH1

    }
}

I linked the files for the i2c communication.

https://www.dropbox.com/s/q41vw444gjvj0qa/swi2c.c?dl=0 https://www.dropbox.com/s/1mshyz88o15hz8c/swi2c.h?dl=0
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top