testing leds

Hello,

I've got the nrf9160dk board, but the nrf91 isn't visible. I was told that it's dead, and I should try to play around, at least with the 52840.
I've tried to make an easy blinking program, but that's where I got stuck.

#include "nrf.h"
#include <stdio.h>
#include <zephyr/kernel.h>
#include <hal/nrf_gpio.h>

#define LED_PIN 0x05
#define LED_PIN2 0x07
#define LED_PIN3 0x01
#define LED_PIN4 0x03

#define MAPPED_LED NRF_GPIO_PIN_MAP( 0x01, LED_PIN3 )

int main(void)
{
    nrf_gpio_cfg_output( MAPPED_LED );

    while (1)
    {
        nrf_gpio_pin_set( MAPPED_LED );
        printf("ON ");
        k_msleep( 1000 );
        nrf_gpio_pin_clear( MAPPED_LED );
        printf("OFF ");
        k_msleep( 1000 );
    }
}

This code does nothing with the LED's. The debugger shows the pin is high, but the LED stays off.

#include "nrf.h"
#include <stdio.h>
#include <zephyr/kernel.h>
#include <hal/nrf_gpio.h>

#define LED_PIN 0x05
#define LED_PIN2 0x07
#define LED_PIN3 0x01
#define LED_PIN4 0x03

#define MAPPED_LED NRF_GPIO_PIN_MAP( 0x01, LED_PIN3 )

void delay(volatile uint32_t count) {
    while(count--) {
        __NOP();
    }
}

int main(void)
{
    nrf_gpio_cfg_output( MAPPED_LED );

    while (1)
    {
        nrf_gpio_pin_set( MAPPED_LED );
        printf("ON ");
        delay( 50 );
        nrf_gpio_pin_clear( MAPPED_LED );
        printf("OFF ");
        delay( 50 );
    }
}

This code makes LED shine. 

What am I doing wrong, or what am I missing out here?

Best regards.

Parents Reply Children
No Data
Related