• AVR Freaks

Helpful ReplyHot!PIC16f877A + NRF24L01 Communication

Author
gulbasm
New Member
  • Total Posts : 1
  • Reward points : 0
  • Joined: 2019/05/03 01:11:05
  • Location: 0
  • Status: offline
2019/05/14 02:36:20 (permalink)
0

PIC16f877A + NRF24L01 Communication

Hello everybody,
 
I looked lots of forums and related website but I didn't find a library for PIC16F877A and NRF24L01 which is written XC8 format. How can I find the code of NRF24L01 for PIC16F877a or how can I write the library? 
#1
katela
Super Member
  • Total Posts : 1808
  • Reward points : 0
  • Joined: 2013/06/11 05:25:18
  • Location: South Africa
  • Status: offline
Re: PIC16f877A + NRF24L01 Communication 2019/05/14 10:25:37 (permalink)
0
Unfortunately XC8 is not like the Arduino software with libraries for almost all modules.
To write your own library you will need o study the NRF24L01 datasheet and your PIC16F877A serial communication datasheet section. I think the NRF24L01 communicates with serial SPI.

Free online Microcontroller Tutorials and Projects for Hobbyists and students. From beginners to advanced. Website: www.studentcompanion.co.za
YouTube Tutorials: https://www.youtube.com/StudentCompanionSA
#2
qhb
Superb Member
  • Total Posts : 9999
  • Reward points : 0
  • Joined: 2016/06/05 14:55:32
  • Location: One step ahead...
  • Status: offline
Re: PIC16f877A + NRF24L01 Communication 2019/05/14 13:20:23 (permalink)
0
And you would make life a lot easier for yourself if you moved to a modern PIC16F part.
The PIC16F877A is almost pension age now...
 

Nearly there...
#3
DeutscheN
Super Member
  • Total Posts : 122
  • Reward points : 0
  • Joined: 2010/09/01 12:35:40
  • Location: DM43BH
  • Status: offline
Re: PIC16f877A + NRF24L01 Communication 2019/05/15 11:07:31 (permalink)
+1 (1)
 
As qhb mentioned, you may want to look at some newer devices, like the PIC16F18877.
 
https://www.microchip.com/wwwproducts/en/PIC16F18877
 
 
Also Mikroelectronica provides a mikroclick with the NRF device.  On its page you can download some sample PIC code that may be useful so you can see how to talk to the NRF:
 
https://libstock.mikroe.com/projects/view/470/nrf-t-click-example
 
 
#4
MJordan
Starting Member
  • Total Posts : 48
  • Reward points : 0
  • Joined: 2016/02/17 18:09:49
  • Location: 0
  • Status: offline
Re: PIC16f877A + NRF24L01 Communication 2020/05/23 19:37:02 (permalink)
0
I have spent days trying to get nrf2401L module to work with a PIC16F18323. Initially, I just want to confirm my communication to the module, but I can't find any simple examples to follow. I would appreciate it if someone would share some simple lines of code that I can put into Main() just to read one of the nrf2401L's registers (for example register: RF_CH). I would expect to receive the registers default value: 0x02 as a result.
I believe SPI is working correctly at 1Mhz and that CSN, CE, IRQ, SCK, SDO, SDI are all correctly set up.
 
I am hoping that a simple example of reading a register will help clarify some things for me. This is what I have so far. It's not right, but should show what I am thinking...
 
main(){
CSN_SetHigh();
CE_SetLow();
SSPEN = 0;
SPI1_WriteByte(0x05);
CSN_SetLow();
CE_SetHigh();
SSPEN = 1;
__delay_us(10);
result = SPI1_ReadByte();
CE_SetLow();
}
 
Any help would be greatly appreciated!
#5
XorLor
Junior Member
  • Total Posts : 56
  • Reward points : 0
  • Joined: 2009/10/23 00:17:05
  • Location: 0
  • Status: offline
