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

Not responding twi peripheral

Hi all,

Here I am using the nrf52840 in my customized board, in parallel i have nrf52840 dev board.

I am using the twi peripheral to communicate with a i2c based sensor. To test the board, I am using the nRF52840 SDK 15.2. 

In the dev board it is working fine. But in the custom board it is not working. 

The SDA line is 8 (p0.8) and SCL line is 6 (p0.6)

Can you please suggest me as soon.

This is the issue I am getting with my custom board.

Regards,

Parents
  • Hello,

    Could you elaborate on what application you are using to test this - are you using the twi_sensor example from the SDK?
    If so, what modifications have you made to it?

    In the dev board it is working fine. But in the custom board it is not working. 

    This suggest that it could be a problem with the connections, please ensure that the connections are correct between the nRF52840 and the sensor.
    Could you describe how it does not work on the custom board? Is the sensor unresponsive, or are you seeing a difference in the TWI communication when using the custom board instead?

    This is the issue I am getting with my custom board.

    It would also be preferable if you could provide some more insight into what issue you are facing. From the provided screenshot you are highlighting the nrf_twim_event_check inline function, which is used as a boolean check for twim events.
    Could you instead provide the code where it is called, along with a description of the problem you are experiencing. Is the application stuck in a loop, or are you getting an unexpected return value somewhere?

    Best regards,
    Karl

     

     

  • Hi,

    Here I am using the TWI Scanner example provided in the SDK of the nRF52840. In this, i changed the GPIO numbers as per my custom board. 

    SCL as 6 and SDA as 8. After changing this pins, i checked with both Dev board and Custom board. In the Dev board, it is working fine where as in the custom board it is not working.

    In the Dev board I am using a sensor by connecting them externally via jumper wires. In the custom board, the sensor is different one, populated on the the board.

    While checking the custom board, it is not returning from the while loop

    I am using this function

    err_code = nrf_drv_twi_rx(&m_twi, address, &sample_data, sizeof(sample_data));

    Can you please suggest me.

    Regards,

  • Hello,

    Do I understand you correctly that you are trying to use the nRF52840 as a TWI Master, to read data from a specific TWI slave sensor?
    If this is the case, you might be interested in seeing the twi_sensor example rather than the twi_scanner example.
    The twi_sensor example demonstrates how to set up the nRF52840 as a TWI Master, and receive data from a arbitrary TWI slave sensor.
    In the example, a LM75B temperature sensor is used for reference.

    Gouse Basha said:

    I am using this function

    err_code = nrf_drv_twi_rx(&m_twi, address, &sample_data, sizeof(sample_data));

    Can you please suggest me.

    Could you elaborate what you are trying to achieve here, and how the performance differs from what you would expect?
    The twi driver functions are described in the TWI API Reference.

    Best regards,
    Karl

  • Check to make sure you have pullup resistors on the SDA & SCL line on your custom board also check other pins such as CS wiring to put the sensor in I2C mode instead of SPI

Reply Children
  • Gouse Basha said:
    This example is working fine with Dev board of nRF52840. In my custom board it is not working.

    This suggest that the connections between the nRF52840 and the sensor might be incorrect.
    Could you provide schematics for how the sensor is wired to the nRF52840 on the custom board?

    Nguyen Hoan Hoang said:
    Check to make sure you have pullup resistors on the SDA & SCL line on your custom board also check other pins such as CS wiring to put the sensor in I2C mode instead of SPI

    Please ensure that this is the case on your custom board, and get back to us.

    Thank you for your suggestion, Nguyen!

    Best regards,
    Karl

Related