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
  • 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

  • After programming the nRF24LE1, I use to disconnect the programmer. Therefore, there is no chance to get PROG pin high.

    I don't have nRFGo motherboard available. It's requested that please send a code which is working on nRFGo motherboard.

    I also want to inform that there is no confusion related to P1.0 and P0.4 - P0.7 as mentioned in previous answer.

  • Hi,

     

    Nitesh Dubey said:
    I also want to inform that there is no confusion related to P1.0 and P0.4 - P0.7 as mentioned in previous answer.

    Thank you for confirming this.

    It seems that your infopage is corrupted, which makes the pin crossbar go haywire. This will happen if the programmer does not read out the infopage properly before issuing an ERASEALL command. Please see this thread for more information: https://devzone.nordicsemi.com/f/nordic-q-a/20/how-to-solve-the-error-infopage-is-corrupted

    We do have a setting in nrfgo studio that restores the infopage, but this is only available using the nRFgo motherboard. Do you have more than one nRF24LE1 module to develop on?

     

    Kind regards,

    Håkon

  • I have more than one nRF24LE1 module to develop. But I don't have nRFgo Motherboard. Is there any other method to do it? 

    I'll again request that please send a code to perform the same task. It will make me sure that there is the problem with my hardware.

    Thanks and regards,

    Nitesh

Related