This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Internal Clock TWI issue

I have an issue with the internal clock setting, and TWI. My custom board has an issue with the external crystal. So I switched to internal crystal with the following settings:

NRF_SDH_CLOCK_LF_SRC  0
NRF_SDH_CLOCK_LF_RC_CTIV 2
NRF_SDH_CLOCK_LF_RC_TEMP_CTIV 22

BLE radio is working, however SCL, SDA line is just high. Is there any setting for the TWI driver to ensure that the internal clock is used?

Parents
  • How have you enabled the TWI? Did you test the TWI (your application) on a DK? Does it work there? Are you sure that you have not set up the TWI wrong, rather than clock settings?

    BR,

    Edvin

  • Hi Edvin,

    My Twi init config is as follows:

    twi_config = {
           .scl                = 26,
           .sda                = 27,
           .frequency          = NRF_DRV_TWI_FREQ_100K,
           .interrupt_priority = APP_IRQ_PRIORITY_LOW,
           .clear_bus_init     = true
        };

    It works in another Custom board with the same configuration and a functioning external crystal, so I assumed it maybe a crystal issue. I just checked with the DK and it works. So it's not due to the internal oscillator I guess.

    I get the NRF_ERROR_DRV_TWI_ERR_ANACK err_code i.e. 0x8201 on the custom board.

    Can you suggest where to troubleshoot? Should I check the pullup resistors?

    Cheers,

    Vijay

  • What function is returning this value? Or what event is receiving this value? Is it the same device that you are trying to write to using TWI? What are the differences between the two boards on the TWI pins? The TWI isn't using the LFCLK, so it is not related to that at all. The LFCLK is 37KHz, so it couldn't possibly drive a TWI clock of 100KHz.

  • The function NRF_DRV_TWI_TX returns this value. So basically it fails sending the first packet after init

    Yes it's exactly the same device an accelerometer which I am trying to write. I have not desoldered the pullup resistors, but the resistance between Vcc and SCL/SDA line at testpoint is the same as the other PCB

    I observed that the SCL, SDA voltage is about 0.3V less than the other board, but its still about 3V. I am currently in a different city in India, so I do not have access to an Oscilloscope. But as soon as I get back I will try to upload some screenshots

Reply
  • The function NRF_DRV_TWI_TX returns this value. So basically it fails sending the first packet after init

    Yes it's exactly the same device an accelerometer which I am trying to write. I have not desoldered the pullup resistors, but the resistance between Vcc and SCL/SDA line at testpoint is the same as the other PCB

    I observed that the SCL, SDA voltage is about 0.3V less than the other board, but its still about 3V. I am currently in a different city in India, so I do not have access to an Oscilloscope. But as soon as I get back I will try to upload some screenshots

Children
Related