Re: PIC16f877A + NRF24L01 Communication 2020/05/24 12:18:10 (permalink) ☄ Helpfulby MJordan 2020/05/24 17:11:44
+2 (2)
You need to configure the NRF24L01 registers to set the address, address width, CRC, data rate, RF frequency, transmit or receive mode, etc.
 
Here is an example for setting up transmit mode:
 

NRF_CE_SetHigh();              // TX mode
NRF_CSN_SetLow();
SPI_X(0x20);                   // Address 0x00:
SPI_X(0x7C);                   // PTX, CRC (2-byte) enabled, 0x7C: transmit mode (no interrupts)
NRF_CSN_SetHigh();
NRF_CSN_SetLow();
SPI_X(0x21);                   // Address 0x01:
SPI_X(0x00);                   // disable auto-ack for all channels
NRF_CSN_SetHigh();
NRF_CSN_SetLow();
SPI_X(0x23);                  // Address 0x03:
SPI_X(0x02);                  // address width = 4 bytes
NRF_CSN_SetHigh();
NRF_CSN_SetLow();
SPI_X(0x24);                  // Address 0x04:
SPI_X(0x00);                  // ARC = 0
NRF_CSN_SetHigh();
NRF_CSN_SetLow();
SPI_X(0x25);                 // Address 0x05:
SPI_X(RFID3);                // set RF frequency
NRF_CSN_SetHigh();
NRF_CSN_SetLow();
SPI_X(0x26);                 // Address 0x06:
SPI_X(0x26);                 // data rate = 250kbps, 0dBm
NRF_CSN_SetHigh();
NRF_CSN_SetLow();
SPI_X(0x30);                 // Address 0x10: set RF TX address ID
SPI_X(RFID0);
SPI_X(RFID1);
SPI_X(RFID2);
SPI_X(RFID3);
NRF_CSN_SetHigh();
NRF_CSN_SetLow();
SPI_X(0x31);               // Address 0x11: 8 byte payload
SPI_X(0x08);
NRF_CSN_SetHigh();
NRF_CSN_SetLow();
SPI_X(0xE1);                 // flush TX
NRF_CSN_SetHigh();
NRF_CSN_SetLow();
SPI_X(0x20);                 //PWR_UP = 1
SPI_X(0x7E);                 // 0x3F: receive, 0x7E: transmit (no interrupts)
NRF_CSN_SetHigh();      // active low SPI enable

 
Transmit some data:
 

NRF_CSN_SetLow();
SPI_X(0xA0);              // send tx payload
SPI_X(data_array[0]); // data
SPI_X(data_array[1]); // data
SPI_X(data_array[2]); // data
SPI_X(data_array[3]); // data
SPI_X(data_array[4]); // data
SPI_X(data_array[5]); // data
SPI_X(data_array[6]); // data
SPI_X(data_array[7]); // data
NRF_CSN_SetHigh();

#6
MJordan
Starting Member
  • Total Posts : 48
  • Reward points : 0
  • Joined: 2016/02/17 18:09:49
  • Location: 0
  • Status: offline
Re: PIC16f877A + NRF24L01 Communication 2020/05/24 19:11:36 (permalink)
0
Thanks so much! I went through it line by line and "over commented" it just to make sure I understood everything. Would you skim through it and confirm I understand what you wrote? I had one question near the end.
I have a couple of general questions:
MCC XC8 generates a routine called "SPI1_WriteByte". Is this is equivalent to your "SPI_X"?
Given the code supplied. It looks like I need to set SCK1=250Khz? (which would be perfect). It looks like the nRF24 default is 2Mhz. Does that mean I have to set SPI to 2Mhz to make the Configuration Settings or (I assume) is 2Mhz just the default for actual Tx/Rx transmission?
RFIDx - any user defined 4-byte address? something like: 0xFF, 0xFF, 0xFF, 0xFF would do?
If I need the receiver on all the time do you know if I can safely pull CS High in hardware?
Also, at the end of the code, I added a few lines to read a value from the nRF24 register table. I want to confirm that I really have a connection to the nRF24 and reading a "non-default" Config value back seems like a good way (I would put a break point at end to check value) or is there a better way to "diagnose" the nRF24 operational status (I think I fried one of mine)?
 
