I2C and Microcontroller Configurations

Discussions relating to using the OpenServo in real-world applications such as robotics.

Moderators: jharvey, Secondary Admin, Admins

ginge
Site Admin
Posts: 1031
Joined: Sat Jan 14, 2006 2:34 pm
Location: Manchester, UK
Contact:

Post by ginge » Sun Aug 19, 2007 12:17 am

Hi bren,
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.
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.
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

bren
Posts: 79
Joined: Sun Jul 01, 2007 6:56 pm

Post by bren » Sun Aug 19, 2007 12:58 pm

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

DavidCary
Posts: 12
Joined: Wed Oct 24, 2007 11:10 pm
Location: Oklahoma and Kansas

Post by DavidCary » Thu Nov 01, 2007 3:04 pm

... 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

DavidCary
Posts: 12
Joined: Wed Oct 24, 2007 11:10 pm
Location: Oklahoma and Kansas

Post by DavidCary » Thu Nov 01, 2007 9:46 pm

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".

bren
Posts: 79
Joined: Sun Jul 01, 2007 6:56 pm

Post by bren » Tue Nov 06, 2007 3:35 pm

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

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests