Martin Howell

Header documentation for SDK function TPM_SetupDualEdgeCapture

Discussion created by Martin Howell on Mar 28, 2019
Latest reply on Apr 1, 2019 by Kerry Zhou

After a lot of debugging and peering at registers I found an incorrect and/or misleading comment in fsl_tpm.h for the function TPM_SetupDualEdgeCapture()

 

It reads:

/*!
* @brief Configures the dual edge capture mode of the TPM.
*
* This function allows to measure a pulse width of the signal on the input of channel of a
* channel pair. The filter function is disabled if the filterVal argument passed is zero.
*
* @param base TPM peripheral base address
* @param chnlPairNumber The TPM channel pair number; options are 0, 1, 2, 3
* @param edgeParam Sets up the dual edge capture function
* @param filterValue Filter value, specify 0 to disable filter.
*/
void TPM_SetupDualEdgeCapture(TPM_Type *base,
tpm_chnl_t chnlPairNumber,
const tpm_dual_edge_capture_param_t *edgeParam,
uint32_t filterValue);

 

I was trying to combine channels 2 and 3 so passed kTPM_Chnl_2 to the chnlPairNumber. I should have passed kTPM_Chnl_1!! The comment should probably read

 

/*!
* @brief Configures the dual edge capture mode of the TPM.
*
* This function allows to measure a pulse width of the signal on the input of channel of a
* channel pair. The filter function is disabled if the filterVal argument passed is zero.
*
* @param base TPM peripheral base address
* @param chnlPairNumber The TPM channel pair number; options are 0 to combine ch 0 and 1, 1 to combine ch 2 and 3, 2 to combine ch 4 and 5
* @param edgeParam Sets up the dual edge capture function
* @param filterValue Filter value, specify 0 to disable filter.
*/

 

Probably we shouldnt be using tpm_chnl_t for this parameter but define another type tpm_combine_chnl_t instead.

Outcomes