Using pin drive S0D1 with GPIOTE

I'm working in a project where I have to use produce a PWM signal which actively drives the pin low for 0, and disconnects the pin for 1. The PWM is generated by an in house created library, which uses one timer and one gpiote to toggle the pin at the correct times. 

I configure the pin for the PWM as:

NRF_GPIO->PIN_CNF[PIN_NUM]          = (GPIO_PIN_CNF_SENSE_Disabled   << GPIO_PIN_CNF_SENSE_Pos)
                                    | (GPIO_PIN_CNF_DRIVE_S0D1       << GPIO_PIN_CNF_DRIVE_Pos)
                                    | (GPIO_PIN_CNF_PULL_Disabled    << GPIO_PIN_CNF_PULL_Pos )
                                    | (GPIO_PIN_CNF_INPUT_Disconnect << GPIO_PIN_CNF_INPUT_Pos)
                                    | (GPIO_PIN_CNF_DIR_Output       << GPIO_PIN_CNF_DIR_Pos  );

However this produces a pin state that always seem to be disconnected.

Is it possible to do what I'm after?

Note: I think it is very unlikely that the issue is within our PWM library, as this library has been in use in several products over several year without issues. It has work well on both S0S1 and H0H1 modes in the past.

Parents
  • Hi 

    If I understand you correctly you can make the code work simply by changing GPIO_PIN_CNF_DRIVE_S0D1 to GPIO_PIN_CNF_DRIVE_S0S1, but if you use S0D1 it is always disconnected, and pulled high?

    It should be possible to set manual GPIO settings through PIN_CNF even when the pin is controlled by some other peripherals such as GPIOTE. Some of the GPIO settings will be overriden by that peripheral, but drive strength should not. 

    Best regards
    Torbjørn

Reply
  • Hi 

    If I understand you correctly you can make the code work simply by changing GPIO_PIN_CNF_DRIVE_S0D1 to GPIO_PIN_CNF_DRIVE_S0S1, but if you use S0D1 it is always disconnected, and pulled high?

    It should be possible to set manual GPIO settings through PIN_CNF even when the pin is controlled by some other peripherals such as GPIOTE. Some of the GPIO settings will be overriden by that peripheral, but drive strength should not. 

    Best regards
    Torbjørn

Children
No Data
Related