Page 1 of 1
KL-15 function
Posted: Thu 8. Dec 2016, 09:55
by JPS7495
Hello,
I try to implement the switch off function with KL-15 input.
It works with your example but the device never restart when KL-15 is on.
What we need to do?
regards
Re: KL-15 function
Posted: Thu 8. Dec 2016, 11:21
by S.Michaelsen
Hi,
are you sure that the module is really switched off? Is there any CAN traffic on your bus when you switch off the module? If so this might keep the module awake. If you use the unmodified example code it might happen in rare cases that the module has already entered the while(1) loop after hardware_Off(); command but is not totally switched off when a CAN message arrives. The CAN message might enable the power supply again without a proper reset of the controller. You could e.g. force the module to reset if it stays in this loop too long. This could be done e.g. calling void hardware_reset(void) function manually or setting the controllers watchdog timer before entering the loop.
Code: Select all
//! @brief Starts the watchdog timer
//! @param timeOutms Time out in ms
void hardware_WatchdogInit(u32_t timeOutms){
WDTC=timeOutms; // Timeout=Twdclk *4 * timeOutms
WDMOD=3; // set reset mode (rest µC in case of a watchdog)
WDCLKSEL=0; // select internal RC-Oscillator
WDFEED=0xAA; // Watchdog enable sequence
WDFEED=0x55;
WatchdogInit = TRUE;
}
BR,
Stephan
Re: KL-15 function
Posted: Fri 9. Dec 2016, 17:10
by JPS7495
Thanks for your comment.
The can bus is not wired when I try KL-15 shut-off.
I will try to implement your watchdoInit.
regards
Re: KL-15 function
Posted: Tue 3. Jan 2017, 08:41
by JPS7495
Happy new year to you.
I have one problem with KL-15 shut off.
The whole board shuts off when KL-15 is off and it restarts when KL-15 is on, but the can bus doesn't work.
I don't use ODB2 function.
Each time KL-15 and VBat are off the can works on new run.
The code is like this
if((hardware_In(ignition) == FALSE) && (powerOffTime == 0))
{
enrState=ENR_STOP;
Enregistre_Task();
//The following two lines are only to show what is possible to switch off.
gps_Off(); //Power supply off for GPS.
gprs_Off(); //Power supply off for GPRS.
hardware_Off(); //Power supply off for the whole board. Including GPS and GPRS.
for(i=0;i<3000;i++)
{
z =1;
}
while(1)
{
}; //Wait until power down.*/
}
powerOffTime is used to know if there is can traffic.
Do you have an idea?
regards
Re: KL-15 function
Posted: Wed 4. Jan 2017, 12:45
by PEAK-Support
you also have send us a support E-Mail - please do NOT double the workload - we will answer fast as possible but you limit the ressources if you send out double posts! Our developers from France have send you the information yesterday...