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

Outputting a PWM signal and it's inverse thru gpio pins

Hello,

I have two questions:

How do I access the gpio pins of nrf52840 dk? what example program from nrf5 sdk can I use as example?

Is there a simpler example program to output a pwm signal of example like 400kHz and it's inverse in the pins?I'm looking at the PWM driver example of nrf5 sdk and it's a really big leap for someone like me who's use to programming via Arduino IDE

  • Hello,

    refer_pin said:
    So what pins should I use for PWM output?

    Please choose pints according to the Pin Assignment section of the nRF52840 Product Specification.
    The important part here is to check that you are not sending a high frequency signal on pins that are located close to the radio peripheral.

    Furthermore, you should also always check the Connector Interface diagram of the nRF52840 DK specification, since this will tell you which pins the DK is already using for different functionality.
    If you should need any of these pins you will have to follow the Solder Bridge documentation in order to make them available ( and thus disconnect the current functionality ).

    refer_pin said:
    I'm actually planning to push my code to an Adafruit nRF52840 Feather Board.

    I have never worked with this Adafruit module myself, but the nRF52840 SoC will still be the same - so you will just need to make sure that your program matches the pinout indicated on their board schematics. I.e if they expect UART TX to be on pin 0.06 then you should make sure this is the case in your program as well, etc.

    refer_pin said:
    what pins are suitable for producing a PWM of 400kHz? 

    Please see the Pin assignment referenced above to determine this.
    Please do not hesitate to let me know if anything should be unclear.

    Best regards,
    Karl

  • Please see the Pin assignment referenced above to determine this.

    So I looked into the Pin Assignment and Connector Interface link you sent me which is a good addition of documents to look into going forward, thanks for this. The pin that I believe would be possible to output the 400kHz PWM are P0.26 and P0.27, can you tell me if my analysis is correct or otherwise?

  • refer_pin said:
    So I looked into the Pin Assignment and Connector Interface link you sent me which is a good addition of documents to look into going forward, thanks for this.

    I am happy to hear that you found these documents useful!
    Whenever you need more pins in the future, this is exactly how you should go about choosing them.

    refer_pin said:
    The pin that I believe would be possible to output the 400kHz PWM are P0.26 and P0.27, can you tell me if my analysis is correct or otherwise?

    Yes, your analysis here is correct - you may very well use P0.26 & P0.27 for your 400 kHz outputs, no problem.
    Keep in mind that I have not checked whether P0.26 and P0.27 are already used for anything on the Feather Board you intend to use later. You should also check this, to see if these pins will be available to you when you change module as well.

    Best regards,
    Karl

Related