Tutorial 1 nrf24lo1

Discussion about wireless devices

Tutorial 1 nrf24lo1

Postby cdosrun » Sat Sep 13, 2008 9:17 pm

Hi im trying todo tutorial 1 from the diy homepage and i ran into a little problem. I cant seem to get the serial communications up and running. Im using the PIC P40 board from olimex and the pic 18F452 As well as MPLABv8.10 with the PIC-ICD2-POCKET programmer. After connecting the RX pin from the max232 to the TX(pin25) and the TX pin from the max232 to the RX(pin26) on the Pic and soldered all of the lines from the nrf24L01 (Transceiver nRF24L01 Module with RP-SMA from spark to be exact...) I cant seem to get anything to come out of the serial line not even the question marks. The onboard led however does seem to light up and stay on so im going to assume the program is on there and running. I was able to turn off the led in the begginning part of the code to confirm that main was running but when i tried to shutoff the led inside the while(DataRdyUSART()) loop and nothing happened.

Also I am using the default crystal that came with board so im not sure what changes i need to make as i am new to electronics. Is there any diagnostics that i could run?
Any help is much appreciated....

Just as an update I was able to break down the code to get something to come out to HyperTerminal but it is just garbage...(also This garbage is just from a printf statement in a loop with a delay I disabled the wireless code and am just trying to use the printf funcion to get the serial working...) Any Ideas...? Also can I run the wireless board on a 5V rail..? I read the tutorial and one part says 3.3 and the other says 5v.
cdosrun
 
Posts: 41
Joined: Sat Sep 13, 2008 8:59 pm

Re: Tutorial 1 nrf24lo1

Postby brennen » Sun Sep 14, 2008 4:32 pm

You have to make sure that you don't have the oscillator set to HS-PLL in your code (set it to HS). The number of delay calls will need to be halved in delays.c (since you're running at a clock speed of 20 MHz instead of 40 MHz). The calculation for the UART baud rate can be found in Example 16-1 in the 18F452 datasheet (in your case, doing the calculation would result in you using 32 instead of 64 as the last argument in the call to OpenUSART()).
brennen
Site Admin
 
Posts: 395
Joined: Sun Aug 17, 2008 2:15 pm

Re: Tutorial 1 nrf24lo1

Postby cdosrun » Sun Sep 14, 2008 4:48 pm

When I change the configuration bits to use HS instead of HS-PLL nothing happens...I dont see anything on the serial line and the led quits...Is there some other change that I need to make?
cdosrun
 
Posts: 41
Joined: Sat Sep 13, 2008 8:59 pm

Re: Tutorial 1 nrf24lo1

Postby brennen » Mon Sep 15, 2008 12:01 pm

It sounds like you soldered the chip up properly. My suggestion is to change your main() function to the one below just to test if you're receiving characters over RS232 properly. The code will send back any characters received over RS232 and then toggle the LED.

Code: Select all
void main(void)
{
   unsigned char data; //register to hold letter sent and received
   unsigned int count; //counter for for loop
   
   Initialize(); //initialize IO, UART, SPI, set up nRF24L01 as TX

   while(1)
   {
      CheckErrorsUSART();
       
      //check UART status register to see if data has been received.  if so, process
      while(DataRdyUSART())
      {
         data = ReadUSART(); //get data from UART
         printf("%c", data); //print the received data
         ToggleLED(); //toggle the on-board LED as visual indication that the loop has completed
      }
   }
}


If you can get this working, then your problem is obviously something going on with your connections to your 24L01 (or maybe the 24L01 itself).
brennen
Site Admin
 
Posts: 395
Joined: Sun Aug 17, 2008 2:15 pm

Re: Tutorial 1 nrf24lo1

Postby cdosrun » Mon Sep 15, 2008 3:08 pm

