The accelerometer does not work outside of debugger

Hello people

I have two custom boards with and without Low Frecuency Crystal. While I am debugging, both boards work ok, I can do advertise, scan and read accelerometer values through interrupt. When I stop the debugger, only the accelerometer in the board without crystal does not work. But if I disable CONFIG_BT_OBSERVER=n, the accelerometer works. I have this configuration in the board with RC 

CONFIG_CLOCK_CONTROL_NRF_K32SRC_RC=y
CONFIG_CLOCK_CONTROL_NRF_K32SRC_XTAL=n
CONFIG_CLOCK_CONTROL_NRF_K32SRC_SYNTH=n
CONFIG_CLOCK_CONTROL_NRF_CALIBRATION_LF_ALWAYS_ON=n
CONFIG_CLOCK_CONTROL_NRF_CALIBRATION_PERIOD=50000
CONFIG_CLOCK_CONTROL_NRF_CALIBRATION_MAX_SKIP=100
CONFIG_CLOCK_CONTROL_NRF_K32SRC_RC_CALIBRATION=n

zephyr = v2.7.99

nrf = v1.9.1

IDE = VS Code

mcu = nrf52805

acc = LIS2DH

Do you have any suggestion why it does not work? I reboot the board when I stop the debug. Thank you.

Parents
  • Hello,

    The difference with/without external crystal is really a ~500ms delay during startup while softdevice controller startup the crystal. Can you for test just try to add a 500ms delay in the start of you program (for instance before and after you call device binding of the accelometer)? I am thinking the problem may be that due to the quick startup time without external crystal, then the accelomter is not ready to receive the serial commands. Alternatively it could be interesting to look at the serial interface using a logic analyzer (e.g. https://www.saleae.com/) to check if there is any obvious difference between the two.

    Are there external or internal pull-up on the TWI pins? Maybe try with externals.

    Make sure you you are doing a full power cycle of both nRF52 and LIS2DH before testing.

    Kenneth

  • Hello  thanks for your reply.

    We use internal resistors on the TWI pins. We added the delay time and external pull-up resistors you suggested, but got the same results. Also, if we disable CONFIG_BT_OBSERVER, the power consumption is lower than if it is enabled. We do not have all these issues if we use an external crystal, but we want low cost.

  • I don't have any good proposal other than to continue the debugging. I would recommend to connect a logic analyzer to the twi pins to check if the timing or data show any errors, I don't expect much data in the beginning here, so a logic analyzer should be able to show bytes and transcations (write and read) occuring.

    Kenneth

Reply Children
No Data
Related