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!" ;)
  • 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

  • I thought about all these alternatives, checked the forum (you have topics that are old), I did some research on the internet in general (I don't find many issue as other board), I discussed  with people more advanced than me, but I did not have a favorable response.  I just don't sit and wait for a response, when I come here it's a last resort, since I've exhausted the little resources I have.

    For arduino, It's just to make sure that my sensor actually works, not a comparison with other board.

    Overlay File 

    Diagram

    I don't  have logic analyser, I think I'll Buy it.

    Thanks

  • Hi,

    I see now that you're using the 7002DK and you've relied on the 5340 SoC doc. For the nRF7002DK you can use https://infocenter.nordicsemi.com/pdf/nRF7002_DK_User_Guide_v1.0.0.pdf as a reference doc

    Regarding your diagram and dts everything looks correct. As long as there are nothing else using the pins you've selected and you've instanced and initialized your I2C coms correct, this should be working. 

    Could you post your code as well?

    Kind regards,
    Andreas

Reply Children
Related