NRF_CE_SetHigh(); // TX mode
NRF_CSN_SetLow();
SPI1_WriteByte(0x20); // Address 0x00:(CONFIG)
SPI1_WriteByte(0x7C); // PTX, CRC (2-byte) enabled, 0x7C: transmit mode (no interrupts)
                                   // MASK_RX-DR=1,MASK_TX_DS=1,MASK_MAX_RT=1,EN_CRC=1,CRCO=1,PWR_UP=0,PRIM_RX=0
NRF_CSN_SetHigh();
NRF_CSN_SetLow();
SPI1_WriteByte(0x21); // Address 0x01: (EN_AA)
SPI1_WriteByte(0x00); // disable auto-ack for all channels
                                   // EN_AAP5-4=0
NRF_CSN_SetHigh();
NRF_CSN_SetLow();
SPI1_WriteByte(0x23); // Address 0x03: (SETUP_AW)
SPI1_WriteByte(0x02); // address width = 4 bytes
                                   // RX/TX ADDRESS FIELD WITH, '10'-4 BYTES
NRF_CSN_SetHigh();
NRF_CSN_SetLow();
SPI1_WriteByte(0x24); // Address 0x04: (SETUP_RETR)
SPI1_WriteByte(0x00); // ARC = 0
                                   // ARD-WAIT 250µs, ARC-RETRANSMIT DIABLED
NRF_CSN_SetHigh();
NRF_CSN_SetLow();
SPI1_WriteByte(0x25); // Address 0x05: (RF_CH)
//SPI1_WriteByte(RFID3); // set RF frequency
SPI1_WriteByte(0X02); // set RF frequency - CHANNEL 2,(Which is the default?)

NRF_CSN_SetHigh();
NRF_CSN_SetLow();
SPI1_WriteByte(0x26); // Address 0x06: (RF_SETUP)
SPI1_WriteByte(0x26); // data rate = 250kbps, 0dBm

NRF_CSN_SetHigh();
NRF_CSN_SetLow();
SPI1_WriteByte(0x30); // Address 0x10: (TX_ADDR) set RF TX address ID
SPI1_WriteByte(RFID0); // (0x20 | 0x10)
SPI1_WriteByte(RFID1); // 4 bytes of TRANSMIT ADDRESS. USED FOR A PTX DEVICE ONLY
SPI1_WriteByte(RFID2); // RFIDx - A 4-BYTE USER DEFINED ADDRESS???
SPI1_WriteByte(RFID3);

NRF_CSN_SetHigh();
NRF_CSN_SetLow();
SPI1_WriteByte(0x31); // Address 0x11: (RX_PW_PO) 8 byte payload (0X20 | OX11)
SPI1_WriteByte(0x08); // NUMBER OF BYTES IN RX PAYLOAD IN DATAPIPE 0 - 8 BYTES
                                  
NRF_CSN_SetHigh();
NRF_CSN_SetLow();
SPI1_WriteByte(0xE1); // flush TX (COMMAND)
                                   // FLUSH TX FIFO, USED IN TX MODE

/*NOT SURE I FULLY UNDERSTAND WHAT'S GOING ON HERE?
"PWR_UP = 1"
"0x3F: receive, 0x7E: transmit (no interrupts)"*/
NRF_CSN_SetHigh();
NRF_CSN_SetLow();
SPI1_WriteByte(0x20); // (W_REGISTER COMMAND) PWR_UP = 1
SPI1_WriteByte(0x7E); // 0x3F: receive, 0x7E: transmit (no interrupts)
                                   // MASK_RX-DR=1,MASK_TX_DS=1,MASK_MAX_RT=1,EN_CRC=1,CRCO=1,PWR_UP=0,PRIM_RX=1
                                   // MAKES PRx

