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

Parents
  • 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?

Reply
  • 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?

Children
  • 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?

  • I have upload the video to youtube. Please try this one, thanks a lot!

    www.youtube.com/watch?v=Qw8N2xWOhSE

    Yes , i can running the code. and find nothing excepion.

  • Hi,

    If you can write the information here in text that would be good, but looking at the video, it looks like it would be difficult to measure at the wrong point. I notice that you have an overlay file though. While I did not spot any issue when glancing at the video, the example works on the DK with toggling the P0.18 without any changes except the single line that you described in the initial post. So I reocmend you pelase revert all changes and test exactly that one, which I verified works on my end. If that does not work, perhaps you need to look at the soldering on your board. Could it be that you have been unlucky and that the pin is not soldered to the PCB so that there is no actual connection?

Related