Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

PIC 16F628 ( or others) as a SPI slave

Status
Not open for further replies.

jpdn

New Member
I am trying to connect a Raspberry Pi to a Pic using SPI interface.
In my case I want the Raspberry to be the Master and the Pic to be the slave.
The Raspberry send a request for data (temperature) to the Pic, and the Pic replies with a value.
SPI is needed in order to communicate via a pair of 2.1Ghz RF transceivers NRF24L01

However the commands for SPI included in OnshonSoft seem to be only for making the PIC acting as a Master and not as a Slave :+((

Is this correct ?
Is there a way to go around ?
Thanks in advance
JP
 
Of course there is.... You can set up slave SPI using the registers directly... However!! if they are both communicating with RF transceivers...... Why???... The SPI master is both ends, the slaves are the RF transceivers..
 
Thank you for the fast reply.

I think that I understand what you mean: For the PIC, the , you mean that the NRF24L01 device is considered as a slave device , and the Pic is the master . Right ?

But so if the Raspberry send a request for data (i.e temperature), how can the Pic be only waiting for a request to come from the Raspberry?

I have started my project with UART and 433Mhz transmitter, but the 433Mhz signal is too noisy ( when the Raspberry is now transmitting, the receiver pick up noise which makes the UART mad.)

So I decided to move to NRF24L01 which take care of the noise filtering in transmission but use a SPI interface.

May be I misunderstood the concept of the NRF24L01, as I thought it will allows me to transfer data in both direction as UART/RS232.

JP

The NRF24L01 is both a transmitter and a receiver on a single small board ,with only these pins + power supply.
=====================================================

IRQ


(this signal is active low and is controlled by three maskable interrupt sources)


CE (this signal is active high and is used to activate the chip in RX or TX mode)


CSN (SPI signal)


SCK (SPI signal)


MOSI (SPI signal)


MISO (SPI signal)

=============================================================
 
I would need to devour the RF datasheet, but I would imagine your Pi would ask for data.... The RF would transmit and use the IRQ line to prompt the Pic for the data... If I get some time today, I shall indeed scan through said datasheet..

These RF modules are used quite a bit so there must be examples on the net.....
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top