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

MCP7940 drivers for nrf52840

We are working on external RTC MCP7940(i2c) interfaced with nrf52840. Please check if drivers of the same for nrf52/51 are available or any implementation of CLOCK using MCP7940 with NRF?

Regards

Vishal Aditya

Embedded Software Engineer

  • //    for (address = 1; address <= TWI_ADDRESSES; address++)
    //    {
    				while(1)
    				{
            err_code = nrf_drv_twi_rx(&m_twi, 0x6F, &sample_data, sizeof(sample_data));
            if (err_code == NRF_SUCCESS)
            {
                detected_device = true;
                NRF_LOG_INFO("TWI device detected at address 0x%x.\r\n", address);
    
            }
            NRF_LOG_FLUSH();
    			}

    please check if this works for you? Let me know if a logic analyzer is required?

  • bjorn , can u pls. check the codes for mcp7940 and help in resolving

  • The screenshot showing nine clock pulses show that the slave does not ACK the address as the SDA line is high on the 9th clock pulse, you should also see nrf_drv_twi_rx returning NRF_ERROR_DRV_TWI_ERR_ANACK.

    The nRF is correctly transmitting 0b11011111( 7 bit address 1101111 followed by the read bit set to 1) and then on the 9th clock pulse the MCP7940 is not pulling the SDA lin low to ACK the address transmission. 

  • As far as I can see the nRF52840 is transmitting the correct sequence, its the TWI slave that must ACK by pulling SDA low during the last bit. Is nrf_drv_twi_rx returning NRF_ERROR_DRV_TWI_ERR_ANACK?

    If you have access to a logic analyzer, then it would be useful to see a logic trace, just to verify that the oscilloscope measurements are correct. 

Related