NRF_CSN_SetHigh(); // active low SPI enable

/*IS THIS HOW YOU WOULD READ A REGISTER VALUE FROM THE nRF2401*/
uint8_t nRF_RegisterValue;
NRF_CSN_SetHigh();
NRF_CSN_SetLow();
SPI1_WriteByte(0x06);
nRF_RegisterValue = SPI1_ReadByte();

post edited by MJordan - 2020/05/24 19:33:04
#7
XorLor
Junior Member
  • Total Posts : 56
  • Reward points : 0
  • Joined: 2009/10/23 00:17:05
  • Location: 0
  • Status: offline
Re: PIC16f877A + NRF24L01 Communication 2020/05/24 21:30:56 (permalink)
+1 (1)
MJordan
MCC XC8 generates a routine called "SPI1_WriteByte". Is this is equivalent to your "SPI_X"?

Yes, SPI_X is the equivalent. It writes one byte to the SPI.
 
MJordan
Given the code supplied. It looks like I need to set SCK1=250Khz? (which would be perfect). It looks like the nRF24 default is 2Mhz. Does that mean I have to set SPI to 2Mhz to make the Configuration Settings or (I assume) is 2Mhz just the default for actual Tx/Rx transmission?

 
Look at the SPI timing requirements in the datasheet. The SCK low time (Tcl) and SCK high time (Tch) minimums are 40ns each, so your SPI clock can be as fast as 12.5MHz, regardless of the on air data rate.
 
In the example code, 250kbps is the modulated signaling rate the nRF24L01+ uses when transmitting and receiving
data.
 
Note: 250kbps only works with the newer NRF24L01+ (NRF24L01P) chip. The older NRF24L01 can only do 1mbps or 2mbps.
 
MJordan
RFIDx - any user defined 4-byte address? something like: 0xFF, 0xFF, 0xFF, 0xFF would do?

 
You can configure the address to be 3, 4, or 5 bytes long. The address is user defined but it is recommended to use values that have some variation (not 0xFF 0xFF 0xFF 0xFF) to reduce error rate. The datasheet states:
 
Note: "Addresses where the level shifts only one time (that is, 000FFFFFFF) can often be detected in
noise and can give a false detection, which may give a raised Packet Error Rate. Addresses
as a continuation of the preamble (hi-low toggling) also raises the Packet Error Rate."
 
MJordan
If I need the receiver on all the time do you know if I can safely pull CS High in hardware?

 
There's more to it than that. I suggest reviewing the parts of the datasheet that explain setting up transmit/receive mode, and SPI.
 
Note:  "The SPI commands are shown in Table 20. Every new command must be started by a high to low transition on CSN."
 
Here is an example for setting up receive mode:
 

 
NRF_CEOff(); //PRX, CRC (2-byte) enabled
 
NRF_CSNOff(); // 2nS minimum delay required
NRFPut(0x20);
NRFPut(0x3D); // 0x3D: receive, 0x7C: transmit mode (no interrupts)
NRF_CSNOn();
delay(1); // 50nS minimum delay required
 
NRF_CSNOff(); //disable auto-ack for all channels
NRFPut(0x21);
NRFPut(0x00);
NRF_CSNOn();
delay(1); // 50nS minimum delay required
 
NRF_CSNOff(); //address width = 4 bytes
NRFPut(0x23);
NRFPut(0x02); // 4 byte address width
NRF_CSNOn();
delay(1); // 50nS minimum delay required
 
NRF_CSNOff(); // ARC = 0
NRFPut(0x24);
NRFPut(0x00);
NRF_CSNOn();
delay(1); // 50nS minimum delay required
 
NRF_CSNOff(); //set RF channel
NRFPut(0x25);
NRFPut(0x13);
NRF_CSNOn();
delay(1); // 50nS minimum delay required
 
