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

Set Pin to high

Hello,

I want to set a GPIO Pin to high. Therefore I wrote the code below.

But when the software is written onto the nrf52811, I can not messure any voltage.

I do not want to use any library or external file for this.

//start of code

int main()
{

unsigned int base = 0x50000000; //base adress of GPIO
unsigned int out = 0x504; //offset
unsigned int outAdress = base + out;// adress of OUT Register

unsigned int write = 1; //set first Pin to high
unsigned int *point = outAdress; //Pointer on outAdress

*point = write; //set outAdress to 0000 0000 0000 0000 0000 0000 0000 0001

while(1)
{
    //do nothing
}
}

//end of code

Thank you for your help.

  • Hi,

    I am programming the ISP1907-LL with the Evalutation Board.

    I may found the problem:
    The "ble_app_uart_pca10040e_s112.hex" file, that comes with the SDK and works fine, is unequal to the file, which I get when I click on build in Segger Embedded Studio (wihtout changing code).

    Debugging from Segger Embedded Studio did also not work.

    Best regards
    Tobias

  • Hi Tobias

    Thanks for sharing the details on your board. 

    Your earlier code is trying to manipulate P0.00, but according to the ISP1907-LL documentation P0.00 is connected to the LF crystal, and can not be used as GPIO. 

    Only a subset of the available GPIO's on the part are brought out on the module, including P0.03, P0.04 and P0.05. 

    Are you able to try one of these pins instead and see if it works?

    A quick trick to manipulate P0.03 for instance is to write to the registers as such:

    // Setting P0.03 to output
    *((volatile int *)0x50000514) = (1 << 3);
    // Setting P0.03 high
    *((volatile int *)0x50000504) = (1 << 3);

    Best regards
    Torbjørn

  • Hi,

    I may found the problem:
    The "ble_app_uart_pca10040e_s112.hex" file, that comes with the SDK and works fine, is unequal to the file, which I get when I click on build in Segger Embedded Studio (wihtout changing code).

    Debugging from Segger Embedded Studio did also not work.

    Best regards
    Tobias

  • Hi Tobias

    To target the nRF52811 you should use the pca10056e project, not the pca10040e. 

    Most likely the reason the hex file is different is that the hex file stored in the project contains both the SoftDevice and the application, while the hex file you build only contains the application. If you program the project directly in Segger Embedded Studio this doesn't matter, since the SoftDevice will be flashed automatically in addition to the application hex. 

    Also, the ble_app_uart example uses the UART, which might be a problem on your board since it doesn't have anything connected to those pins. 

    Could you try the ble_app_eddystone example instead, and use the nRF Connect app for Android/iOS to see if you can see the advertising packets?

    Remember to use the pca10056e project, and try to program through the Segger interface. 

    Best regards
    Torbjørn

  • Hi Torbjørn,

    I could successfully set Pin 3 to HIGH. Thank you very much.

    I used a pca10056e project, not ble_app_eddystone due to this error: "cannot find ../../../../../../external/micro-ecc/nrf52nf_armgcc/armgcc/micro_ecc_lib_nrf52.a: No such file or directory". But another 10056e project file, without errors, worked fine.

    Best regards
    Tobias

Related