Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Problem with getting MISO signal in a SPI communication between ADUC841 and MAXQ3183

Status
Not open for further replies.

timothyarora

Junior Member level 2
Joined
Sep 22, 2010
Messages
24
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,494
i'm connection aduc841 with maxq3183 for the spi communication between them making maxq3183 as slave. Although i'm getting 8 square pulses in clock and MOSI 0x80 (as send) but i'm not getting miso from the slave.
master and slave are connected as:
MISO conncted to MISO
MOSI connected to MOSI

i want to now what could be the reasons for not coming the MISO signal.
i've also noticed that when i've grounded the slave with master ground then miso signal is in millivolt or if not, it is abrupt signals of 18v . please reply me soon as i need it urgently.
 

Re: spi communication

This is probably going to be no help at all, but my only experience with fixing a broken SPI interface was where a 1 foot long ribbon cable connected the two chips. The slave was not receiving its data. After hooking up a very high speed logic analyzer, I saw a very fast ringing on the clock line at the slave chip input. The ring looked like an extra 1 ns long clock pulse. Apparently there was an impedance mismatch cable to slave chip, and it thought I was sending "extra" clock pulses. When I fixed the clock ringing, it started to work well.
 

spi communication

thanks for reply, yes there is a fast ringing on the clock line at the slave chip input in miso . how you have removed impedance mismatch to slave chip?

Also, i've seen there is some notch signals coming from miso according to clock pulses but are of near 100mv.
as my master aduc 841 is 5 v device i've used voltage divider to reduced 5v to 3.3 v for maxq3183

other things are according to my oscilloscope
1.38 Mhz clock frequency
on master side:
ground : 1.38Mhz 900mv pk-pk voltage
slave select : 446 Hz 300mv pk pk voltage
MISO : 1.410 MHz 238mv pk pk
MOSI 446 Hz 3v(converted with the help of votage divider from 5v)
clock scl 1.38 Mhz 3.2 v pk pk

on slave side
without connecting to master :
slave select 20 Mhz /125/ 200 Mhz 142mv pk pk
clk scl 154 mv 10/23/600 Mhz
Miso 2.668 MHz 152 mv pk pk



after connecting slave to master
3.3v is somewhat reduced fed by master after voltage divider

slave select 20 MHz 125-200Mhz 142mv
 

Re: spi communication

Well, in my case I had one way communications only. I was using a controller to drive a custom RF Receiver chip, and all I had to do was load up a few registers with the right bits. So, right at the receiver chip, I simply put a buffer gate chip on the three lines going into it.

If you are using the 2 way communicaitons, you are not going to be able to do that. But you could maybe make a simple lowpass filter on the clock line, maybe a series 22 ohm resistor with a shunt 100 pF or so capacitor. Or maybe a 220 ohm resistor to ground. Something to either better match the end of the line, or lowpass filter the clock ripples. The data lines are not so important, I was told, as the data transitions state long before the leading edge of the clock, so the data line is fully settled out.
 
spi communication

Tell me one thing, how you have reset the slave after giving the clock pulses from master ? is it necessary ?
 

Re: spi communication

miso should be connected to miso and mosi should be to mosi as i've seen on lot of other diagram also
 

spi communication

i've used the rc filters. it's ok in that terms. i've used optical isolator 6n137 . it's output is near about 3v but not a square wave according to oscilloscope. is it wrong going here?
 

Re: spi communication

Here is the data I was talking about. You can see the extra clock bounces, which load in the data bit twice.
 

Attachments

  • SPI BUS Irregularities[1].doc
    38.5 KB · Views: 146

Re: spi communication

i'm not getting any such clock ringing . i'm not getting exact waveforms from optocoupler according to input of optocoupler . what should i do ?

---------- Post added at 15:18 ---------- Previous post was at 13:57 ----------

my complete project aim is to have digital communication for power theft detection , prevention and control
 

Re: spi communication

HOw and where did you connect 6N137? Is it possible to send extract of schematic?

FYI. 6N137 is 5V compatible only.
 

Re: spi communication

thanks for raising 6n137 question
i've question over this . please see attachment
 

Attachments

  • optocoupler.pdf
    130.4 KB · Views: 105
  • optocoupler.doc
    93 KB · Views: 79

Re: spi communication

Slave select activation in relation to start of clock is often a cause of problems especially when two different manufacturers are involved.

