CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

Setting SPI of 18F2550 for nRF24L01+ full driver by Eduardo
Goto page Previous  1, 2, 3, 4  Next
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
PannetierJ



Joined: 18 Jun 2017
Posts: 31

View user's profile Send private message

PostPosted: Fri Jul 14, 2017 9:00 am     Reply with quote

Hy guys ,

I add a capacitor, directly on my module nrf24l01 ( 100 uF )
Same result.... Confused
Ttelmah



Joined: 11 Mar 2010
Posts: 19244

View user's profile Send private message

PostPosted: Fri Jul 14, 2017 1:06 pm     Reply with quote

What about all the other things I asked/raised?.
PannetierJ



Joined: 18 Jun 2017
Posts: 31

View user's profile Send private message

PostPosted: Fri Jul 14, 2017 1:33 pm     Reply with quote

I tested with external power supply.
No USB.
My RS232´s working correctly.
All power pins are connected.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Jul 14, 2017 2:25 pm     Reply with quote

Quote:
I have a power supply with USB -> regulator 3,3V.

I assume you get +5v from a USB connector. Is this from a laptop ?
Sometimes laptops shut off the USB power.

I think you should start experimenting. Get a real power supply.

Try increasing the power up delay. See if it helps. Add the line shown
in bold below to your receiver program. It has to be placed above the
#include statement for the nRF24L01.c driver. This will increase the delay
to 100 ms (it was 10 ms):
Quote:

#define RF24_PWUPDELAY() delay_ms(100) // *** FOR TESTING ***
#include <nRF24L01P.C>
Ttelmah



Joined: 11 Mar 2010
Posts: 19244

View user's profile Send private message

PostPosted: Fri Jul 14, 2017 2:41 pm     Reply with quote

He still has not answered that he is connecting all the PIC supply pins. It's common to have problems where people only connect one Vss or Vdd, and don't realise they are all needed.
PannetierJ



Joined: 18 Jun 2017
Posts: 31

View user's profile Send private message

PostPosted: Sat Jul 15, 2017 2:04 am     Reply with quote

Hello PCM programmer,

- I have a real power supply.
- I add
Quote:

#define RF24_PWUPDELAY() delay_ms(100) // *** FOR TESTING ***
#include <nRF24L01P.C>


-> Same result:
Config RX KO
Result: 2

- I tried with another module ... same result
Crying or Very sad
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sat Jul 15, 2017 4:55 pm     Reply with quote

Post a link to the website where you bought these nRF24L01 modules.
Or at least tell us the manufacturer.

Post any markings that are on the modules or the nRF24L01 chips.
Or post sharp, hi-res photos of both sides.
PannetierJ



Joined: 18 Jun 2017
Posts: 31

View user's profile Send private message

PostPosted: Sun Jul 16, 2017 2:27 am     Reply with quote

Hi,
I ordered on Amazon.
This modules are working perfectly between Arduino <-> Arduino.

This module look like it:

PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sun Jul 16, 2017 8:27 am     Reply with quote

Quote:
This modules are working perfectly between Arduino <-> Arduino.

So you also own two Arduino boards and have tested them working OK
with the nRF modules ?
That's significant information. I didn't know this before. I still had in
my mind the possibility that your nRF boards could be bad. But they
are good.

In that case, with these assumptions:
1. Eduardo's driver works.
2. We have fixed all problems with voltages, power supply current,
bypass capacitors, etc.

Then your problem must be:
1. Driver configuration.
or
2. Connections between the nRF boards and the PICs.

Regarding connections:
Do you know for a fact that the SPI communication is working ?
Have you ever written to an nRF register and then read back the same
byte correctly ? If not, such a test should be done. Write 0x55 and
read it back. Then test some other values.

Quote:
I ordered on Amazon.

There are many identical appearing nRF boards on Amazon. Can you
provide a link to the one that you ordered ?
PannetierJ



Joined: 18 Jun 2017
Posts: 31

View user's profile Send private message

PostPosted: Sun Jul 16, 2017 9:06 am     Reply with quote

Hi,

If I understand correctly your test, I must to write:

Code:

spi_write2(0x55);
Result = spi_read2(); // without parameter


