SparkFun Forums 

Where electronics enthusiasts find answers.

All things pertaining to wireless and RF links
By Sparkles
#98680
Hello,

I have purchased 2 nRF24L01+ boards.

http://www.sparkfun.com/commerce/produc ... cts_id=705

I want to solder them but have a question:

I want to solder the headers, but on what side should the "long legs" of the headers be? On the electronic part side or the other side with "Sparkfun.com"? Or does this not matter?

The thing is, if I put the long legs of the headers on the "Sparkfun.com" side, the antenna sits great on my breadboard but this is also the side with the fragile connection lines!! And I don't want to break them!!.

If I solder it the other way around (long side of the headers on the electronics side), the nrf24L01 board + headers do not fit very good into my breadboard!!

Please look at the pictures, I hope this will make it more clear

Thanks in advance.
You do not have the required permissions to view the files attached to this post.
User avatar
By leon_heller
#98686
I put the connector through from the non-component side, so that the components face upwards when the module is plugged into my PCB with the PIC controller.
By Sparkles
#98691
Hey Leon,

Thanks for your reply. Ive soldered the boards like you told me. Is there a way to test the boards individually to check if the connections are right?

Thanks in advance.
User avatar
By leon_heller
#98695
I wrote a simple test program in C18 for the PIC18F4520 I used to check that I could write data to the chip via SPI, and read it back. Here it is:
Code: Select all
/*
** test.c
** SPI test program for PIC18F4520 and nRF24L01 or nRF24L01+
** Checks SPI comms between PIC and wireless chip
** 
** RA0	LED (output)
** RA1	PB (input)
*/

#include <p18f4520.h>
#include <spi.h>

//function prototypes
unsigned char spi_Send_Read(unsigned char);
void dly(void);

// Defines
#define SPI_SCK		LATCbits.LATC3		// Clock pin, PORTC pin 3 
#define SPI_SO		LATCbits.LATC5		// Serial output pin, PORTC pin 5 
#define SPI_SI		PORTCbits.RC4		// Serial input pin, PORTC pin 4 
#define SPI_CSN		LATCbits.LATC2		// CSN output pin, PORTC pin 2
#define SPI_CE		LATCbits.LATC1		// CE output pin, PORTC pin 1
#define SPI_IRQ		PORTBbits.RB0		// IRQ input pin, PORTB pin 0
#define SPI_SCALE	4              		// postscaling of signal 
#define LED			LATAbits.LATA0
#define PB			PORTAbits.RA1


// Macros
#define nop() _asm nop _endasm

void main(void)
{
	unsigned char status = 0;
	unsigned char data[5];
	int i;

	// run internal oscillator at 8 MHz
	OSCCON = OSCCON | 0b01110000;
	while (!OSCCONbits.IOFS)	// wait for IOFS to go high
		;

	OpenSPI(SPI_FOSC_16, MODE_00, SMPMID); //open SPI1
	PORTA = 0x00;
	ADCON1 = 0x0F;		// set up PORTA to be digital I/Os
	TRISA = 0x02;		// PORTA<7.2,0> outputs PORTA<1> input
	TRISCbits.TRISC3 = 0;	// SDO output
	TRISCbits.TRISC5 = 0;   // SCK output
	TRISCbits.TRISC2 = 0;	// CSN output
	TRISCbits.TRISC1 = 0;	// CE output
	SPI_CSN = 1;		// CSN high
	SPI_SCK = 0;		// SCK low
	SPI_CE	= 0;		// CE low
	nop();

	//write TX_ADDRESS register
	SPI_CSN = 0;			//CSN low
	spi_Send_Read(0x30);
	spi_Send_Read(0x11);
	spi_Send_Read(0x22);
	spi_Send_Read(0x33);
	spi_Send_Read(0x44);
	spi_Send_Read(0x55);
	SPI_CSN = 1;			//CSN high


	//read TX_ADDRESS register
	//Check that values are correct using the MPLAB debugger
	SPI_CSN = 0;			//CSN low
	status = spi_Send_Read(0x10);
	data[0] = spi_Send_Read(0x00);	// 0x11
	data[1] = spi_Send_Read(0x00);	// 0x22
	data[2] = spi_Send_Read(0x00);	// 0x33
	data[3] = spi_Send_Read(0x00);	// 0x44
	data[4] = spi_Send_Read(0x00);	// 0x55
	SPI_CSN = 1;					// CSN high

	while (1)
		;
}


unsigned char spi_Send_Read(unsigned char byte)
{
	SSPBUF = byte;	
	while(!DataRdySPI())
		;	
	return SSPBUF;
}


By Sparkles
#98706
Thanks for the code. I use Arduino, so I'll have to do some re-writing (with my poor skills......). Do I really need the IRQ for this procedure? I have it disconnected at the moment.

BTW:

This is the Arduino code I use to test the modules:

Article: http://www.mrroot.net/2009/10/wireless-is-go/
Code: http://www.mrroot.net/wp-content/upload ... 1/Mirf.zip

When I run the ping_client on my ArduinoA is starts sending, but thee ping_server does not respond on ArduinoB. I have both Arduino's connected to different PC's. I've exchanges module A and module B and the ArduinoA (with the other module starts sending, but ArduinoB does not respond....)

Thanks in advance,

J