2016-11-11 03:29 AM
Hi,
We are using SPC560B64 controller and want to start STM_0, unable to start STM counter. Please provide us the sample code for STM timer start. Regards, Bhagyashri2016-11-13 11:24 PM
Hello,
current version of SPC5Studio supports STM driver for RLA architecture. Driver comes with his own test application for all supported platform includind spc560b. Simply import it using the wizard, generate and you will get the code you need. the STM counter start code is located in stm_lld_enable functionvoid stm_lld_enable (STMDriver *stmd){
uint8_t i;/* set the prescaler */
stmd->stm_tagp->CR.R = (stmd->prescaler-1U) << 8 ; /* set compare register and enable channels */ for (i=0; i<stmd->noofchannels;i++){ if (stmd->stm_ch_config[i].enabled == TRUE){ /* set compare register */ stmd->stm_tagp->CH[i].CMP.B.CMP = stmd->stm_ch_config[i].counter; /* clear interrupt flag */ stmd->stm_tagp->CH[i].CIR.B.CIF = STM_CCR_CIF_CLEAR; /* enable channel */ stmd->stm_tagp->CH[i].CCR.B.CEN = STM_CIR_CEN_ENABLE; } } /* reset counter */ stmd->stm_tagp->CNT.R = 0x00000000U; /*enable STM */ stmd->stm_tagp->CR.B.TEN = STM_CR_TEN_ENABLE; } Regards2016-11-13 11:25 PM