cancel
Showing results for 
Search instead for 
Did you mean: 

M41T62 second stop increment after set sqw frequency

lin xu
Associate
Posted on April 10, 2018 at 08:59

Hi, I want to use M41T62 calendar and sqw output functions in the same time. I try the below code, after call bsp_m41t62_set_sqw(sqwValue); the time in calendar stops and no more increment. But if I read all the register every time, the calendar start increment, but it take more power and time, so this action is not allowed.

My question is how to use SQW and calendar function in the same time? and why the SQW will effect the calendar function?

// --------------------------------------------------

    bsp_m41t62_set_rtc_time(18,12,13,1,20,30,30);

    bsp_m41t62_restart();

    while(1) {

        bsp_m41t62_get_rtc_time(&rtcTime);

        /*

        bsp_m41t62_read_all(rtcRegVal,16); // if run this code,the calendar start increment

        uart2_tx(rtcRegVal,16);

        */

        uart2_tx(&rtcTime.year,1);

        uart2_tx(&rtcTime.month,1);

        uart2_tx(&rtcTime.date,1);

        uart2_tx(&rtcTime.day,1);

        uart2_tx(&rtcTime.hour,1);

        uart2_tx(&rtcTime.minute,1);

        uart2_tx(&rtcTime.second,1);

        HAL_Delay(1000);

        sqwValue += 0x10;

        bsp_m41t62_set_sqw(sqwValue);      // reg 0x04 = 0x10 .. 0xF0, if this comment this code, the calender runs good

    }

//-----------------------------------------------------

#m41t62
0 REPLIES 0