LOL...Thats exactly what i did...For the mean time I have disconnected the Wireless card from the board just to see if i could get the P40 board to output characters on the serial line. If I change the configuratin bits to just HS then nothing happens but if i leave it on HS-PLL it runs. Im still not sure why Im getting the wierd characters coming out of the serial line...Im guessing it has something todo with a timing issue...In the mean time I will order ther 10Mhz oscillators to see if that fixes things...If it does then it was most likely a timing issue. Also Is it ok to run the wireless cards on the 5V rails on the P40 board...???
cdosrun
 
Posts: 41
Joined: Sat Sep 13, 2008 8:59 pm

Re: Tutorial 1 nrf24lo1

Postby brennen » Mon Sep 15, 2008 3:31 pm

cdosrun wrote:If I change the configuratin bits to just HS then nothing happens but if i leave it on HS-PLL it runs.

The crazy thing here is that if you're running the PLL with a 20 MHz clock, you're running the PIC at 80 MHz! :twisted: I really have no idea why HS wouldn't work. Does it not even light up the LED?

cdosrun wrote:Also Is it ok to run the wireless cards on the 5V rails on the P40 board

Assuming you're using the Sparkfun 24L01 modules, they have an on-board voltage regulator that will take the 5V down to 3.3V, so it's safe. The 24L01's I/O pins are also 5V-tolerant, so you don't have to have a level converter.
brennen
Site Admin
 
Posts: 395
Joined: Sun Aug 17, 2008 2:15 pm

Re: Tutorial 1 nrf24lo1

Postby cdosrun » Tue Sep 16, 2008 1:33 am

I got the serial working..! no Idea why the HS setting wouldnt work... After I programmed it I just unplugged the board and plugged it back in and it worked! I guess the HS setting is now working I know I tried hitting the reset button a few times and nothing happened...I might have to do some digging to figure out just what happened...Thanks for the help...I will try to finish out the tutorial.
cdosrun
 
Posts: 41
Joined: Sat Sep 13, 2008 8:59 pm

Re: Tutorial 1 nrf24lo1

Postby brennen » Tue Sep 16, 2008 12:06 pm

One thing to keep in mind is that if you have low-voltage programming enabled in your config bits, you need a pull-down resistor to the PGM pin. Without it, I found my 18F452 would work very unreliably.
brennen
Site Admin
 
Posts: 395
Joined: Sun Aug 17, 2008 2:15 pm

Re: Tutorial 1 nrf24lo1

Postby WesleyJames » Tue Sep 24, 2013 11:05 am

cdosrun wrote:Hi im trying todo tutorial 1 from the diy homepage and i ran into a little problem. I cant seem to get the serial communications up and running. Im using the PIC P40 board from olimex and the pic 18F452 As well as MPLABv8.10 with the PIC-ICD2-POCKET programmer. After connecting the RX pin from the max232 to the TX(pin25) and the TX pin from the max232 to the RX(pin26) on the Pic and soldered all of the lines from the nrf24L01 (Transceiver nRF24L01 Module with RP-SMA from spark to be exact...) I cant seem to get anything to come out of the serial line not even the question marks. The onboard led however does seem to led lighting up and stay on so im going to assume the program is on there and running. I was able to turn off the led in the begginning part of the code to confirm that main was running but when i tried to shutoff the led inside the while(DataRdyUSART()) loop and nothing happened.

Also I am using the default crystal that came with board so im not sure what changes i need to make as i am new to electronics. Is there any diagnostics that i could run?
Any help is much appreciated....

Just as an update I was able to break down the code to get something to come out to HyperTerminal but it is just garbage...(also This garbage is just from a printf statement in a loop with a delay I disabled the wireless code and am just trying to use the printf funcion to get the serial working...) Any Ideas...? Also can I run the wireless board on a 5V rail..? I read the tutorial and one part says 3.3 and the other says 5v
.

hello friend were you able to sort out the little problem? I am facing similar issue.. Yes thread is old but if you can provide me some solution it will really help me out..
WesleyJames
 
Posts: 1
Joined: Tue Sep 24, 2013 7:14 am


Return to Wireless

Who is online

Users browsing this forum: No registered users and 3 guests

cron