AnsweredAssumed Answered

Quadrature Decoder TWR-KV46F150M

Question asked by Masum Burak Şahin on Jun 19, 2018
Latest reply on Jun 29, 2018 by Robin_Shen

Hi Everybody,


Because of my English is not enough, i couldn't explain my question previous time. I tried to make my sentences clear.


I  am working on reading position information from the quadrature encoder. I have twr-kv46f150m, twr-elev and twr-mc-lv3ph boards and try to run my codes on this setup. I am using MCUXpresso as IDE.


When is check the schematics of the PCB's i see that quad. encoder signals are tied to ch4 and ch6 of FTM3.


My problem is that FTM3_CNT is not increasing when I turn the shaft of the BLDC.


This is the code I have used:


#include <stdio.h>
#include "board.h"
#include "peripherals.h"
#include "pin_mux.h"
#include "clock_config.h"
#include "MKV46F16.h"
#include "fsl_ftm.h"
#include "fsl_port.h"


BOARD_InitBootPins();    //PORT C ADJUSTED
BOARD_InitBootClocks();    //CLOCK SETTİNGS
BOARD_InitDebugConsole();    /* Init FSL debug console. */

ftm_config_t Ftm;
FTM_GetDefaultConfig(&Ftm);    //RESET VALUE
FTM_Init(FTM3, &Ftm);


ftm_phase_params_t ftm_phase;
ftm_phase.enablePhaseFilter = false;
// ftm_phase.phaseFilterVal = 1;
ftm_phase.phasePolarity = kFTM_QuadPhaseNormal;
FTM_SetQuadDecoderModuloValue(FTM3, 0U, 1000U);
FTM_SetupQuadDecode(FTM3, &ftm_phase, &ftm_phase, kFTM_QuadPhaseEncode);


Any suggestion?


Thank you,

Masum Burak