This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Developing with a nRFgo kit for the nRF24LE1 from Nordic

I am trying to develop a program using the nRFGo kit from Nordic Semiconductor. I built a simple example would turn off LEDs when I pressed a button on the board. I wanted to modify this code such that if I pressed a combination of buttons then a binary representation of the button pressed would be displayed with LEDs on the board. My code compile fine and I can get the code to download into the board but it does not appear to function at all like I intended.

Here is an excerpt from my main.c

//#include <Nordic\reg24le1.h>
#include "reg24le1_edit.h"
//#include "hal_nrf.h"
//#include "radio.h"
//#include "application.h"
#include "system.h"
#include "defines.h"





void main(void)
{
  mcu_init();


//  EA = 1;                               // Global interrupt enable
//  boot_mess();
/*
        LIGHT_0_LED();
        delay_10ms();
        LIGHT_1_LED();
        delay_10ms();

        LIGHT_2_LED();
        delay_10ms();
        LIGHT_3_LED();
        delay_10ms();
        LIGHT_4_LED();
        delay_10ms();

        LIGHT_5_LED();
        delay_10ms();
        LIGHT_6_LED();
        delay_10ms();
        LIGHT_7_LED();
        delay_10ms();
        LIGHT_8_LED();
        delay_10ms();
        LIGHT_9_LED();
        delay_10ms();
        LIGHT_10_LED();
        delay_10ms();
        LIGHT_11_LED();
        delay_10ms();
        LIGHT_12_LED();
        delay_10ms();
*/
        LIGHT_ALL_LED();
        /*
        while(1)
        {
                LIGHT_ALL_LED();
        }
        */
//      LIGHT_0_LED();


while(1)
{
        if((B0 == OFF) &&  (B2 == OFF))
        {
//              LED0 = OFF;
                LIGHT_1_LED();
        }
        if((B0 == OFF) &&  (B3 == OFF))
        {
//              LED0 = ON;                                              // turn on LED
                LIGHT_2_LED();
        }
        if((B0 == OFF) &&  (B7 == OFF))
        {
//              LED0 = ON;                                              // turn on LED
                LIGHT_3_LED();
        }

        if((B4 == OFF) &&  (B2 == OFF))
        {
//              LED0 = OFF;
                LIGHT_4_LED();
        }
        if((B4 == OFF) &&  (B3 == OFF))
        {
//              LED0 = ON;                                              // turn on LED
                LIGHT_5_LED();
        }
        if((B4 == OFF) &&  (B7 == OFF))
        {
//              LED0 = ON;                                              // turn on LED
                LIGHT_6_LED();
        }
        if((B5 == OFF) &&  (B2 == OFF))
        {
//              LED0 = OFF;
                LIGHT_7_LED();
        }
        if((B5 == OFF) &&  (B3 == OFF))
        {
//              LED0 = ON;                                              // turn on LED
                LIGHT_8_LED();
        }
        if((B5 == OFF) &&  (B7 == OFF))
        {
//              LED0 = ON;                                              // turn on LED
                LIGHT_9_LED();
        }

        if((B6 == OFF) &&  (B2 == OFF))
        {
//              LED0 = OFF;
                LIGHT_10_LED();
        }
        if((B6 == OFF) &&  (B3 == OFF))
        {
//              LED0 = ON;                                              // turn on LED
                LIGHT_11_LED();
        }
        if((B6 == OFF) &&  (B7 == OFF))
        {
//              LED0 = ON;                                              // turn on LED
                LIGHT_12_LED();
        }
        else                                  // Released B0 during "boot":
        {                                     // Enter PTX mode (Transmitter)
//    radio_init(TRANSMITTER);
//    transmitter_mode();
                LIGHT_0_LED();
        }
}
}

void LIGHT_ALL_LED(void)
{
        P13 = ON;          //LSb
        P12 = ON;
        P11 = ON;
        P06 = ON;
}

void LIGHT_0_LED(void)
{
        P13 = OFF;         //LSb
        P12 = OFF;
        P11 = OFF;
        P06 = OFF;
}

void LIGHT_1_LED(void)
{
        P13 = ON;          //LSb
        P12 = OFF;
        P11 = OFF;
        P06 = OFF;
}

void LIGHT_2_LED(void)
{
        P13 = OFF;              //LSb
        P12 = ON;
        P11 = OFF;
        P06 = OFF;
}

void LIGHT_3_LED(void)
{
        P13 = ON;                //LSb
        P12 = ON;
        P11 = OFF;
        P06 = OFF;
}

void LIGHT_4_LED(void)
{
        P13 = OFF;         //LSb
        P12 = OFF;
        P11 = ON;
        P06 = OFF;
}

void LIGHT_5_LED(void)
{
        P13 = ON;          //LSb
        P12 = OFF;
        P11 = ON;
        P06 = OFF;
}

void LIGHT_6_LED(void)
{
        P13 = OFF;              //LSb
        P12 = ON;
        P11 = ON;
        P06 = OFF;
}

void LIGHT_7_LED(void)
{
        P13 = ON;                //LSb
        P12 = ON;
        P11 = ON;
        P06 = OFF;
}

