16F88 to 18F4550 NRF24L01

Im having some timing issues between a PIC16F88 and an 18F4550. The 16F88 is running on an internal oscillator which i need. And the 18F4550 is running on an external oscillator. In my configuration bits the 96MHz PLL prescaler is set at Divide by 4 (16MHz input) which is also what I need for this application. As of right now im using software SPI so the code on both PIC’s code are almost Identical. In my while loop im simply checking to see it the irq pin has gone low and then pipe in the information / set LED. Im fairly confident the code works as the two pics with the NRF24L01’s attached will blink an LED when I turn them both on and the 18F is set to run on the internal oscillator. However when I “turn up” the speed on the 18F I might be lucky to get it to blink once. I have tried adding delays but i dont think it is helping much.

Here is my main loop for the 18F the 16F is identical except without the delays…

init();

configure_RX();

while(1)

{

if (SPI_IRQ == 0)

{

LED = 1;

delay_ms(25);

LED = 0;

delay_ms(25);

reset_RX();

delay_ms(50);

}

delay_ms(25);

}

}

The 18F is set as the reciever and the 16F is the transmitter. Could I use some type of intterupt to guarantee that I get my data in?

Any Ideas would be great.

Similar code works OK for me on an 18F4520. I’m using hardware SPI, though.

Leon

Running at two different speeds though?

It shouldn’t matter with SPI.

Leon

Do you think it has anything to do with the SPI being software instead of hardware?

I doubt it, my original code actually used software SPI on both boards.

Leon

Should the IRQ pin be tied low?

I actually have it connected to the nRF24L01 interrupt on my boards in case I want to use a hardware interrupt. It shouldn’t matter, though.

Leon

I think I found the mistake…One last question Im using RC7 as my MOSI pin and it is inconveniently the RX pin on the PIC. Do I need to tie it low so I can use it for UART and have the wireless connected to it at the same time?

Not if it’s needed for SPI. It’s best to use the SPI pins, even if you are using software SPI, as they are unlikely to interfere with other functions. It also makes it easy to switch to hardware SPI, as I did.

Leon

if you change the speed on the 18F, then you may have to check if the Tpd2stby (Power Down to Standby mode) and the Tstby2a (Standby modes to TX/RX mode) delays are still respected.

best regards.