How to control the GPIO P0.18 to output High and low with nrf52832?

background:

1: my board  is the same with the nRF52832-CIAA Reference Layout 1_0 from nordic docs.

2: the source code is from sample code: blinky_led

3: only change the led0 to led1

#define LED0_NODE DT_ALIAS(led0)
to
#define LED0_NODE DT_ALIAS(led1)

My question is that:

1: seems that the output reg is right (at least the reg value can be change with my control), but  the measured voltage is always 3.3V with multimeter.

2: whether below reg value can show all info about gpio P0.18 ?

the reg value is below when control high.

CNF[18] = 0X00000003

OUT = 0X00040060  // Here changed, bit 18 to 1

IN = 0X002001C0

DIR = 0X00040060

LATVCH = 0X0

DETECTMODE = 0X0

the reg value is below when control LOW.

CNF[18] = 0X00000003

OUT = 0X00000060   // Here changed,bit 18 to 0

IN = 0X002001C0

DIR = 0X00040060

LATVCH = 0X0

DETECTMODE = 0X0

  • Hi,

    2: the source code is from sample code: blinky_led

    I am unable to find this sample. Can you specify which SDK version you are using and the path to the sample?

    1: seems that the output reg is right (at least the reg value can be change with my control), but  the measured voltage is always 3.3V with multimeter.

    If the pin is configured as an output and the output register indicate it is high, that should be reflected on the pin. How are you measuring it? Could there be an issue on the HW? Can you share details on your HW and how you measure?

  • Thanks for your reply.

    1:Sorry, the sample code name should be blinky,the path is ..\ncs\v2.7.0\zephyr\samples\basic\blinky

    2: The HW board is just from nRF52832-CIAA Reference Layout 1_0 from nordic docs. 

    3:  I just simple measure with VICTOR VC890D to mesure the voltage between P0.18 and GND.

    I dont know how to attach files here.

    So you mean all reg(CNF, OUT, IN, DIR, LATCH, DETECTMODE) related are list here. and no error obviously?

  • Hi,

    I see. Using the blinky sample, just changing from #define LED0_NODE DT_ALIAS(led0) to #define LED0_NODE DT_ALIAS(led1) is enough to ue P0.18 instead if you are building for the nRF52 DK as target board.

    Can you show how you build, sot hat I see which board you build for and verifyt hat you have nod modified the board fiels or added an overlay file (so that we know that led1 actually poitns to P0.18)? If that is OK, the next is to look at your hardware. Is there an issu ethere so that the poitn you are measuring on is not actually connected to P0.18?

  • 1: Could you tell me whether can attach files directly here?

    2: I upload some files in my qq zone, could you access these? 

    URL: https://user.qzone.qq.com/403417724/infocenter

    PCB is my self-define board( Just from the official  pcb file of chip package for Altium Designer tool) not  official nRF52 DK board.

    -> sch: my sch picutre

    -> pcb: my board pcb layout picture

    -> reg_P0.18_high is the debug screen-shot when set P0.18 to high in vscode

    -> reg_P0.18_low is the debug screen-shot when set P0.18 to low in vscode

    3: all GPIO are floatting

    4: no overlay files.

    5: prj.conf are below:

    CONFIG_GPIO=y
    CONFIG_SERIAL=y
    CONFIG_CONSOLE=y
    CONFIG_UART_CONSOLE=y
    CONFIG_PRINTK=y
  • Hi,

    1: Could you tell me whether can attach files directly here?

    You can either drag-and-drop the file right into the box where you are writing the reply, or you can use Insert -> Image/video/file.

    2: I upload some files in my qq zone, could you access these? 

    No, I am not ble to access it.

    PCB is my self-define board( Just from the official  pcb file of chip package for Altium Designer tool) not  official nRF52 DK board.

    Then we need to look at your board and verity that you are actually measuring on something that is physically connected to P0.18.

    How are you building the project? Are you building for nrf52dk_nrf52832 or another target?

    From what I see in the initial post you have been able to debug so that you know that the application is running, is that correct?

Related