NRF_CSNOff(); //data rate = 250kbps
NRFPut(0x26);
NRFPut(0x26);
NRF_CSNOn();
delay(1); // 50nS minimum delay required
 
NRF_CSNOff(); //set Receive address (LSB first)
NRFPut(0x2A);
NRFPut(0xDE);
NRFPut(0xDE);
NRFPut(0xE1);
NRFPut(0x13);
NRF_CSNOn();
delay(1); // 50nS minimum delay required
 
NRF_CSNOff(); //set TX address (LSB first)
NRFPut(0x30);
NRFPut(0xDE);
NRFPut(0xDE);
NRFPut(0xE1);
NRFPut(0x13);
NRF_CSNOn();
delay(1); // 50nS minimum delay required
 
NRF_CSNOff(); //8 byte payload
NRFPut(0x31);
NRFPut(0x08);
NRF_CSNOn();
delay(1); // 50nS minimum delay required
 
NRF_CSNOff(); // flush TX
NRFPut(0xE1);
NRF_CSNOn();
delay(1); // 50nS minimum delay required
 
NRF_CSNOff(); // FLUSH_RX
NRFPut(0xE2);
NRF_CSNOn();
delay(1); // 50nS minimum delay required
 
NRF_CSNOff(); //PWR_UP = 1
NRFPut(0x20);
NRFPut(0x3F); // 0x3F: receive, 0x7E: transmit (no interrupts)
NRF_CSNOn(); // active low SPI enable
//delay(1); // 50nS minimum delay required
 
NRF_CEOn(); // monitor the air
 

 
MJordan
/*IS THIS HOW YOU WOULD READ A REGISTER VALUE FROM THE nRF2401*/
uint8_t nRF_RegisterValue;
NRF_CSN_SetHigh();
NRF_CSN_SetLow();
SPI1_WriteByte(0x06);
nRF_RegisterValue = SPI1_ReadByte();[/code]

 
Look at the R_Register command in the datasheet. The read command in binary is 000A AAAA where AAAAA is the 5-bit register address you want to read. I don't have a code example for this but I hope this helps.
post edited by XorLor - 2020/05/24 21:32:18
#8
MJordan
Starting Member
  • Total Posts : 48
  • Reward points : 0
  • Joined: 2016/02/17 18:09:49
  • Location: 0
  • Status: offline
Re: PIC16f877A + NRF24L01 Communication 2020/05/25 05:42:52 (permalink)
0
You have been extremely helpful and I appreciate it. You laid everything out for me. I really feel like I understand how it's supposed to work now.
 
I confirmed nRF24L01+ so 250Khz is ok. I adapted what you wrote to fit the Xc8 default conventions. Changed the Address to something varied. Changed minimum delay to 1µS as it's "built-in" easy (couldn't find a nS delay?). Added that delay to the TX code too.
 
As I can't communicate anything yet, I am trying to confirm the operation of the module. I'm trying to read Registers back from the nRF24. I am not unable to do so. I am familiar with the R_REGISTER command and it seems straight forward. However, any R_REGISTER command I "send" to the nRF24 remains in the buffer SPI1BUF (only to be read back out), which makes me believe that I am missing something or the nRF24 is not operating correctly and therefore never sending the proper results back. I bought ten modules and have tried a few with no success. 
 
