Leave it to the mech-e to have questions about the actual connections in a wireless system. I’m setting up my rf24G transceivers and in looking at Nathan’s example code, I’m assuming the following connections:
16F88 pin Pin label Label (in code) rf24g label
6 PortB<0> tx_ce ce
7 PortB<1> tx_cs cs
9 PortB<3> tx_clk1 clk1
10 PortB<4> tx_data data
1 PortA<2> rx_ce ce
2 PortA<3> rx_cs cs
3 PortA<4> rx_clk1 clk1
18 PortA<1> rx_data data
17 PortA<0> rx_dr dr1
It appears that most of the RF24g connections have two F88 pins going to it (except DR); I’m fine with that, just wanted to see if I’m understanding things correctly and to make sure my baseline setup works.
Okay - so my code is a little confusing. I used one PIC 16F88 to control two 24G units.
In your code, all the ‘tx_’ pins should connect to one unit. All the ‘rx_’ pins to another unit. Don’t connect one unit to both PIC pins. Use two PICs if it makes more sense. You will eventually need to use two micros anyways if you plan on moving the transceivers off your board anyways.
Next, you must set the pins as input or output pins accordingly. The sample code handles this as simply as possible. I can’t remember anything past yesterday, but I believe CE, CS, CLK1 are outputs all the time. DR1 is an input all the time. DATA is the freaky one that switches between input or output wether you are doing a read or a write to the 24G unit.
Ah, ok that makes sense. You do mention that it’s just a setup for confirming that the hardware works (presumably before shipping), but I just wanted to make sure i was doing stuff right.
Thanks for clearing it up for me (and others?). Hope I don’t come off as a guy who doesn’t do his due diligence before asking questions; I’m all about learning stuff the hard way–lessons sink in deeper.
I’m sorry if this is going to sound lame but i was just wondering , isn’t there supposed to be an interface chip between the RF24g and the PIC micro (PIC 5v - RF24G 3.3v) ? Or are they directly connected one to the other?
As long as you just bit bang the SPI (or use an on-board SPI module) there shouldn’t be a need for a “interface chip.” However, if you do use an SPI bus, you will need to connect both SOMI and SIMO (PIC) lines to the DATA (nRF) line via two 10k resistors.
In other words, your data line would split into two 10k resistors and each line would then go to SOMI and SIMO.