[Top][All Lists]

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

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

From: Adam Spence
Subject: Re: [Paparazzi-devel] using SPI slave on Tiny2.11
Date: Tue, 2 Nov 2010 18:45:45 -0500

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