[simpits-tech] Need some Serial Communications help....

raysot at comcast.net raysot at comcast.net
Thu Mar 3 13:19:19 PST 2011


Thanks, Roberto! 

Here's my timing diagram.. hopefully it will go through.
http://anthonyscott.zenfolio.com/misc/h30b6d68e#h30b6d68e

I think I may be misunderstanding how this SPI interface works. 

My understanding so far: 

The very first CLK signal will clock in my LSB (D0) INTO the MSB (D11) and then be right-shifted with each subsequent CLK signal. 

So perhaps I need to reverse my data stream and send my MSB first? 



----- Original Message ----- 
From: "Roberto Waltman" <fsim at rwaltman.com> 
To: "Simulator Cockpit Builder's List" <simpits-tech at simpits.org> 
Sent: Thursday, March 3, 2011 11:04:37 AM 
Subject: Re: [simpits-tech] Need some Serial Communications help.... 

raysot at comcast.net wrote: 
> So, I have the Arduino set up and spitting out a datastream (See image 
> link below) 
> 
> I'm using a CS4122 chip: 
> (http://www.datasheetcatalog.org/datasheet/on_semiconductor/CS4122-D.PDF) 
> 
> This link is my timing diagram. 
> http://dl.dropbox.com/u/22535032/SerialData.jpg 
> 
> I am successful in sending data but the gauge doesn't interpret 
> correctly.. (Basically it just moves to random position on every 2nd cycle 
> of the CS signal.) 
> 
> This leads me to believe that I'm missing something... like a start/stop 
> semaphore or some sort of parity bit(?) 

For some reason I can not access the picture so, based only on the text: 

You mention start/stop bits, etc. The pin names SI/SO can be misleading, 
this is not a serial port as in RS-232 / UART based comms. There are no 
start, stop or parity bits. 

This is an SPI interface. You need to prepare a 12 bits command as 
described in Fig-6 in the data sheet, deliver it bit by bit to the SI pin 
while supplying a clock pulse per bit to the SCLK. You can do it using an 
SPI port in the Arduino, if that is available, or by setting individual 
bits high or low. ("bit-banging") 

The "random position" may be due to sending too many or too few bits, 
sending too many or too few clock pulses, the data or clock bits having 
the wrong polarity, the data being totally wrong, (like what an UART would 
produce,) the bits delivered in the wrong order, (MSB first vs LSB 
first,)or any combination of the above. 

See http://en.wikipedia.org/wiki/Serial_Peripheral_Interface_Bus 

-- 
Roberto Waltman 




-- 
Roberto Waltman. 

_______________________________________________ 
Simpits-tech mailing list 
Simpits-tech at simpits.org 
http://www.simpits.org/mailman/listinfo/simpits-tech 
To unsubscribe, please see the instructions at the bottom of the above page. Thanks! 


More information about the Simpits-tech mailing list