IC_PAL usage

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

IC_PAL usage

1,303 Views
yfliu
Contributor IV

Hi,

I am trying IC_PAL module of S32SDK with S32K144 MCU.

 

I am having difficulties:

  • The Continuous Measurement flag can't be checked in Processor Expert. I am wondering the IC feature is one-shot if this flag is not checked. Which is not what I want.
  • There seems no call back for counter overflow event. But I need it so that to make a big in RAM counter.

Can someone give me a hand?

 

0 Kudos
5 Replies

1,283 Views
yfliu
Contributor IV

Thanks. I looked at FTM_IC usage in that example you mentioned and added the FTM_IC component to the existing work project which is based on LPSPI_DMA sample. The LPSPI_DMA sample loop does 1000 xfers (each size is 16B) and checks the result.

I added calls like below:

  1. FTM_DRV_Init();
  2. FTM_DRV_InitInputCapture();
  3. FTM_DRV_DeinitInputCapture();
  4. FTM_DRV_Deinit();

before entering the SPI test loop. Everything seems fine here.

However, if I comment out step 3 and 4 so that to keep FTM_IC running, I then noticed the SPI test loop never ends, at least for more than 400 loops. It does end if loop count is 350. I am guessing the FTM component initialization might have some interferences with the LPSPI DMA sample but not sure what it is. Things might be fine if the SPI xfer count is small... but it will happen if there are many xfers (such as 375 times).

For your reference, I am using fixed frequency configuration as my FTM_IC clock source as I want an effective 1Mhz clock. I have overflow interrupt enabled but didn't do anything meaningful yet.

Do you experience the same behavior there?

 

0 Kudos

1,255 Views
yfliu
Contributor IV

Some updates on FTM_IC component's strange behavior described above: it seems that if I disable the  "overflow interrupt", the strange behavior won't happen. If I enable the overflow ISR, it will happen when the # of xfers are large enough (probably longer than the interval needed for an overflow to occur?).

Anyway, @Robin_Shen please see if the FTM_IC component's overflow ISR is properly implemented?

0 Kudos

1,226 Views
Robin_Shen
NXP TechSupport
NXP TechSupport

Sorry for the delay!
If you enabled the Timer overflow interrupt, you may need to input the callback function. Otherwise it will run into faultISR.

Callback.jpg

But the FTM_IC driver seems does not count the times of overflow. FTM_DRV_InputCaptureHandler only counts the overflow situation once.

Measurement when overflow occurred.jpg
Here is the topic once discussed: The issue about FTM input capture for S32K114 and used SDK configuration

0 Kudos

1,196 Views
yfliu
Contributor IV

Robin,

Not sure I can catch your explanations.

Here I used an empty callback like:

void ic_pal1_cb(ic_event_t ev, void*p){
}

and referred to it in ProcessorExpert's configuration for FTM1 channel#0. With this callback and "timer overflow interrupt" optioin enabled, I still get the strange behavior as described above.

I am wondering if this is the right way to handle the timer overflow interrupt? I assume the callback is called from an ISR defined by the IC_PAL driver which shall manage the ISR flags correctly...

 

Regards,

 

0 Kudos

1,295 Views
Robin_Shen
NXP TechSupport
NXP TechSupport

Hi yfliu,

Continuous Measurement can be checked for some of the Signal Measurement Mode.

Continuous Measurement ic_pal.png

I did not find the call back for counter overflow event.

Would you please have a look at ftm_signal_measurement_s32k144 SDK example. Check whether the ftm_ic meet requirements.

Best Regards,
Robin
-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos