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

AT24C512 + BMI160 + NRF52

Hi,

I am using nRF52832 soc to develop my project. with nRF5_SDK_15.3 . SES file

I need to connect both BMI160 accelerometer sensor and AT24C512 EEPROM ic in TWI.

how to use TWI with this. guide me to use both at a time.

BMI160 separately i can read the data.

but i can't read while connect to AT24C512

  • I'm sorry, but this is just code from your software. I need you to debug your software.

    Please see this page.

    Kind regards,
    Øyvind

  • Thank you,

    i understand what awneil going to tell. but my concern is to make multiple slaves for a one master is getting complexes.

    can yu please explain how this example works.

    https://infocenter.nordicsemi.com/index.jsp?topic=%2Fstruct_sdk%2Fstruct%2Fsdk_nrf5_latest.html&cp=5_0

    can you please how these functions are working:

    NRF_TWI_MNGR_DEF(m_nrf_twi_mngr, MAX_PENDING_TRANSACTIONS, TWI_INSTANCE_ID);
    APP_TIMER_DEF(m_timer);
    
    
    
     err_code = nrf_twi_mngr_init(&m_nrf_twi_mngr, &config);
        APP_ERROR_CHECK(err_code);
        
        
        
         APP_ERROR_CHECK(nrf_twi_mngr_perform(&m_nrf_twi_mngr, NULL, lm75b_init_transfers,
            LM75B_INIT_TRANSFER_COUNT, NULL));
            
        APP_ERROR_CHECK(nrf_twi_mngr_perform(&m_nrf_twi_mngr, NULL, mma7660_init_transfers,
            MMA7660_INIT_TRANSFER_COUNT, NULL));
    

  • Sunil vignesh said:
    but my concern is to make multiple slaves for a one master is getting complexes.

     In your case, you should only need to configure one master. As long as the sensor and EEPROM are connected and powered correctly, you should only need to issue their address and then the command (as per the I2C standard).

     

    Sunil vignesh said:
    can yu please explain how this example works.

     Not sure what example you mean, as the link points to the start of the SDK documentation.

     

    Sunil vignesh said:
    can you please how these functions are working:

     These are part of the Common Application Error Handler, more information here and here.

    Kind regards,

    Øyvind

  • Not sure what example you mean, as the link points to the start of the SDK documentation.

    is this TWI Transaction Manager Example 

    <InstallFolder>\examples\peripheral\twi_master_using_nrf_twi_mngr

  • my concern is to make multiple slaves for a one master is getting complexes

    I suggest that you go back to basics:

    1. Make sure that you understand the basics of I2C.
       
    2. Start with the TWI Scanner example.
      This will verify that your hardware connections are correct & working, and confirm that you have the correct Slave Addresses.
       
    3. Spend time studying this example, to understand how it works.
      Practice using the debugger to step through your code, examine variables, etc
      Practice using an oscilloscope or logic analyser to view what's happening on the wires.
       
    4. Save the Project - so that you can come back to it for reference later.
       
    5. Use the TWI Master example with just one of your slaves.
      Get that Slave working on its own.
      Again, practice using the debugger, scope, etc.
       
    6. Save the Project - you will need it later.
       
    7. Start again with the unmodified TWI Master example with the other of your slaves.
      Get that Slave working on its own.
       
    8. Save the Project - so that you can come back to it for reference later
       
    9. Now merge your two TWI Master projects together

    I suggest that you adopt an approach like this for all your projects:

    • Start with working examples;
    • Know your tools;
    • Take small steps at a time;
    • Keep "snapshots" of your work so that you can go back if things go wrong.
Related