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

nRF51822 IO P0.01‘s Problem

HI:

    My IC: nRF51822QFAA             My SDK Project:  ...\nRF51_SDK_9.0.0_2e23562\examples\ble_peripheral\ble_app_template\pca10028\s110\arm5_no_packs

Appearance:

       When I Powerup or reset the device,  I can control the P0.01 , It's perfect..  But  30 minutes After Powerup, The Pin P0.01 is out of my control. 

       I try to reinitial the IO, But it is invalid,  I don't know why?

       And every time when I restart the device, it is very  punctual Atfer 30 minutes,  then the P0.01 is out of my control. 

 Problem: I can't Find out the problem. 

My Program:

      nrf_gpio_cfg_output(1);

     NRF_GPIO->OUTSET = (1<<1);

    NRF_GPIO->OUTCLR = (1<<1);

int main(void)
{
uint32_t err_code;

// Initialize.
timers_init();
IO_Initial();
ble_stack_init();

PStorage_Initial();
gap_params_init();
advertising_init();
services_init();
conn_params_init(); 

application_timers_start();

err_code = ble_advertising_start(BLE_ADV_MODE_FAST);
APP_ERROR_CHECK(err_code);

Initial_SPI_Master();
Initial_nRF24L01();

Start_LED_Timer(3);

// Enter main loop.
for (;;)
{
Battery_Sample_Function();

if(BLE_Rx_OK)
{
BLE_Rx_OK = false;
BLE_Rx_Function();
}

Multi_LED_Ctr_Function();

NFC_Coil_Active_Function();
RF_Order_Function();

power_manage();
}
}

    

  • Hi,

    That does sound strange. Could you elaborate for me, what do you mean when you say that it is out of your control - are you not able to toggle it after 30 minutes, or does it seemingly toggle on its own?
    I do not know the contents of your Multi_LED_Ctr_Function() but I am guessing it is supposed to toggle the LED in question?
    Do you have any other event happening around the 30 minute mark?

     I try to reinitial the IO, But it is invalid

    What do you mean by this, how are you reinitializing the IO, and how does it come back invalid?

    Perhaps you would consider sharing the entire source code, so that I may take a closer look.

          nrf_gpio_cfg_output(1);

         NRF_GPIO->OUTSET = (1<<1);

        NRF_GPIO->OUTCLR = (1<<1);

    I highly recommend that you avoid using magic numbers, and instead use the appropriate defines - it significantly increases readability and makes debugging easier in general.
    If you do not insist on changing the registers manually, I would also recommend that you check out the provided libraries for easier configuration and use.
    In your case, you could check out the nrf_gpio.h module, to see the provided GPIO configuration and usage functions.

    Best regards,
    Karl

     

     

  • Hi:

        Thank you for your reply. I have been find the problem.

        That's because I set the P0.01 into AIN Mode When I powerup the device in the "Battery_Sample_Function()" ;. So I lose to control the Pin of P0.01.

        Thank you very much

  • Hi,

    No problem at all, I am happy to help!
    I am glad we were able to resolve your issue.

    Let me know if you should encounter any more issues in the future.
    Best of luck with your development!

    Best regards,
    Karl

Related