MASTER and SLAVE PICs using SPI in Oshonsoft

Thread Starter

camerart

Joined Feb 25, 2013
3,730
The data is the contents of the SSPBUF/ Slave.
Hi J,
I realise that, but the DATA from the SLAVE never goes in the direction toward MASTER, where it's needed, using any of the programs in the thread.
C
 
Last edited:

jjw

Joined Dec 24, 2013
823
Hi J,
I realise that, but the DATA from the SLAVE never goes in the direction toward MASTER, where it's needed, using any of the programs in the thread.
C
Earlier you had wrong idle level of the clock.
Is it correct now?
Try to use the Spi analyzer.
Did you ever get something from the slave ( not 255 or 0 )
 

Thread Starter

camerart

Joined Feb 25, 2013
3,730
Earlier you had wrong idle level of the clock.
Is it correct now?
Try to use the Spi analyzer.
Did you ever get something from the slave ( not 255 or 0 )
Hi J, TRANSMITTER
As mentioned there have been many variations of program throughout this thread. The latest ones don't use the OSH SPI set-up, but set the PINS/settings directly instead. All of these methods get the same results, where the MOSI DATA works, but MISO doesn't, and ONLY 0 or 255 are shown on the MISO line.

The wrong level of the clock is from the latest programs, which 'I think' can be corrected in the Digital analyser, but I think it is easier to go back to the earlier OSH set-up, where the Analyser clock was ok.

What is the SPI analyser?
C
 

jjw

Joined Dec 24, 2013
823
If your digital analyser understands faulty SPI clock level, pin names ( Mosi, Miso etc) , I think it is SPI analyser.
 

Thread Starter

camerart

Joined Feb 25, 2013
3,730
Hi,
In case the 18F4431 PIC doesn't 'like' being slave (Who does), I have an idea of reversing MASTER/SLAVE.
First I want to test if the present SLAVE SSPFUF is holding any DATA from the MASTER.
I now have a radio on the TX PIN to OUTPUT DATA, but this is also the SS PIN, so it may not work.
I'll report back.
C
 

jjw

Joined Dec 24, 2013
823
SSPBUF is not used by the software master.
The slave uses SSPBUF.
The master gets the contents of the slaves SSPBUF with SPIRECEIVE.
Why do you wan't to go back to sw master?
Hw master seemed to be working.
I think the problem is on the slave. Maybe a fault in connections, a short, broken hw etc.
You could make a simple program to test the sdo, sdi pins.
Write 0 and 1 to output pin, read from input pin.
 
Last edited:

Thread Starter

camerart

Joined Feb 25, 2013
3,730
SSPBUF is not used by the software master.
The slave uses SSPBUF.
The master gets the contents of the slaves SSPBUF with SPIRECEIVE.
Why do you wan't to go back to sw master?
Hw master seemed to be working.
I think the problem is on the slave. Maybe a fault in connections, a short, broken hw etc.
You could make a simple program to test the sdo, sdi pins.
Write 0 and 1 to output pin, read from input pin.
Hi J,
I've tried various test programs, with some odd results.
Do these look ok for testing?

EDIT: I will continue trying any ideas, until the end of today, then I'll concede defeat(
C
 

Attachments

Last edited:

ericgibbs

Joined Jan 29, 2010
18,872
hi C,
As you know I create Tools for the Oshonsoft IDE, so I have prepared a SPI Slave Tool.
It shows that the Hardware SPI does not work within the IDE sim environment, the Software SPI works fine.
So the only way to test your HW SPI is to program PIC's:(
E
 

Attachments

Thread Starter

camerart

Joined Feb 25, 2013
3,730
hi C,
As you know I create Tools for the Oshonsoft IDE, so I have prepared a SPI Slave Tool.
It shows that the Hardware SPI does not work within the IDE sim environment, the Software SPI works fine.
So the only way to test your HW SPI is to program PIC's:(
E
Hi E,
I get mixed up between Hardware and software, so I use all the valuable help here and act as a dumb parrot, copying and pasting suggestions. (You'd think by now, I'd be an expert, but no)

You mention the IDE SIM environment. As there are two PICs on my PCB, I've been only using LIVE testing, so I program each PIC in turn, then see what happens with either LEDs or Digital analyser.

As mentioned above, after today, if I can't get the 18F4431 to act as SLAVE I'll give in and try a different method of DATA transfer.
Thanks.
C.
 
Top