This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

How to connect single pwm signal to multiple GPIO

Hi,

At the moment I generate 4 independent pwm signals, I would prefer to have 6 but this is not possible to my understanding due to the lack of GPIOTE [ref1,ref2].

So I am trying to connect a single PWM signal to 2 gpio pins, is this possible through the ppi or any other way?

Link, here they advise to connect them in hardware. I would like to do this in software so that in the future it is possible to switch from PWM to something else.

Kind regards,

Niels Kool

Parents
  • There are several ways to do that. As your references point out you can fork the TE to 2 gpio.  Then since one TEP can drive many EEP's, you can wrap it back around in PPI to bring it out again.  Only downside of this is the first TEP and the replicated TEP will be delayed by one Pclk. Though you could bring out four or more TEP's in phase if they are all this second replication.

    If it is a slow PWM signal, eg more than millisecond period, then you can have the PWM TEP drive an ISR and then you can write as many  bits in the port register as you wish within the interrupt handler. If this is the only task running on the board then you can have more frequent ISR's, but not when running a softdevice.

Reply
  • There are several ways to do that. As your references point out you can fork the TE to 2 gpio.  Then since one TEP can drive many EEP's, you can wrap it back around in PPI to bring it out again.  Only downside of this is the first TEP and the replicated TEP will be delayed by one Pclk. Though you could bring out four or more TEP's in phase if they are all this second replication.

    If it is a slow PWM signal, eg more than millisecond period, then you can have the PWM TEP drive an ISR and then you can write as many  bits in the port register as you wish within the interrupt handler. If this is the only task running on the board then you can have more frequent ISR's, but not when running a softdevice.

Children
Related