Good day! I would like to use pwm and interrupt on raspberry GPIO pins but i don't know which GPIO pins are actually dedicated for pwm output and which is for hardware interrupts, is there a way for me to know which is which? TIA!


All the GPIO may raise interrupts. On Pis with the 40 pin expansion header that is GPIO 2 to GPIO 27 (you can also use GPIO 0 and 1 but their use is discouraged).

The following GPIO may be connected to hardware PWM (note, there are only TWO channels).

12  PWM channel 0  A+/B+/Pi2/Zero and compute module only
13  PWM channel 1  A+/B+/Pi2/Zero and compute module only
18  PWM channel 0  All models
19  PWM channel 1  A+/B+/Pi2/Zero and compute module only

40  PWM channel 0  Compute module only
41  PWM channel 1  Compute module only
45  PWM channel 1  Compute module only
52  PWM channel 0  Compute module only
53  PWM channel 1  Compute module only

Hardware timed PWM can be provided by software on all GPIO on the expansion header (not as flexible as full hardware PWM, similar to Arduino e.g. 800Hz, 255 steps).

  • I see.. haha I originally thought that raspberry pi would have a pin purposed to handle pwm like the arduino having a timer for that function. But anyway frequency timing is not that important for my application at the moment so thank you so much for the details! I appreciated that. Jan 10 '16 at 8:40
  • @RevInguito My pigpio library lets you use PWM.
    – joan
    Jan 10 '16 at 9:28
  • There's something not right here. There are indeed 1 to 2 HW backed GPIO pins for PWM. Where they are on the Raspebrry Pi 3 is, however, fairly unknown. I've been looking for any documentation on this and found none to date. So which way is it?
    – not2qubit
    Apr 17 '16 at 6:57
  • @user1147688 I don't understand what you mean. The GPIO are the same on all Pis. The only difference is which are accessible from the expansion header. I show that in the above table. Pi3 is the same as Pi2 is the same as all Pis with a 40 pin expansion header.
    – joan
    Apr 17 '16 at 8:10
  • It could be that I've missed something, but I've googled for the RP3 header showing the designated HW PWMs and they're either not shown or only show one, when there should be 2. I simply do not believe the pictures people make and post. The HW part of GPIO is probably not exactly the same since the chip is not the same.
    – not2qubit
    Apr 17 '16 at 8:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.