9 years, 10 months ago.

K64f / nRF24L01 spi problem?

I'm trying to get two nRF24L01+ modules talking to each other, I have one set up on the k64f board and one on the KL25z board.

I used the example program http://developer.mbed.org/cookbook/nRF24L01-wireless-transceiver and changed the pinouts to the ones below

 #define NRF_MOSI  PTD6
 #define NRF_MISO  PTD7
 #define NRF_SCK   PTD5
 #define NRF_CSN   PTD4 
 #define NRF_CE    PTC12
 #define NRF_IRQ   PTC18

nRF24L01P my_nrf24l01p(NRF_MOSI, NRF_MISO, NRF_SCK, NRF_CSN, NRF_CE, NRF_IRQ);    // mosi, miso, sck, csn, ce, irq

When i run the code I get this output to the serial which seems fine

nRF24L01+ Frequency    : 2402 MHz
nRF24L01+ Output power : 0 dBm
nRF24L01+ Data Rate    : 1000 kbps
nRF24L01+ TX Address   : 0xE7E7E7E7E7
nRF24L01+ RX Address   : 0xE7E7E7E7E7
Type keys to test transfers:
  (transfers are grouped into 4 characters)

However on the k64F board when i send 4 characters it jumps into the transmit subroutine

my_nrf24l01p.write( NRF24L01P_PIPE_P0, txData, txDataCnt );

and hangs, never managed to transmit. I tried this software edited for the KL25z board it transmits straight away after typing 4 chars so its just the k64f board having a problem.

Also i noticed that it will finally leave the loop and toggle the LED to indicate the data was transmitted if i touch the SCK pin on the nRF24L01+ board with either a DVM probe or my finger. Has anyone come across this before or have any idea why it is doing this?

1 Answer

9 years, 6 months ago.

I was having the same problem, one of my k64f (REV D, I think) boards works with this example and the other (REV E) doesn`t.

I could get it working when I connected the pins of the RF24L01+ to SPI0, which are pins PTD1, PTD3 and PTD2, for SCK, MISO and MOSI respectively. You can find these pins here: https://developer.mbed.org/platforms/FRDM-K64F/

I also connected GND to one of the GNDs and VCC to one of the 3v3 pins (just make sure you connect to a 3.3 v pin, because according to the RF24L01+ specification it maximum supply voltage is 3.6v). And the other 3 pins (IRQ, CS and CE) I have read you can put in any digital input, so I have connected it to pins PTC3, PTC2 and PTA2.

Then you just have to change the pins definitions in your program to match to the pins you connected the RF.

I hope it can help you

EDITED:

It turned out there is another solution. It seems the schematics for k64f they provide on mbed site is for REV D, and there is another schematics showing that the CE pin on revision E is actually connected to pin PTB20 (I would provide this schematics here, but wasn't me who found this, so I don't know where it is available).

So you can simply keep RF24L01+ plugged on the rf module on k64f board and change only CE pin to PTB20

I was trying to immplement radio comms between the KL46z and the K64f. At first it didn't quite work but after changing the CE pin to PTB20 it worked. Thank you Lucas !

posted by Shantanu Mahendra Jain 15 Feb 2016