OpenServo.com Forum Index OpenServo.com
Discussion of the OpenServo project
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

I2C and Microcontroller Configurations
Goto page Previous  1, 2
 
Post new topic   Reply to topic    OpenServo.com Forum Index -> Applications
View previous topic :: View next topic  
Author Message
ginge
Site Admin


Joined: 14 Jan 2006
Posts: 1030
Location: Manchester, UK

PostPosted: Sun Aug 19, 2007 12:17 am    Post subject: Reply with quote

Hi bren,

Quote:
So I was thinking about using the 3 SSP lines in SPI mode. The thing that is confusing me is that the gumstix uses 4 wires for it's "Motorola Serial Peripheral Interface* (SPI) protocol" these are:


if I remember correctly, you can disable the use of the frame indicator function in the gumstix by editing the kernel driver. The only reference I immediately found was this link on the gumstix wiki:

http://docwiki.gumstix.org/Sample_code/C/SPI/kernel

I know this works as it is how I have my kernel configured.

Quote:
The other bit of information that I couldn't find on the web is the speed that the the ATmega168 can run it's SPI line at. These no info in the docs about it's max speed to error rate.


The datasheet (page 168 + 169) have the relevant information. The fastest speed available in slave mode is fosc/2 (oscillator frequency / 2). This gives 4MHZ for the speed.

In real life you won't actually get anything near this, but something nearing 2mb/s is achievable if carefully optimised.

Quote:
Do you thing the two will work together?


Absolutely yes 100%. I have my gumstix SPI flashing the bootloader without much trouble at all.

Just a quick question... you realise each SPI slave is going to need its own SS select line? Or did you have some sort of shift register in mind for slave selection? Alternatively do you know if the AVR supports daisy chaining?

Barry
_________________
http://www.headfuzz.co.uk/
http://www.robotfuzz.co.uk/
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger MSN Messenger
bren



Joined: 01 Jul 2007
Posts: 79

PostPosted: Sun Aug 19, 2007 12:58 pm    Post subject: Reply with quote

Hi Ginge

Thanks for the fast reply. 2 mb/s should be fine for my purpose, I will be using the spare I/O for the SS lines. Hopefully i will have it working by the end of next week.

Bren
Back to top
View user's profile Send private message
DavidCary



Joined: 24 Oct 2007
Posts: 12
Location: Oklahoma and Kansas

PostPosted: Thu Nov 01, 2007 3:04 pm    Post subject: Reply with quote

Quote:
... you can disable the use of the frame indicator function ... you realise each SPI slave is going to need its own SS select line? ...

You can weld your car doors shut. You realize that you are going to have to slide into your car through the windows?

In my opinion, SPI peripherals should support the "daisy chain SPI configuration".
Then you only need 4 wires on the host for any number of peripherals -- no need for individual SS lines, no need to program individual addresses.
Example: ADS1271.

It's only peripherals that are (in my opinion) improperly designed that require individual SS lines.

(Properly designed SPI peripherals -- that is, ones that support daisy chaining -- *can* be driven with individual SS lines, but it's not required).

From reading the datasheet, the ATmega168 is properly designed to act as a daisy-chained SPI with 1 byte of command-in / data-out.
I suspect that it can be programmed to act as a daisy-chained SPI with 3 bytes of command-in/data-out, which may be more convenient.
With 3 bytes, you can set the seek speed in one command -- zero bytes for the address, one byte for "set seek speed to:", and 2 bytes for the actual speed.

I see we also talked about this in the
Robots with serial servos thread.

Wikipedia: daisy chain SPI configuration
Back to top
View user's profile Send private message
DavidCary



Joined: 24 Oct 2007
Posts: 12
Location: Oklahoma and Kansas

PostPosted: Thu Nov 01, 2007 9:46 pm    Post subject: Reply with quote

Quote:
the gumstix uses 4 wires for it's "Motorola Serial Peripheral Interface* (SPI) protocol" these are:

NSSPSCLK
NSSPSFRM
NSSPTXD
NSSPRXD

The one that's confusing me is the Frame indicator as it doesn't appear to be used by the ATmega168.

In SPI, the frame indicator is another name for the SS (slave select) signal.

"Frame indicator" is a more accurate name when it is used as part of a "daisy chain SPI".
Back to top
View user's profile Send private message
bren



Joined: 01 Jul 2007
Posts: 79

PostPosted: Tue Nov 06, 2007 3:35 pm    Post subject: Reply with quote

Thanks for that advise. I've finished that bit of hardware now (set it of to the PCB company today). I used the SS anyway as in reality I will only have 5 chips in this bus. If I want more I will more then likely just redesign the PCB to accommodate them.

Bren
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OpenServo.com Forum Index -> Applications All times are GMT
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group