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

Parents Reply
  • If you want to start the oscillator, then you need to set bit 7 in REG_RTCSEC to 1, i.e. you need to write 0x80 not 0x07. 

    The read operation is Not Acknowledged so it could be that you have to select the register you want to read from before 

    // Read REG_RTCSEC register

    uint8_t tx_data[] = {REG_RTCSEC };
    uint8_t rx_data[] = {0};

    // Select REG_RTCSEC register and use repeated start
    err_code = nrf_drv_twi_tx(&m_twi,MCP7940_I2C,tx_data , sizeof(tx_data),true);
    APP_ERROR_CHECK(err_code);

    // Read REG_RTCSEC register 
    err_code = nrf_drv_twi_rx(&m_twi,MCP7940_I2C,rx_data,1);
    APP_ERROR_CHECK(err_code);

Children
Related