Have you already power profiled the Zephyr implementation? Last time I tried Zephyr on RuuviTags I had issues with pretty extreme sleep current. I can also run the profiler of your binaries on my end if you don’t have the HW.
LIS2DH12 readings so far: #1 @ 12600 ms: x -0.009576 , y -0.009576 , z -0.009576 #2 @ 13901 ms: x -0.009576 , y -0.009576 , z -0.009576 #3 @ 15202 ms: x -0.009576 , y -0.009576 , z -0.009576
So it is finding the device now, but the results are not being read correctly. Same code work on Thingy52 but LIS2DH12 is running on i2c instead of SPI
Last time I looked into sensors on Zephyr, there was issue with the SPI read having extra dummy byte at the start of data. This is caused by SPI being full duplex, so while writing address of register to read to peripheral there is one 0x00 in the received data.
@otso I tried adding your changes into the newest driver they have in Zephyr 2.1.99 and the output was:
#64 @ 94568 ms: x 1.072512 , y 0.497952 , z 9.959040 #65 @ 95869 ms: x 1.034208 , y 0.421344 , z 10.188864 #66 @ 97170 ms: x 1.225728 , y 0.574560 , z 9.920736 #67 @ 98472 ms: x 1.034208 , y 0.574560 , z 9.920736 #68 @ 99773 ms: x 1.187424 , y 0.497952 , z 9.997344 #69 @ 101074 ms: x 1.110816 , y 0.536256 , z 9.959040
{ 0xff, 0xff, /* random Company ID*/
0x09, /* random mode*/
0x00, 0x00, /* Temperature*/
0x00, 0x00, /* Humidity*/
0x00, 0x00, /* Pressure*/
0x00, 0x00 /* Packets*/};
Will create a second one with a different advertised name then work on the boot loader. Once done I will add acceleration data to the packet as well with battery. Tx power seems to be fixed by zephyr, and still having driver issues with getting the lis2dh interrupts to work.
To convert the data:
Type Reading
int16_t temperature/=100 is in degrees celsius
uint16_t humidty/=100 is %
uint32_t pressure+=50000 in Pa
int32_t x/=1000 in m/s/s
int32_t y/=1000 in m/s/s
int32_t z/=1000 in m/s/s
uint32_t packet_counter
BLE data is now compatable with Ruuvi RAW v2 and some other issues have been fixed. I will continue to look at the remaining issue over the next couple of weeks.
Zephyr uses MCUboot as the bootloader and a custom BLE stack not a nRF Softdevice. This means that it is not compatable with the shipped Ruuvi FW. Once the full build has been flashed onto the device with a compatable programmer, DFU’s can be done through the nRF connect app.
A button press is not required to perform a DFU, just scan and connect to your tag once found. The DFU button will be visible.