To check my hardware I put TxSetup in a loop and with a scope, I can confirm (at the module's own pins):
3.3v, GND with voltmeter
With a scope: module SCK mirrors PIC clock, I get transitional signals on CE, CSN, MOSI, MISO
 
I attached the entire project (which is not much more than what you've outlined for me already). I know this is a big ask, but maybe if you or someone with one of these modules connected already can check it out to see if it works? Point out what I'm doing wrong?
 
thanks again, mike
#9
XorLor
Junior Member
  • Total Posts : 56
  • Reward points : 0
  • Joined: 2009/10/23 00:17:05
  • Location: 0
  • Status: offline
Re: PIC16f877A + NRF24L01 Communication 2020/05/25 12:31:30 (permalink)
+1 (1)
MJordan
As I can't communicate anything yet, I am trying to confirm the operation of the module. I'm trying to read Registers back from the nRF24. I am not unable to do so. I am familiar with the R_REGISTER command and it seems straight forward. However, any R_REGISTER command I "send" to the nRF24 remains in the buffer SPI1BUF (only to be read back out), which makes me believe that I am missing something or the nRF24 is not operating correctly and therefore never sending the proper results back. I bought ten modules and have tried a few with no success. 



I just did a quick test and am able to read the register 6 by sending 0x06 and then reading one byte:
 

uint8_t addr = 0x06;
uint8_t received_data = 0;
 
NRF_CEOff();    // CE low
NRF_CSNOff();  // CSN low
NRFPut(addr);
received_data = NRFPut(0x00);    // received_data = SPI1_ReadByte(); should work
NRF_CSNOn();  // CSN high
 
// 0x26 was returned

#10
MJordan
Starting Member
  • Total Posts : 48
  • Reward points : 0
  • Joined: 2016/02/17 18:09:49
  • Location: 0
  • Status: offline
Re: PIC16f877A + NRF24L01 Communication 2020/05/25 15:06:59 (permalink)
0
I've tested out the code and although it isn't working for me I am getting a result in SPI1BUF that is different than what I sent, so maybe some progress... Here's what I've done and some questions/observations:
 
I noticed you have CE low. I take from that that CE only affects the wireless Rx/Tx and does not disable the entire module? CE only pertains to RX/TX transmissions? - I didn't know that. 
 
For a sanity check, I removed the module completely and ran the program. I consistently got 0xFF in SPI1BUF. So if it wasn't working at all I might expect similar result.


The problem: regardless of the register I try to read I get 0x0E returned, which is wrong, but feels like progress... At least something seems to be leaving SPI1BUF and something different is coming back to SPI1BUF. Also, I switched out the module for a different one and got the same 0x0E result...
 
This is how I translated the code you listed. Did I miss something? Does your  "received_data = NRFPut(0x00)" do something additional that makes the magic happen? I attached my complete program, with the below changes included, again if you want to run it as is. Something might jump out at you as wrong?
 
Thanks again. I can't tell you how much I appreciate your time!

    uint8_t addr = 0x01;
    uint8_t received_data = 0;

    NRF_CE_SetLow(); // CE low 
    NRF_CSN_SetLow(); // CSN low
    SPI1_WriteByte(addr);
    received_data = SPI1_ReadByte(); // received_data = NRFPut(0x00); received_data = SPI1_ReadByte(); should work
    NRF_CSN_SetHigh(); // CSN high
    
    NOP();

#11
XorLor
Junior Member
  • Total Posts : 56
  • Reward points : 0
  • Joined: 2009/10/23 00:17:05
  • Location: 0
  • Status: offline
Re: PIC16f877A + NRF24L01 Communication 2020/05/25 23:21:19 (permalink)
+1 (1)
I will take a look at your code. Do you have a schematic I could look at too?
#12
MJordan
Starting Member
  • Total Posts : 48
  • Reward points : 0
  • Joined: 2016/02/17 18:09:49
  • Location: 0
  • Status: offline
Re: PIC16f877A + NRF24L01 Communication 2020/05/26 03:48:59 (permalink)
0
Thanks! Here is a schematic I drew up with the entire circuit, including PicKit3.
post edited by MJordan - 2020/05/27 04:49:49

Attached Image(s)

#13
XorLor
Junior Member
  • Total Posts : 56
  • Reward points : 0
  • Joined: 2009/10/23 00:17:05
  • Location: 0
  • Status: offline
Re: PIC16f877A + NRF24L01 Communication 2020/05/27 11:38:12 (permalink)
0
Here is a simple test that will write to register 5 (RF Channel) and then read it back. Run this after initializing SPI, without configuring anything else on the NRF (don't call RxSetUp or TxSetUp, etc).
 
If this doesn't work, then capture the SPI traffic on a logic analyzer or oscilloscope and I will look at that.
 

NRF_CSN_SetHigh();                          // Needs high to low transition on CSN

NRF_CSN_SetLow();
SPI1_WriteByte(0x25);                       // write to register 5 (RF Channel)
SPI1_WriteByte(0x64);                       // RF Channel 100 (there are 126 different channels)
NRF_CSN_SetHigh();

delay(1);                                   // 50nS minimum delay required

NRF_CSN_SetLow();
SPI1_WriteByte(0x05);                       // read register 5
received_data = SPI1_ReadByte();
NRF_CSN_SetHigh();

#14
MJordan
Starting Member
  • Total Posts : 48
  • Reward points : 0
  • Joined: 2016/02/17 18:09:49
  • Location: 0
  • Status: offline
Re: PIC16f877A + NRF24L01 Communication 2020/05/27 13:20:15 (permalink)
0
The only change I had to make was to change the "delay(1)". "delay(1) gave me a compile errror." I changed it to "__delay_ms(1)". 
 
Otherwise, I ran the code as you said with the default nrf24 configurations. I took a brand new nRF24 out of the static bag and ran the code, but I got 0x05 returned. I assume it was supposed to return 0x64.
 
I attached a screenshot of the result. And, although probably not that useful, I also attached some photos of the circuit. 
 
My TDS460A oscilloscope captures to 3.5" floppies!... so I ordered a $16 USB Logic Analyzer from Amazon. Should be here tomorrow or Friday.
 
Thanks again for your help on this.

Attached Image(s)

#15
MJordan
Starting Member
  • Total Posts : 48
  • Reward points : 0
  • Joined: 2016/02/17 18:09:49
  • Location: 0
  • Status: offline
Re: PIC16f877A + NRF24L01 Communication 2020/05/30 17:12:23 (permalink)
+1 (1)
I got the Logic Analyzer working.
  1. I ran an SPI_only sanity test (250Khz & 1Mhz) to make sure I got what I expected.
  2. I did a nRF24 test at both 250Khz and 1Mhz.
  3. I have 6 of the 8 wires connected to channels (no power or ground connected to a channel) so I can't have missed a connection...
 
This is my first experience with LA, but although Writing seems to be working, I don't seem to be getting anything back from the nRF24...?  Project "SPI_Test" and LA output (PulseView) are attached.
 
Thanks again for your time helping me with this!
#16
XorLor
Junior Member
  • Total Posts : 56
  • Reward points : 0
  • Joined: 2009/10/23 00:17:05
  • Location: 0
  • Status: offline
Re: PIC16f877A + NRF24L01 Communication 2020/05/31 00:48:56 (permalink)
0
I looked at the PulseView file but nothing is labeled so I can't tell what is MISO, MOSI, CSN, or CE. It looks like D7 is the clock. Only 4 of the signals are doing anything so there's definately something wrong with the SPI communication.
#17
MJordan
Starting Member
  • Total Posts : 48
  • Reward points : 0
  • Joined: 2016/02/17 18:09:49
  • Location: 0
  • Status: offline
Re: PIC16f877A + NRF24L01 Communication 2020/05/31 06:34:08 (permalink)
0
Sorry about that. I didn't realize you could rename the outputs. It makes a lot more readable when you do... I relabeled the output and saved out the PulseView data for the SPI/nRF24 at 1Mhz.
 
I'm not sure how it works, but does the CSN pin need to have a high-low transition to read the data back? Is that why I'm not getting anything back?
 
thanks, mike

Attached Image(s)

#18
Jump to:
© 2020 APG vNext Commercial Version 4.5