Isn't it ?
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sun Jul 16, 2017 9:52 am     Reply with quote

That's not good enough.
1. You have to write to a specific register. You haven't specified the
register.
2. There is only one SPI module in the 18LF2550. So spi_read2() will
not work. There is no SPI #2 in the PIC. I hope you have not edited
the driver to use spi_read2().
3. spi_read() requires a parameter (usually = 0x00) to generate the
SPI clock. With no parameter, there is no clock and there is no SPI
read operation by the master.

I will try to write a suitable register test routine.
PannetierJ



Joined: 18 Jun 2017
Posts: 31

View user's profile Send private message

PostPosted: Sun Jul 16, 2017 10:15 am     Reply with quote

I checked, I don't use spi_read2() into the driver.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sun Jul 16, 2017 11:40 am     Reply with quote

Here is a register r/w test program. It uses your Transmitter board.
I used your PIC configuration and I followed the register r/w examples
in the nRF24L01.c driver file, so I think it should work.

I chose the SETUP_RETR register because all the bits are R/W.
Eduardo uses a very long name for it, SETUP_AUTORETRANSMISSION,
in his register enum, so I used that name too.
Code:

// Register r/w test for the Transmitter board

#include <18F2550.h>
#device = PASS_STRINGS=IN_RAM    //Admite ponteiros para constantes
#fuses HS,NOWDT,NOLVP,CPUDIV1
#use delay(clock=16000000)
#use rs232(baud=9600,xmit=PIN_C6,rcv=PIN_C7,ERRORS)

#define RF24_SPI_DISABLE_WARNING  //for disabling nRF24 SPI warning message.

#define Led_Send PIN_A3
#define Led_Init PIN_A4
//********** DEFINE PORT NAMES
#define  SPI_MISO       PIN_B0   //SPI(Usar por hardware quando possivel)
#define  SPI_MOSI       PIN_C7   //SPI(Usar por hardware quando possivel)
#define  SPI_CLK        PIN_B1   //SPI(Usar por hardware quando possivel)

//Driver nRF24L01P.C
#define  RF24_IRQ       PIN_B2   //interrupcao nRF24L01+
#define  RF24_CS        PIN_C1   //chipselect nRF24L01+
#define  RF24_CE        PIN_C2   //chipEnable nRF24L01+
#define  RF24_PERFORMANCE_MODE   //performance mode ON
#define  RF24_SPI       STREAM_SPI2//Redirects SPI2 port to RS24_SPI stream

#use SPI(MASTER,DI=SPI_MISO,DO=SPI_MOSI,CLK=SPI_CLK,BAUD=1000000,MODE=0,BITS=8,MSB_FIRST,STREAM=STREAM_SPI2)

#include <nRF24L01P.C>   

//==============================
void main()
{
int8 result;

printf("Start\n\r");
   
RF24_initPorts();

RF24_disable();     

RF24_comm(W_REGISTER|SETUP_AUTORETRANSMISSION, 0x55); // Write 0x55 to Retry reg
result = RF24_comm_in(R_REGISTER|SETUP_AUTORETRANSMISSION);  // Read it back
printf("Wrote: 0x55, Read: %x \n\r", result);   // Display it

RF24_comm(W_REGISTER|SETUP_AUTORETRANSMISSION, 0xAA); // Write 0xAA to Retry reg
result = RF24_comm_in(R_REGISTER|SETUP_AUTORETRANSMISSION);  // Read it back
printf("Wrote: 0xAA, Read: %x \n\r", result);   // Display it
printf("\n\rTest done \n\r");
 
while(TRUE);
PannetierJ



Joined: 18 Jun 2017
Posts: 31

View user's profile Send private message

PostPosted: Sun Jul 16, 2017 12:33 pm     Reply with quote

Hy ,

I tested :

Start :

Wrote : 0x55 Read : 00
Wrote : 0xAA Read : 00

Test done
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sun Jul 16, 2017 12:54 pm     Reply with quote

Can you post a list of connections between the PIC board and the
nRF24L01 module ?

Or better, take a photo of the connections, so that all the pins can be
seen on both boards, and the wires can be traced visually by looking at
the photo. Then post the photo.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page Previous  1, 2, 3, 4  Next
Page 2 of 4

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group