The led is not blinking or turning on in nrf52840 dk board

Hi I am trying to do the led blinking in nrf52840 but the led is not even turning on i have given the code below can any body help me out.

nrf_gpio_cfg_output(14);

nrf_gpio_cfg_output(15);

nrf_gpio_cfg_output(16);
nrf_gpio_cfg_output(13);
while (true)
{

nrf_gpio_pin_clear(13);
nrf_gpio_pin_set(14);
nrf_gpio_pin_set(15);
nrf_gpio_pin_set(16);
printf("Ae\r\n");
nrf_delay_ms(100);

}

Parents
  • #include <stdbool.h>
    #include <stdint.h>
    #include <stdio.h>
    #include "app_uart.h"
    #include "app_error.h"
    #include "nrf_delay.h"
    #include "nrf_gpio.h"
    #include "nrf.h"
    #include "bsp.h"
    //#include "nrf_drv_adc.h"
    #include "nrf_drv_saadc.h"
    #include "nrf_drv_ppi.h"
    #include "nrf_drv_timer.h"
    
     
    
    
    #include "nrf_log.h"
    #include "nrf_log_ctrl.h"
    #include "nrf_log_default_backends.h"
    
    
    
    #if defined (UART_PRESENT)
    #include "nrf_uart.h"
    #endif
    #if defined (UARTE_PRESENT)
    #include "nrf_uarte.h"
    #endif
    
    
    //#define ENABLE_LOOPBACK_TEST  /**< if defined, then this example will be a loopback test, which means that TX should be connected to RX to get data loopback. */
    
    #define MAX_TEST_DATA_BYTES     (15U)                /**< max number of test bytes to be used for tx and rx. */
    #define UART_TX_BUF_SIZE 256                         /**< UART TX buffer size. */
    #define UART_RX_BUF_SIZE 256                         /**< UART RX buffer size. */
    
    void uart_error_handle(app_uart_evt_t * p_event)
    {
        if (p_event->evt_type == APP_UART_COMMUNICATION_ERROR)
        {
            APP_ERROR_HANDLER(p_event->data.error_communication);
        }
        else if (p_event->evt_type == APP_UART_FIFO_ERROR)
        {
            APP_ERROR_HANDLER(p_event->data.error_code);
        }
    }
    
    
    #ifdef ENABLE_LOOPBACK_TEST
    /* Use flow control in loopback test. */
    #define UART_HWFC APP_UART_FLOW_CONTROL_ENABLED
    
    /** @brief Function for setting the @ref ERROR_PIN high, and then enter an infinite loop.
     */
    static void show_error(void)
    {
    
        bsp_board_leds_on();
        while (true)
        {
            // Do nothing.
        }
    }
    
    
    /** @brief Function for testing UART loop back.
     *  @details Transmitts one character at a time to check if the data received from the loopback is same as the transmitted data.
     *  @note  @ref TX_PIN_NUMBER must be connected to @ref RX_PIN_NUMBER)
     */
    static void uart_loopback_test()
    {
        uint8_t * tx_data = (uint8_t *)("\r\nLOOPBACK_TEST\r\n");
        uint8_t   rx_data;
    
        // Start sending one byte and see if you get the same
        for (uint32_t i = 0; i < MAX_TEST_DATA_BYTES; i++)
        {
            uint32_t err_code;
            while (app_uart_put(tx_data[i]) != NRF_SUCCESS);
    
            nrf_delay_ms(10);
            err_code = app_uart_get(&rx_data);
    
            if ((rx_data != tx_data[i]) || (err_code != NRF_SUCCESS))
            {
                show_error();
            }
        }
        return;
    }
    #else
    /* When UART is used for communication with the host do not use flow control.*/
    #define UART_HWFC APP_UART_FLOW_CONTROL_DISABLED
    #endif
    
    
    /**
     * @brief Function for main application entry.
     */
     
     
    int main(void)
    {
        uint32_t err_code;
    
        bsp_board_init(BSP_INIT_LEDS);
    	  NRF_LOG_DEFAULT_BACKENDS_INIT();
    
        const app_uart_comm_params_t comm_params =
          {
              RX_PIN_NUMBER,
              TX_PIN_NUMBER,
              RTS_PIN_NUMBER,
              CTS_PIN_NUMBER,
              UART_HWFC,
              false,
    #if defined (UART_PRESENT)
              NRF_UART_BAUDRATE_115200
    #else
              NRF_UARTE_BAUDRATE_115200
    #endif
          };
    
        APP_UART_FIFO_INIT(&comm_params,
                             UART_RX_BUF_SIZE,
                             UART_TX_BUF_SIZE,
                             uart_error_handle,
                             APP_IRQ_PRIORITY_LOWEST,
                             err_code);
    
        APP_ERROR_CHECK(err_code);
    
    #ifndef ENABLE_LOOPBACK_TEST
        printf("\r\nUART example started.\r\n");
        
    		 
    		  nrf_gpio_cfg_output(13);
    			NRF_LOG_INFO("SAADC HAL simple example started.");
        while (true)
        {
    			 
    			nrf_gpio_pin_clear(13);
    			 
    			printf("Ae\r\n");
    			nrf_delay_ms(100);
           // uint8_t cr;
           // while (app_uart_get(&cr) != NRF_SUCCESS);
           // while (app_uart_put(cr) != NRF_SUCCESS);
    
            /*if (cr == 'q' || cr == 'Q')
            {
                printf(" \r\nExit!\r\n");
    
                while (true)
                {
                    // Do nothing.
                }
            }*/
        }
    #else
    
        // This part of the example is just for testing the loopback .
        while (true)
        {
            uart_loopback_test();
        }
    #endif
    }
    

    yes i tried with the blinky example i could not see the led blinking, and im sure that the controller has been flashed because im getting the printf function printing "AE" which im sending, i dont know where i am missing..

  • Nagaraj JP said:
    yes i tried with the blinky example i could not see the led blinking

    Then we need to debug this before we start debugging your application, since it may not be an application-logical issue.
    Where did you get your DK - was it a new kit, or did you get it from somebody else?
    In case of the latter, could you verify whether SolderBridge 5 - 8 is cut or not?

    Best regards,
    Karl

  • Where did you get your DK - was it a new kit,

    no this is an 6 months old board went for soldering service for the usb port and just now i recieved it.

    In case of the latter, could you verify whether SolderBridge 5 - 8 is cut or not?

    sorry i could not understand this.

  • Nagaraj JP said:
    no this is an 6 months old board went for soldering service for the usb port and just now i recieved it.

    Thank you for clarifying. Did somebody else use the board for a different project prior to this?

    Nagaraj JP said:
    sorry i could not understand this.

    Could you do a close visual inspection of the Solder Bridges 5, 6, 7, and 8 on the PCB, to see if they may be cut?
    They are marked SB5, SB6, SB7, and SB8 respectively. If they are cut then the LEDs will be disconnected from use.

    Best regards,
    Karl

  • Did somebody else use the board for a different project prior to this?

    yes it was used by our another person before that.

    They are marked SB5, SB6, SB7, and SB8 respectively. If they are cut then the LEDs will be disconnected from use.

    yes had a close look at the SB5 SB6 SB7 SB8 all the bridge are connected only, i have also checked with the multimeter it is showing connection. and now i checked with the p0.27 i can see the port pin working as per my commands as for now i am thinking to use this pin as the output. I think the u4 ic must have been damaged in my hardware. thankyou for the support..

  • Nagaraj JP said:
    yes had a close look at the SB5 SB6 SB7 SB8 all the bridge are connected only, i have also checked with the multimeter it is showing connection. and now i checked with the p0.27 i can see the port pin working as per my commands as for now i am thinking to use this pin as the output. I think the u4 ic must have been damaged in my hardware. thankyou for the support..

    I am not sure I understand what you mean here - the Solder bridges are intact, but the leds still does not work? Does the leds light up in any of the other examples, such as one of the BLE peripheral examples? The LED1 will be blinking when the device is advertising, and solid if it enters into a connection.

    Nagaraj JP said:
    I think the u4 ic must have been damaged in my hardware. thankyou for the support..

    No problem at all, I am happy to help!
    This is the part I do not understand from your comment. Do you suspect that the 4 LED pins have been damaged by the previous user of the board?

    Best regards,
    Karl

  • I am not sure I understand what you mean here - the Solder bridges are intact, but the leds still does not work? Does the leds light up in any of the other examples, such as one of the BLE peripheral examples? The LED1 will be blinking when the device is advertising, and solid if it enters into a connection.

    yes still the led is not working, i have also checked with the BLE examples also the results are same.

    Do you suspect that the 4 LED pins have been damaged by the previous user of the board?

    not exactly, we gave the board to the service people there they might have damaged the led section.

Reply
  • I am not sure I understand what you mean here - the Solder bridges are intact, but the leds still does not work? Does the leds light up in any of the other examples, such as one of the BLE peripheral examples? The LED1 will be blinking when the device is advertising, and solid if it enters into a connection.

    yes still the led is not working, i have also checked with the BLE examples also the results are same.

    Do you suspect that the 4 LED pins have been damaged by the previous user of the board?

    not exactly, we gave the board to the service people there they might have damaged the led section.

Children
  • Nagaraj JP said:
    yes still the led is not working, i have also checked with the BLE examples also the results are same.

    Then it does sound like the LEDs might have been damaged or otherwise disabled.
    Does everything else on the board function as expected?

    Nagaraj JP said:
    not exactly, we gave the board to the service people there they might have damaged the led section.

    It might be the case that the LEDs have been damaged indeed.
    Which service people were this, have you had the board worked on by a third-party?

    Best regards,
    Karl

Related