HOW TO IMPLEMENT I2C WITH NRF PRODUCT

Hello, I have an aht20 sensor from adafruit and an rtc ds3221, the 2 sensors are i2c, except that I am taking this course academy.nordicsemi.com/.../, but the course in question they used a shield for i2c communication, already for me I don't think it was the best example,  can you help me? Thanks. 

Grin

  • Hi

    Could you elaborate some more regarding where you're stuck? The guide explains fairly well how to set up the I2C driver and how to use it, and what remains from your end is to translate how to do the same steps as the guide uses together with the i2c sensors you have available :) 

    Kind regards,
    Andreas

  • Hi, I relied on the datasheet of the soc nrf5340, what I can see is that the pins from 0 to 31 of port 0 and 1 can be configured for by the psel register in order to select the sda   and the scl?  I came across this code on github https://github.com/crfosse/ncs_projects/tree/main/peripheral_zephyr/i2c  where it scanned the i2c devices, I configured pins 2 for the sda   and 1 for the scl as you can see in my overlay, but I can't see the devices, I  I'm new, maybe I'm having trouble, I hope I can find a solution, you have the screenshots with the result in terminal.

    datasheet

    i2c devices scan code

    overlay DT

    Terminal

  • I found the solution, thanks to open my eyes, all was in the course. I found the address(0x38) for  the adafruit aht20 TH and I changed  my overlay fil to be like this 

    &i2c1 {
        mysensor: mysensor@038{
            compatible = "i2c-device";
            status = "okay";
            reg = < 0x38 >;
        };
    };
    After that my terminal show this "I2C bus i2c@9000 with address Ox38 is ready!" ;)
  • Hi,

    Great! Glad to hear that you were able to solve it with the information in the course! If you have any  

    Please feel free to open new tickets in the future if you have any other questions and/or see any new issues and we will try to help you to our best abilities

    Kind regards,
    Andreas

  • Sorry, Finally I was wrong, I can't found my aht20 i2c device, my nrf i2c@9000 controller  seen a 0x38 address with and without any device cause of this overlay propertie(reg = < 0x38 >;), so this not work for me. I've anable internal Pull-upps resistors still not working, i've disable internall pull-upps and use external 10kohm resistors for the both line still not working.     I can corfim that this  adafruit aht20 sensor work smoothly with my arduino mkr1000 device.  I hope you'll help please :)  

    Arduino Board

Related