PWM on VF61 pin not compatible with Colibri family

I need to enable PWM functionality on FTM3_CH2 pin for Colibri VF61 (SODIMM 99).

This is not one of the PWM pins compatible with the Colibry family.

I did some tests and I successfully enable the PWM on the desired pin using

Pwm_SetConfigInt(hPwm, L"io", uIoPin.GenericDefinition, StoreVolatile);

but I have some questions on the ToradexCElibrary (v 2.1):

  • Pwm_Init() accepts only L"PWM1", L"PWM2", L"PWM3" or L"PWM4", but none of this is what I need. Since the documentation states

This function call does not modify any hardware registers.

I used L"PWM1" but I don’t know if this is the expected way to do. Could you clarify, please?

  • Definition for Pwm_SetConfigInt() is

    BOOL Pwm_SetConfigInt (HANDLE hPort, const TCHAR *paramName, DWORD value, ParamStorageType storageType)
    If the function doesn’t modify the parameter value, I suggest to change the definition to const DWORD value
    Do you think it would be a good idea?

Dear @vix

  • Using Pwm_SetConfigInt() is the expected way to change the PWM pin.
    The satatement “This function call does not modify any hardware registers” refers to the fact, that Pwm_Init() does only cache the pin setting in the internal state variable. The actual write to the hardware registers is done in the following Pwm_Open().

  • Using the const keyword for function parameters only makes sense if the parameter is a pointer (to mark that the memory where the pointer points to does not get modified).
    For non-pointer parameters, like in (..., DWORD value, ...), the const keyword does not make any difference, because parameters are anyway passed by-value and cannot be modified inside the function. It is not common practice in c coding to mark such parameters as const, therefore we will leave the definition unmodified.
    Thank you anyway for the suggestion, we always appreciate our customer’s inputs.

Regards, Andy