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

Parents
  • 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

  • Can someone help me please.

    It's quite frustrating to know that I can't get help with my i2c problem, I'm not making any progress in learning, can anyone help me please? I've already wasted enough time with your products.

  • Hi,

    A few items regarding your experiences regarding the time this has taken

    1. Response time will vary from time to time. In this case a solution has been presented in form of the I2C academy course, but we keep the case open to help you get to your goal.
    2. Arduino, which is meant for learning microcontrollers and electronics, is unfortunately a big leap away from embedded developing and computing and you will have to spend some time to bridge the gap between these areas of the field. In arduino you can do 'sensor.available()' and everything magically works, while in embedded developing you will have to do some more configurations
    3. You can also search the forum for similar open cases and find information for how to configure I2C there
    4. The Zephyr discord community is also a support forum that contains input and tips regarding how to use peripherals 

    Now regarding your other issue

    1. Can you provide a small diagram to show how you've connected your sensor to the DK they are working with
    2. Can you share your overlay, prj.conf, and main file, so that we may take a closer look
    3. Do you have access to a logic analyser you can use to debug and check the lines?

    Let me know about these three last items and we'll see what we can do for you.

    Kind regards,
    Andreas

Reply
  • Hi,

    A few items regarding your experiences regarding the time this has taken

    1. Response time will vary from time to time. In this case a solution has been presented in form of the I2C academy course, but we keep the case open to help you get to your goal.
    2. Arduino, which is meant for learning microcontrollers and electronics, is unfortunately a big leap away from embedded developing and computing and you will have to spend some time to bridge the gap between these areas of the field. In arduino you can do 'sensor.available()' and everything magically works, while in embedded developing you will have to do some more configurations
    3. You can also search the forum for similar open cases and find information for how to configure I2C there
    4. The Zephyr discord community is also a support forum that contains input and tips regarding how to use peripherals 

    Now regarding your other issue

    1. Can you provide a small diagram to show how you've connected your sensor to the DK they are working with
    2. Can you share your overlay, prj.conf, and main file, so that we may take a closer look
    3. Do you have access to a logic analyser you can use to debug and check the lines?

    Let me know about these three last items and we'll see what we can do for you.

    Kind regards,
    Andreas

Children
Related