using digital filter on external interrupt pin it overcomes on the button bouncing

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

using digital filter on external interrupt pin it overcomes on the button bouncing

ソリューションへジャンプ
2,773件の閲覧回数
RehabSoliman
Contributor I

if I use digital filter on external interrupt pin it overcome on the button bouncing

and I want to understand this part it is correct or not, in case not I want to Know a way to overcome on the button bouncing I am using FreeRTOS  and also ISR 

ラベル(1)
0 件の賞賛
返信
1 解決策
2,719件の閲覧回数
JRoberto
NXP TechSupport
NXP TechSupport

[9:04 AM] Josue Roberto Gonzalez

Hello @RehabSoliman 

The RTM documentation states that the Pins driver provides the following function below to configure the digital filter:

 

Function Name: PINS_DRV_ConfigDigitalFilter
Description  : This function configures digital filter for port with given 
               configuration:
               Note: Updating the filter configuration must be done only 
               after all filters are disabled.
Parameters   :    
             * PORT_Type *const base -> (This is the Port base pointer 
              (PORTA, PORTB, PORTC, etc.))
             * const port_digital_filter_config_t *const config -> The 
               digital filter configuration struct
Returns: void

 

This are the steps to use it.
* Create a configuration strucure of type port_digital_filter_config_t
* Set the desired values into your configuration structure
* Call PINS_DRV_ConfigDigitalFilter function making sure that the Digital filter is disabled. (It can be before the PINS_DRV_Init function gets called)

 

In example:

 

  port_digital_filter_config_t PTE_DigFltr_Config;
  PTE_DigFltr_Config.clock = 1U;
  PTE_DigFltr_Config.width = 0x1F;

  PINS_DRV_ConfigDigitalFilter (PORTE, &PTE_DigFltr_Config);
  error = PINS_DRV_Init(NUM_OF_CONFIGURED_PINS0, g_pin_mux_InitConfigArr0);

 

I hope this information is helpful.

 

Best Regards

元の投稿で解決策を見る

0 件の賞賛
返信
8 返答(返信)
2,743件の閲覧回数
JRoberto
NXP TechSupport
NXP TechSupport

@RehabSoliman 

From the Screenshots you sent me I can't tell if you're using SDK or RTD neither which specific S32K1xx you are setting up, so I'm not able to bring you any more specific answer but I believe this can help you.

The clock selection is explained in the Reference Manual 12.5.8 Digital Filter Clock Register. (You just need to set the PORT_DFCR:CS to the desired source clock). If the max selectable delay with BUS_CLK is too short, you need to use LPO but keep in mind the clock is not precise.


You can measure the LPO clock at CLKOUT pin. Here is a bare metal example where the Digital Filter is being used.
https://community.nxp.com/t5/S32K-Knowledge-Base/Example-S32K144-RTC-VLPS/ta-p/1119655

The Digital Input Filter configuration steps are described in the Reference Manual 12.1.4.1 Digital input filter configuration sequence while using GPIO interrupt

The ConfigTools does't have the option to change the Digital Filter settings other than enable or disable it so, this has to be done by code. You can take a look to the API documentation.

If you want me to provide more information I'd need to know your development environment:
* IDE and its Version
* SDK or RTD and its version
* Which specific MCU you are using

Best Regards!

0 件の賞賛
返信
2,741件の閲覧回数
RehabSoliman
Contributor I

 

for :

IDE and its Version : S32K design studio 3.4
 SDK : S32K142 EVB

could you provide me  more information ?

0 件の賞賛
返信
2,737件の閲覧回数
JRoberto
NXP TechSupport
NXP TechSupport

Thank you for reply.

So the development environment is:

IDE: S32 DS for S32 Platform Version: 3.4

Target: S32K142 EVB 

SDK or RTD: ?  Version: ?

I still need the SDK or RTD information because the functions change from version to version.

Could you please provide me this information?  

Best Regards

0 件の賞賛
返信
2,730件の閲覧回数
RehabSoliman
Contributor I

thanks for your reply  

for 

SDK or RTD: ?  Version: ?

it is S32SDK_S32K1XX_RTM_4.0.2

 

0 件の賞賛
返信
2,720件の閲覧回数
JRoberto
NXP TechSupport
NXP TechSupport

[9:04 AM] Josue Roberto Gonzalez

Hello @RehabSoliman 

The RTM documentation states that the Pins driver provides the following function below to configure the digital filter:

 

Function Name: PINS_DRV_ConfigDigitalFilter
Description  : This function configures digital filter for port with given 
               configuration:
               Note: Updating the filter configuration must be done only 
               after all filters are disabled.
Parameters   :    
             * PORT_Type *const base -> (This is the Port base pointer 
              (PORTA, PORTB, PORTC, etc.))
             * const port_digital_filter_config_t *const config -> The 
               digital filter configuration struct
Returns: void

 

This are the steps to use it.
* Create a configuration strucure of type port_digital_filter_config_t
* Set the desired values into your configuration structure
* Call PINS_DRV_ConfigDigitalFilter function making sure that the Digital filter is disabled. (It can be before the PINS_DRV_Init function gets called)

 

In example:

 

  port_digital_filter_config_t PTE_DigFltr_Config;
  PTE_DigFltr_Config.clock = 1U;
  PTE_DigFltr_Config.width = 0x1F;

  PINS_DRV_ConfigDigitalFilter (PORTE, &PTE_DigFltr_Config);
  error = PINS_DRV_Init(NUM_OF_CONFIGURED_PINS0, g_pin_mux_InitConfigArr0);

 

I hope this information is helpful.

 

Best Regards

0 件の賞賛
返信
2,684件の閲覧回数
RehabSoliman
Contributor I

thanks for your response

I will configure this part based on what you say 

0 件の賞賛
返信
2,761件の閲覧回数
JRoberto
NXP TechSupport
NXP TechSupport

Hello @RehabSoliman

 

That depends on your signal conditions.
The Digital filter will introduce delay in your signal. Depending on the settings you select and the running environment, digital filtering can handle the signal bounce or not.

 

For Example:
If your digital filter is clocked by the bus clock (PORT_DFCR:CS = 0) at 48 Mhz and you set the Filter Length to its max value (PORT_DFWR:FILT = 0x1F), then the de-bounce time will be 645.83 ns (If the clock frequency is 100% stable) so if the signal stabilization time is lower than that, then you won't have problems.

 

If your digital filter is clocked by LPO, the frequency is much lower (As per the datasheet, the LPO clock can be within 113 - 139kHz) so the max de-bouncing time you will be between 274.33 - 223.02 us

 

Kindly take a look at chapters 12.6.4 External interrupts and 12.6.5 Digital filter

 

Best regards

0 件の賞賛
返信
2,760件の閲覧回数
RehabSoliman
Contributor I

Thanks for your response 

I saw digital filter part in reference manual but I don't know which clock  is selected in digital filter and also in the two cases the delay time is very small, I am using HSRUN mode and bus clock is 56MHz and LPO clock is 128KHz, I want to do much delay and also I want to know, which clock the digital filter use ?

and I want you to tell me the steps to configure this part because I just enable the digital filter to this pin only  

0 件の賞賛
返信