[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SV: [Paparazzi-devel] using SPI slave on Tiny2.11

From: Júlíus Helgi Bjarnason
Subject: SV: [Paparazzi-devel] using SPI slave on Tiny2.11
Date: Wed, 3 Nov 2010 16:40:26 +0000

Hi Adam,

It's nice to see someone working at similar thing as me.

I haven't started any work on the code for the tiny because I am still making 
myself familiar with the current paparazzi code. I have an funjet airplane and 
and we have used tiny as autopilot and it worked fine. Now we are adding the 
gumstix to the airplane. The gumstix is ready and the next step is to modify 
the code for tiny to make them communicate. I am working on this as my final 
project for my BSc degree in electrical engineering and am working on this 
almost 24/7. If we can work on the code together we can hopefully get more work 
done quicker.

I came across the errata document for the LPC processor that explains problems 
when the CPHA is 0. I'm not sure if that is relevant but the file is at

Frá: address@hidden address@hidden Fyrir hönd Adam Spence address@hidden
Sent: 2. nóvember 2010 23:45
Viðtakandi: address@hidden
Efni: Re: [Paparazzi-devel] using SPI slave on Tiny2.11

Hey Júlíus,

I've been working with the SPI slave on a tiny 2.11 in the last couple of 
weeks. I wasn't having a lot of success using the entire build and had to start 
from scratch to work out a few issues.

I am now in the posistion which I can effectively communciate using the SPI 
slave but there are a few issues. So far I have been unsuccessful in getting 
the CS to work properly when the phase (CPHA) is set to 0. For whatever reason 
I cannot get an external master to communicate. I'm using an AVR as the master 
and between two AVRs, the code works fine. As a result I'm having to always 
ensure that CPHA is set to 1. This effectively ignores the CS and has to be 
held low. This may not help you! If you find out what's wrong I would love to 
know. I've monitored the CS line on a scope and it's behaving as expected but 
the Tiny does not generate an interrupt.

On another note, the existing slave code appears to disable the receiver after 
every byte. I could not find a slave usage example so ended up commenting this 
out to get it to work.

Finally, as we're using CPHA = 1 there can be an issue with the slave/master 
getting out of sync by a number of bits. So far I the only way I have found to 
fix this is to disable and then re-enable the SPI in the SPI rx interrupt. This 
is not an ideal solution and there is currently no understanding as to why this 
worked. As it solved my problem I will probably proceed for now and when I get 
time go back and investigate.

The external AVR is currently using a UART to communicate with a Spektrum 
reciever and then pass this on to the Tiny, I have other pressure sensors that 
this will eventually end up driving but for now it's a simple UART to SPI 

I would love to know if you get further than I did. I only have a few hours a 
week to work on this so it may take me a while to figure out entirely.

Hope this helps!


2010/11/2 Júlíus Helgi Bjarnason <address@hidden<mailto:address@hidden>>
Hi all,

I'm trying to use SPI to let Tiny2.11 and Gumstix talk to each other. The 
mission is to have Gumstix as SPI master and gather some data from some devices 
such as humidy sensors, heat- and pressure sensors. The gumstix will also do 
other things like controlling a GSM/GPRS modem to send the data to a data 
store. I want the tiny2 to be the autopilot and use SPI for communication with 
Gumstix. This means that it has to be an SPI slave since the Gumstix is the 
master. The problem is that all the modules in paparazzi are using the SPI as a 
master. There are some definitions for an SPI slave in the hardware code for 
SPI but I don't see any other code using that. It would be good to know if 
anybody else is working on a similiar project. Is anybody else using the Tiny2 
as an SPI slave?

Júlíus Helgi Bjarnason
Paparazzi-devel mailing list

reply via email to

[Prev in Thread] Current Thread [Next in Thread]