Other Parts Discussed in Thread: TIDA-00476, , MSP-FET
Tool/software: Code Composer Studio
I'm working on a solarcharger based on TIDA-00476 with this source en other examples The software should be ok now.
For now I have one problem, If the battery voltage is lower then 11V I init the comparator en put the controller in LPM4.
But I never can wakeup the controller again and I'm sure everything is ok? I measure the pin en when I change the solar panel voltage
I can measure this on the pin. I also put the pin on min en max level but the comparator/ interrupt is not working.
I checked everyting (I think) in the datasheet so for me its complete.
This is where the battery is below 11V:
if (Battery_Voltage < BATTERY_MIN_VOLTAGE) {// BV < 11v Turn_Off_Boost_Stage(); LOAD_DISABLE; init_Comparator_System_Reset(); __bis_SR_register(LPM4); }
Init Comparator:
void init_Comparator_System_Reset(void) { System_reset_Mode_ON = 1; Load_Monitor_Mode_ON = 0; // clear all registers CBCTL0 = CBCTL1 = CBCTL2 = CBCTL3 = CBINT = 0; CBCTL0 |= CBIPEN + CBIPSEL_0; // Enable V+, input channel CB0 CBCTL1 |= CBPWRMD_1; // normal power mode CBCTL2 |= CBRSEL; // VREF is applied to -terminal CBCTL3 |= BIT0; // Input Buffer Disable @P1.0/CB0 // #define CBREF1_10 (0x0A00) /* Comp. B Int. Ref.1 Select 2 : 11/32 */ CBCTL2 |= CBRS_1 + CBREF1_10 + CBREF0_10; // VCC applied to R-ladder; to be set after calculation __delay_cycles(7500); // delay for the reference to settle //TI recommends clearing CBIFG after configuring the comparator for proper interrupt behavior during operation. CBINT &= ~(CBIFG + CBIIFG); // Clear any errant interrupts CBINT |= CBIE; // Enable CompB Interrupt on rising edge of CBIFG (CBIES=0) CBCTL1 |= CBON; // Turn On ComparatorB }
// Comp_B ISR - FOR SYSTEM RESET AND OVERCURRENT PROTECTION
#pragma vector=COMP_B_VECTOR __interrupt void Comp_B_ISR(void) { if (Load_Monitor_Mode_ON) { TURN_OFF_BOOST_STAGE; LOAD_DISABLE; Load_On = 0; OC_Triggered = 1; OC_Triggered_Counter = 0; //Take action for over current protection by setting a flag } else if (System_reset_Mode_ON) { PMMCTL0 |= PMMSWBOR; // Software brownout reset. Setting this bit to 1 triggers a BOR. This bit is self clearing. // PMMCTL0 |= PMMSWPOR; // Software power-on reset. Setting this bit to 1 triggers a POR. This bit is self clearing. } CBINT &= ~CBIFG; // Clear Comp_B output interrupt flag //als hij hier komt is er altijd een interrupt }
What do I have forgot?