- Silicon Labs Community
- Welcome and Announcements
- Silicon Labs Knowledge Base
- 8-bit MCU
- 32-bit MCU
- Bluetooth / Wi-Fi
- Other Products Category
- Optical/RH/Temp Sensor
- Other Products
- Hardware and Software Tools
- Simplicity Studio and Software
- General Discussions and Suggestions
- Chinese Forum
- Software Libraries
- Development Kits
- Reference Designs
- Third Party Tools
- White Papers
- Official Blog of Silicon Labs
- Chinese Blog
03-24-2017 11:24 AM
I used the Si1153 development kit to test out the sensor and it worked great. Then I set up my own si1153(the one with the embedded IR LED) and used the sample code from the dev kit gui.
I am only using the onboard IR LED and have the LED2, and LED3 pins unconnected.
The output I get is always 83, 21331, 21331 regardless of proximity to the sensor.
When I try to reset the chip(the first command) it didn't work so I commented it out. Not sure if that is what's causing the issue.
I am using an arduino and attached the code. Any help is much appreciated.
I2c.write(si1153, SI115x_REG_COMMAND, 0x01); //reset not working
I2c.write(si1153, PARAM_LED1_A, 0x3f); //Param_LED1_A
I2c.write(si1153, PARAM_CH_LIST, 0x03); //PARAM_CH_LIST
I2c.write(si1153, PARAM_ADCCONFIG0, 0x62); //adc config0
I2c.write(si1153, PARAM_ADCSENS0, 0x80); //adc sens0
I2c.write(si1153, PARAM_MEASCONFIG0, 0x61); //param_measconfig0
I2c.write(si1153, PARAM_ADCCONFIG1, 0x62); //adc config1
I2c.write(si1153, PARAM_ADCSENS1, 0x80); //adcsens1
I2c.write(si1153, PARAM_ADCPOST1, 0x08); //adc post1
I2c.write(si1153, PARAM_MEASCONFIG1, 0x40); //param_measconfig1
I2c.write(si1153, PARAM_MEASRATE_L, 0x19); //param_measrate_L
I2c.write(si1153, SI115x_REG_IRQ_ENABLE, 0x03); //REG_IRQ_ENABLE
I2c.read(si1153, 5); //read 5 bytes
a = I2c.receive();
ch0 = I2c.receive() << 8;
ch0 |= I2c.receive();
ch1 = I2c.receive() << 8;
ch1 |= I2c.receive();
println(a);//always shows 83
println(ch0);//always shows 21331
println(ch1);//always shows 21331
Solved! Go to Solution.
03-24-2017 04:21 PM
Parameter registers are different from I2C registers. Please follow the steps in Section 5.3.1 in the datasheet to access the parameter registers. You cannot use I2C write to configure that.
03-29-2017 10:58 AM
I have made quite a few changes and now the measuring works.
Unfortunately though I can't get the interrupt pin to trigger. I set up the measurements to occur every half second and would like the interrupt pin to tell me whenever a new measurement is ready.
If I continuously read REG_IRQ_STATUS it will tell me when the data is ready and I can read it, but I'd like to get the interrupt pin working.
I think I must be enabling the interrupt incorrectly because the RESPONSE0 command counter does not increment after I run:
I2c.write(si1153, SI115x_REG_IRQ_ENABLE, 0x01); //REG_IRQ_ENABLE
It does increment after running:
I2c.write(si1153, SI115x_REG_COMMAND, 0x13);//start
and it will reset to FFFF after resetting:
I2c.write(si1153, SI115x_REG_COMMAND, 0x01); //reset SW
Any ideas here would be much appreciated.
I also attached the arduino code.
03-29-2017 01:57 PM
Writing to COMMAND register will increment RESPONSE0, but not the IRQ_ENABLE register. So, that's not a problem.
Did you set MEASCOUNT0? I didn't see that in your code. You have to set both MEASRATE and MEASCOUNT to run autonomous measurements.
Also, make sure you have pull-up on the INT pin.
03-29-2017 05:49 PM
Thanks for the tip on RESPONSE0 not incrementing.
I've been using a 4.7k pullup on INT.
I set MEASCOUNT0 to 1(as I have already gotten the timing of 1/2 sec using the MEASRATE_H and MEASRATE_L). My understanding is that Time Between Measurements=MEASCOUNT0*MEASRATE*800uS.
Now the interrupt pin stays high at the start of running for a second and then turns off.
If I increase MEASCOUNT0 (to 0xF for example) then the interrupt will stay high longer when starting up.
But despite the INT pin being high the IRQ_STATUS is not done and I cannot get any proximity readings.
Once the INT pin turns off then I can read data using IRQ_STATUS, but the INT pin is not asserted high again.
I think I'm missing something here. Any ideas?
Thanks in advance
03-29-2017 05:58 PM
INT pin is asserted (low) when the enabled channel in CHAN_LIST has finished its measurement, and will be de-asserted (high) after the host reads the IRQ_STATUS register.
You should see the INT pin back to high as soon as you read the IRQ_STATUS register in the interrupt handler routine.
03-29-2017 06:18 PM
Works great now!
Thank you Tony!
I'll attach the code for any other arduino users out there.
You'll also need the I2C library(rev 5) from here: http://dsscircuits.com/articles/86-articles/66-arduino-i2c-master-library
And possibly a logic level converter.