Hi all,
I'm working with Nordic Thingy:52 (nRF6936 with nRF52832 inside).
Currently I'm working with original firmware (I mean, not modified firmware) version 2.1.0. But doing some tests with Thingy52 and nRF connect Android app, I realized that the range of the accelerometer axis is from -G (-9.81) to +G (9.81). So 9.81 is the limit even if I shake strongly the Thingy:52, and I need a higher range.
Taking a look to documentation, I see I can choose the acceleration range, so I decided to modify the firmware.
From "/NordicThingyFW/include/drivers/drv_acc_lis3dh_types.h":
/** @brief Acceleration ranges.
*/
typedef enum
{
FULLSCALE_2 = 0x00, ///< 2 G full scale.
FULLSCALE_4 = 0x01, ///< 4 G full scale.
FULLSCALE_8 = 0x02, ///< 8 G full scale.
FULLSCALE_16 = 0x03 ///< 16 G full scale.
} Fullscale_t;
I'm not sure what I have to modify from firmware in order to change acceleration range, for instance, to FULLSCALE_16. I have tried unsuccessfully the following:
From "/NordicThingyFW/include/drivers/drv_acc_lis3dh_types.h", on "drv_acc_wakeup_prepare(bool wakeup)" function:
[...]
if(wakeup)
{
NRF_LOG_DEBUG("Configuring LIS3DH for wake on motion \r\n");
uint8_t ctrl_regs[] = {(ODR_100Hz << 4) | CTRL_REG1_LPEN | CTRL_REG1_ZEN | CTRL_REG1_YEN, //| CTRL_REG1_XEN, // CTRL_REG1
CTRL_REG2_FDS | CTRL_REG2_HP_IA1, // CTRL_REG2
CTRL_REG3_I1_IA1, // CTRL_REG3
0, // CTRL_REG4
CTRL_REG5_LIR_INT1}; // CTRL_REG5
uint8_t int1_ths[] = {ACC_INT1_THRESHOLD, // INT1_THS
ACC_INT1_DURATION}; // INT1_DURATION
uint8_t int1_cfg[] = {INT1_CFG_ZHIE | INT1_CFG_YHIE | INT1_CFG_XHIE}; // INT1_CFG
err_code = lis3dh_write_regs(CTRL_REG1, ctrl_regs, (sizeof(ctrl_regs)/sizeof((ctrl_regs)[0])));
RETURN_IF_ERROR(err_code);
[...]
I have modified CTRL_REG4 adding CTRL_REG4_FS0 and CTRL_REG4_FS1:
if(wakeup)
{
NRF_LOG_DEBUG("Configuring LIS3DH for wake on motion \r\n");
uint8_t ctrl_regs[] = {(ODR_100Hz << 4) | CTRL_REG1_LPEN | CTRL_REG1_ZEN | CTRL_REG1_YEN, //| CTRL_REG1_XEN, // CTRL_REG1
CTRL_REG2_FDS | CTRL_REG2_HP_IA1, // CTRL_REG2
CTRL_REG3_I1_IA1, // CTRL_REG3
CTRL_REG4_FS1 | CTRL_REG4_FS0, // CTRL_REG4 Modified: FullScale_16
CTRL_REG5_LIR_INT1}; // CTRL_REG5
uint8_t int1_ths[] = {ACC_INT1_THRESHOLD, // INT1_THS
ACC_INT1_DURATION}; // INT1_DURATION
uint8_t int1_cfg[] = {INT1_CFG_ZHIE | INT1_CFG_YHIE | INT1_CFG_XHIE}; // INT1_CFG
err_code = lis3dh_write_regs(CTRL_REG1, ctrl_regs, (sizeof(ctrl_regs)/sizeof((ctrl_regs)[0])));
RETURN_IF_ERROR(err_code);
But this doesn't work. In the nRF Connect app I see the same limit in 9.81.
Any help?
Thank you,
Manuel Montenegro.