Second common issue is MISO data output from slave in relation to master's clock. There can be buffer turn-around time issues on the slave. Some chips allow programming on data presentation on rising or falling edge of clock for output presentation to give a half cycle for delays in slave presentation response time. Make sure the master's clock stays up and SS stays active until last slave's bit is received.

Make sure word length and operation mode is matching between devices.

I even saw one bazaar implement that required a clock to start first to recognize slave select which was total violation of protocol.

IC designers like to work in syncronous logic world and SS by nature is an async event.

Many IC's specs provide poor info on SPI timing requirements.
 
Last edited:

spi communication

i'm getting all correct waveforms on MOSI, Clock of 3.3 v square waves.
I aslo getting waveforms on MISO now as i attached. But i've not get C1, C2 as according to sending of command byte i should receive through oscilloscope. i thought i'm going wrong somewhere in programming now.

#include <stdio.h> // declarations for I/O functions
#include <ctype.h>
#include <ADuC841.h> // ADuC841 predefined symbols


unsigned char Data[20];


sbit bss = P1^5; // Chip select for maxq3183 (PORT1.5)
/*******************************************************
Initialize the ADuC841 resouces being used
in this sample
*******************************************************/
void microdelay(unsigned int itime)
{
unsigned int i, j;
for(i=0;i<itime;i++)
for(j=0;j<400;j++);
}


void msdelay(unsigned int itime)
{
unsigned int i, j;
for(i=0;i<itime;i++)
for(j=0;j<1275;j++);
}



unsigned char Send_SPI(unsigned char x)
{
int SPI_TIMEOUT = 360;
unsigned char y = 0;
int z;
int error = 0;
SPICON=0x3A; /* MSTSM, SPIEN */
z = 0; while ((!ISPI) && (++z < SPI_TIMEOUT));
if (z == SPI_TIMEOUT) error = 1;
ISPI = 0; /* Clear transfer complete flag */
SPIDAT = x;
z = 0; while ((!ISPI) && (++z < SPI_TIMEOUT));
if (z == SPI_TIMEOUT) error = 1;
y = SPIDAT;
ISPI = 0;
msdelay(1);
if (error) return 0;

return y;

}



void init841(void) // Initialize internal peripherals
{
/* Initialize SPI to talk to maxq3183 */
CFG841 = 0x10; // Serial interface enable for P3.5..P3.7 pins
SPICON = 0x3A; // Enable SPI I/F as master, SCLOCK idle H,
IEIP2=0x01; // advance MSB output, sclock=fcore/8
}

/*******************************************************
This function transmittes a byte data
on the SPI interface
*******************************************************/


void main()
{
int x;
init841();



bss=1;
//write
SPE = 0;
for(x=0; x<300; x++);
SPE = 1;

bss=0;
while(1)
{

Send_SPI(0x80);

microdelay(1);


Send_SPI(0xFF);

microdelay(1);




}
bss=1;

}

please send me advice regarding this.
thanks
 

Attachments

  • misocome.pdf
    56.3 KB · Views: 114
  • misocome.doc
    52 KB · Views: 107
  • plugin-ADUC841_842_843.pdf
    903 KB · Views: 101
  • CD9A376Fd01.pdf
    1.1 MB · Views: 94

Re: spi communication

why this programme is not generating square wave on port P1.5 i.e of slave select pin j2 connector of mini51 aduc841 ?
waveform is not coming.
Although blinking is happening in keil software port 1.5

signals on miso is coming but is continuously 1 for 1 clock and continuous 0 for other clock. and then happening similarly further
please help me regarding that.
 

Re: spi communication

Also
on sending single byte by Send_SPI(0x80), input is ok according to the change according to requirement but there is no output i.e in millivolt

on sending another byte with it as in code, input is not as send by me but output is same as input and of 3.3 v
please illustrate me how to check multiple inputs by MOSI to slave with the help of oscilloscope
 

Re: spi communication

i'm receiving different digital signal on miso according to input. i want to analyze them using tds 1002 by computer as it is difficult to see directly multiple inputs and outputs. so, i've connected it through rs232 port to com port of computer using female to female connector. still the software is not recognizing it . oscilloscope is on . what can be the possible reason?
 

Re: spi communication

As i'm expecting to analyze all the signals of MISO, MOSI, Clock , SS with lots of samples . it become hard to analyze them with oscilloscope. so, will connecting the tds1002 oscilloscope with computer will do the work or should we purchase the logic analyzer which consist of memory for storing the samples and then we can see it.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top