void LIGHT_8_LED(void)
{
        P13 = OFF;               //LSb
        P12 = OFF;
        P11 = OFF;
        P06 = ON;
}

void LIGHT_9_LED(void)
{
        P13 = ON;          //LSb
        P12 = OFF;
        P11 = OFF;
        P06 = ON;
}

void LIGHT_10_LED(void)
{
        P13 = OFF;         //LSb
        P12 = ON;
        P11 = OFF;
        P06 = ON;
}

void LIGHT_11_LED(void)
{
        P13 = ON;               //LSb
        P12 = ON;
        P11 = OFF;
        P06 = ON;
}

void LIGHT_12_LED(void)
{
        P13 = OFF;               //LSb
        P12 = OFF;
        P11 = ON;
        P06 = ON;
}

some defines

#define B0 P10
#define B2 P02
#define B3 P03
#define B4 P14
#define B5 P15
#define B6 P16
#define B7 P07


#define LED0 P06 #define LED1 P11 #define LED2 P12 #define LED3 P13
#define ON 1 #define OFF 0

mcu int function

void mcu_init(void)
{
  P0 = 0;                     // Port setup
  P0DIR = P0_SETUP;     //0xF0;   // P0.0 - P0.3 output LEDS
                              // P0.4 - P0.7 inputs BUTTONS
  P0CON = 0;
  P1 = 0;                     // Port setup
  P1DIR = P1_SETUP;
  P1CON = 0;
  RFCKEN = 1;                 // enable L01 clock
  RF = 1;                     // enable RF interrupt
}

I am trying to turn on one LED on PORT0 and 3 on PORT1, but only one of the LEDs will only light up when I download the code to the board. If I turn off power and turn it back on, none of the LEDs will come on.

Does anyone have any suggestions? Thanks for the help.

Parents
  • I can't see the definitions of P0_SETUP, P1_SETUP.

    By the way - your code can shrink a lot if you compute a number and then use the individual bits of that number to control the leds.

    LED0 on if (button_value & 1) != 0;
    LED1 on if (button_value & 2) != 0;
    LED2 on if (button_value & 4) != 0;
    LED3 on if (button_value & 8) != 0;
    

Reply
  • I can't see the definitions of P0_SETUP, P1_SETUP.

    By the way - your code can shrink a lot if you compute a number and then use the individual bits of that number to control the leds.

    LED0 on if (button_value & 1) != 0;
    LED1 on if (button_value & 2) != 0;
    LED2 on if (button_value & 4) != 0;
    LED3 on if (button_value & 8) != 0;
    

Children
  • Sorry I forgot that I did not add the P0_SETUP and P1_SETUP.

    #define P0_SETUP        0x8C            // P0.2, P0.3, P0.7 as inputs BUTTONS
    
    #define P1_SETUP        0x71            // P1.0, P1.4, P1.5, P1.6 inputs BUTTONS
    

    Do I need to be doing something different with P0CON and P1CON registers? Thanks for the code reduction suggestion. I will try it.

  • Does anyone have a schematic for the nRFGo Motherboard? I had a programming adapter built that has flying leads on one end and pogo pins on the other end that will get attached to test points on my prototype boards. I have attached my flying leads to what I assume are the appropriate header pins on the nRFGo Motherboard but when I try to program the board it fails.

    My Programming adapter supplies the following connections:
    FSCK
    PROG
    FMOSI
    FMISO
    FCSN
    VCC
    GND

    I took one of nRFGo Motherboards and pulled the LE1 board off and then took the wires for my programming adapter and connected them in the following manner: (I am trying to program the 32 pin part)
    P0.5 FSCK
    Pin 25 of Mod A PROG
    P0.7 FMOSI
    P1.0 FMISO
    P1.1 FCSN
    Pin 2 of Mod A VCC
    Gnd pin of one of the header strips GND

    Anyone have any thoughts or suggestions as to how I can program my prototype boards using the nRFGo Motherboards or any other manner? Thanks for the help.

    Josh Blackann

  • Errrm... how about Nordic Semiconductor, then?!

  • I have tried Nordic. Just thought I'd try the forum as well.

  • I figured out why I could not get the P1 port to work properly on the LE1. If using uVision to program the board, the correct device needs to be selected as well as making sure debugging is disabled.

    In uVision go to Flash -> Configure Flash Tools. Up pops an options menu, select Utilities tab.

    Make sure it says, nRFProbe Keil Driver. Click on Settings.

    Select device (mine is 32 pin device), and deselect Enable Debugging.

    Then compile the code, and flash the device. It works perfectly now.

    Now I need to figure out how to get the firmware off of the nRFGo motherboard and onto my prototype boards...

  • I should have read all of the documentation over again. I looked at nRFgo Starter Kit User's Guide V1.1 and found in section 2.1.10 the information that I needed for In circuit Programming. In this section there is detailed figure which shows the pin out for a ISP interface. I attached my pogo pin programming adapter to these pins and using nRFgo Studio, I was able to program my prototype board. I guess that proves that you need to reread all of the documentation a couple times to make sure you don't miss anything.