working version

Dependencies:   mbed mbed-rtos SimpleDMA FreescaleIAP eeprom

Fork of CDMS_CODE_FM_28JAN2017 by samp Srinivasan

RESET_functions.h

Committer:
ee12b079
Date:
2016-08-06
Revision:
289:9bd62b69874c
Parent:
257:7d404e9dc9e2
Child:
357:f3d48d62e00e

File content as of revision 289:9bd62b69874c:


void RESET_COMRX();
void RESET_RTC();

void RESET_COMRX()
{
    gPC.printf("\r COM RX resetting\n");
    COM_RX_CNTRL = 0;
    wait_ms(10);
    COM_RX_CNTRL =1;
}

void RESET_RTC()
{
    gPC.printf("Resetting RTC");
    gCS_RTC=1;
    gCS_RTC=0;
    spi.write(0x81); //register address with write flag
    spi.write(0x80);//enabling stop bit in the seconds register
 
    gCS_RTC=1;
    gCS_RTC=0;
    spi.write(0x81);
    spi.write(0x00);//disabling the stop bit to restart the oscillator 

    wait_ms(4000);
    //clearing the halt bit 
    gCS_RTC=1;
    gCS_RTC=0;
    spi.write(0x8C);
    spi.write(0x00);
     
    //clearing the OF bit 
    gCS_RTC=1;
    gCS_RTC=0;
    spi.write(0x8F);
    spi.write(0x00);
}