Forum Discussion

snehal_p's avatar
snehal_p
Icon for Contributor rankContributor
3 years ago

How to use hps driven I2C pins

Hello,

Can anyone help me with guidelines to use hps driven I2C pins on DE1SOC board

Thanks,

snehal_p

11 Replies

  • tehjingy_Altera's avatar
    tehjingy_Altera
    Icon for Regular Contributor rankRegular Contributor

    Hi snehal_p


    For the DE1-SOC dev kit, I see that the I2C is connected to a multiplexer in which you will need to toggle the HPS_I2C_CONTROL (HPS_GPIO48) to switch between the FPGA owning the i2c or the HPS.


    Once the dev kit boots into the linux environment you could try searching for GPIO48 under the /dev directory to toggle the i2c to HPS.


    You could refer to the document below section 3.6.5

    https://www.terasic.com.tw/cgi-bin/page/archive_download.pl?Language=China&No=836&FID=ae336c1d5103cac046279ed1568a8bc3



    Regards

    Jingyang, Teh


    • snehal_p's avatar
      snehal_p
      Icon for Contributor rankContributor

      Hello Jingyang,

      I'm trying to interface rtc ds3231 breakout board to DE1SOC using hps driven I2C . I2c bus is being not detected.

      Thanks,

      snehal_p

      • snehal_p's avatar
        snehal_p
        Icon for Contributor rankContributor

        Hello Jingyang,

        PFA screenshot of error I get when I compile the demonstration i2c switch code. I receive similar error when I compile c code for rtc interface. Can you please help me with this.

        Thanks,

        snehal_p

  • tehjingy_Altera's avatar
    tehjingy_Altera
    Icon for Regular Contributor rankRegular Contributor

    Hi


    It seems like there is a missing define in the make file.

    Could you check if there is a define for the CV, something like below:

    "ALT_DEVICE_FAMILY = soc_cv_av"


    Regards

    Jingyang, Teh


    • snehal_p's avatar
      snehal_p
      Icon for Contributor rankContributor

      Hello Jingyang,

      I2C adapter is being detected but not able to read and write.

      PFA screenshot.

      Thanks,

      snehal_p

  • tehjingy_Altera's avatar
    tehjingy_Altera
    Icon for Regular Contributor rankRegular Contributor

    Hi Snehal


    It seems like the i2c is working if it is able to probe the i2c bus.

    What is the expected value that the i2cget command should return?


    Regards

    Jingyang, Teh


    • snehal_p's avatar
      snehal_p
      Icon for Contributor rankContributor

      Hello Jingyang,

      Expected value is whatever we write as in this case 255.

      Basically I'm trying to interface rtc ds3231 to this i2c bus. What would be the appropriate approach to use this I2C bus to interface external rtc breakout board.

      Can you please help me with approach.

      Thanks,

      snehal_p

  • tehjingy_Altera's avatar
    tehjingy_Altera
    Icon for Regular Contributor rankRegular Contributor

    Hi Snehal_p


    The method you are using would be a good tool with start with.

    Could you try getting some waveform of the i2c so that we could see if the read and write request is sending properly to the rtc breakout board?


    Regards

    Jingyang, Teh


  • tehjingy_Altera's avatar
    tehjingy_Altera
    Icon for Regular Contributor rankRegular Contributor

    Hi


    Since there are no feedback for this thread, I shall set this thread to close pending. Please login to ‘https://supporttickets.intel.com’, view details of the desire request, and post a feed/response within the next 15 days to allow me to continue to support you. After 15 days, this thread will be transitioned to community support. The community users will be able to help you on your follow-up questions.


    If you happened to close this thread you might receive a survey. If you think you would rank your support experience less than 10 out of 10, please allow me to correct it before closing or if the problem can’t be corrected, please let me know the cause so that I may improve your future service experience.


    Regards

    Jingyang, Teh