S32K144 Quadrature Encoder

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

S32K144 Quadrature Encoder

2,189 Views
alexanderdragos
Contributor I

Hello everyone,

can anybody help me, finding a sample code for the usage of a rotary encoder in the S32K144 Firmware with the Devkit-Motorgd extension board plugged on the upper side of the S32K144 Eval Board?

In the Application Demo Software "MTRDEVKSPNK144" the configuration code for flexTimer1 is available for quadrature encoder, but it is not used or any initialization done.

It would be very nice, if someone can provide a code snippet for the encoder usage or help me regarding the config and usage therefore.

Many thanks in advance!

Best regards,

Alex

8 Replies

1,515 Views
Thomas_Denner
NXP Employee
NXP Employee

Hi,

has there been an answer to the original question for C-code sample for quadrature encoder initialization? I have a similar request from a customer who sees the CPU to jump into default ISR when he executes FTM_DRV_INIT for Quadrature Decoder using FTM1 on K116.

The registers for QD are available (and I can write them without any errors) even for FTM0 where QD is not supported in K116 according to our RM. What happens if I init a QD using FTM0?

Many thanks,

Thomas

0 Kudos

1,515 Views
dumitru-daniel_
NXP Employee
NXP Employee

Hi adriantudor‌,

Can you have a look over this ? Thank you!

Daniel

0 Kudos

1,515 Views
adriantudor
NXP Employee
NXP Employee

Hi Thomas,

FTM_qd.PNG

Here you have Quadrature decoder project example for S32K116.

I have a similar request from a customer who sees the CPU to jump into default ISR when he executes FTM_DRV_INIT for Quadrature Decoder using FTM1 on K116.

   In this picture, as you can see, i have added flexTimer_pwm1:ftm_pwm module but this has not been initialized. If you uncomment this yellow line (//FTM_DRV_Init(INST_FLEXTIMER_PWM1, &flexTimer_pwm1_InitConfig, &ftmStateStruct);) wich is FTM0 initialization, then because this module doesn't have clock enabled (see yellow dot in picture --> clock config) you will get the stuck in default interrupt.

The registers for QD are available (and I can write them without any errors) even for FTM0 where QD is not supported in K116 according to our RM. What happens if I init a QD using FTM0?

Even if you can write QD registers for FTM0 module you can not allocate any pin for QD FTM0, so it's useless to config QD register for FTM0.

Best regards,

Adrian

0 Kudos

1,515 Views
alexanderdragos
Contributor I

Hello Daniel,

thanks a lot for reply.

I'm creating the program in S32 Design Studio, therefore I need the c/h code.

Best regards,

Alex

1,515 Views
andrepogoda
Contributor I

Hello,

I also try to spin a BLDC or PMSM motor with S32K144 and MotorGD in S32 Design Studio. So a demo c/h code with using encoder signals would be very helpful.

Best regards,

Andre

0 Kudos

1,515 Views
cjf6221
Contributor I

Hello Andre,

Have you implemented it with S32K144 in S32 Design Studio. I am trying to implement it using FTM2. If you can provide some help, it will be appreciated.

Best,

Jianfei

0 Kudos

1,515 Views
dumitru-daniel_
NXP Employee
NXP Employee

marekstulrajter‌,

Do you have such code that could be shared with the customers - even if it is just a demo code ?

Thank you!

Daniel

0 Kudos

1,515 Views
dumitru-daniel_
NXP Employee
NXP Employee

Hi Alex, 

Do you wish to work with MATLAB toolbox or you need the c/h code ?

Thank you!

Daniel

0 Kudos