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

Unable to configure Port 1 as input.

Dear Team,

Greetings,

I am facing a problem for configuring Port 1 as input. I have connected a push button on P1.4 and an led on P0.0. I want to perform a simple task, i.e. when I press button then LED must turn on, else LED must be off. I have used NRF24LE1, 32 pin package.

#include "reg24le1.h"

void main()
{
	P0DIR = 0x00;  // set PORT0 as output
	P1DIR = 0xff;  // set PORT1 as input
	while(1)  // infinite loop
	{
		if (P1 == 0x10)     // check P1.4 is high
		{
			P0 = 0x01;
		}
		else
		{
			P0 = 0x00;
		}
	}
}

Parents Reply Children
  • Are you using Keil C51 (nrfprobe) as your programmer?

    If so, its explained in this application note (see pages 14/15) on how to clear the debug bit:

    https://infocenter.nordicsemi.com/pdf/nan_15.pdf?cp=15_6

     

    Kind regards,

    Håkon

  • I followed the steps mentioned in this PDF but still the same problem. Please can you send a C program which can perform this task? From yesterday I have tried may things. 

    It will be a great help for me.

    Thank you

    Nitesh

  • Can you share information about your setup? Are you using nrfprobe to program?

    Does other examples run as they should?

    Have you tried just toggling a GPIO in your main loop to see if that works?

     

    Kind regards,

    Håkon

  • I am writing the program using keil IDE. I have installed nrfprobe software in my pc, but I am not using it. I am generating .hex file and loading it to nrf24le1 chip using mpro programmer. I have also installed nrfsdk.

    Other examples such as enhanced_shockburst_ptx_nrf24le1 and enhanced_shockburst_prx_nrf24le1, gazell pair are working. 

    But, while I was trying to toggle individual PORTs (by writing it P0 = 0xff;) in my main loop, only P0.0 to P0.3 are working as they should and remaining bits are not getting high. If I write P1=0xff; then only P1.0 and P0.4-P0.7 are getting high. I think P0 should not work like this.

    Program to toggle P0:

    #include "reg24le1.h"  // I/O header file for NRF24LE1
    #include "hal_delay.h" // header file containing delay functions
    
    void main()
    {
    	P0DIR = 0x00; //output port
    	P0=0;       // set p0 initially as low
    	while(1)
    	{
    	    P0=0xff;         //set P0 high
    	    delay_ms(1000);
    	    P0=0x00;         // set P0 low
    	    delay_ms(1000);
    	}
    	

    Program to toggle P1:

    #include "reg24le1.h"  // I/O header file for NRF24LE1
    #include "hal_delay.h" // header file containing delay functions
    
    void main()
    {
    	P1DIR = 0x00; //output port
    	P1=0x00;
    	while(1)
    	{
    	    P1=0xff;
    	    delay_ms(1000);
    	    P1=0x00;
    	    delay_ms(1000);
    	}
    }

  • Hi,

     

    Is the nRF24LE1 device in "flash mode" (PROG pin high), or something like this (see chapter 6.3.5 in the nRF24LE1 ps for the pins the FSPI uses) ? Is your programmer properly disconnected, and the nRF power cycled after you test this?

    I haven't used that programmer, so I do not have any knowledge on how it works. Do you have a nRFGo motherboard available to program with to see if the behavior is the same here?

      

    Nitesh Dubey said:
    then only P1.0 and P0.4-P0.7

     Do you mean P1.4-P1.7? Note that the nRF24LE1 QFN32 doesn't have P1.7 (it goes up to P1.6)

     

    Kind regards,

    Håkon

Related