COG hardware for SPI
JCee
Posts: 36
Let me start by saying I really like what Parallax has done with the Prop but one thing
I wish was included was hardware to handle serial coms.· I would rather have some SPI hardware
than a second timer in each COG.· Every project I have worked on so far has used the serial
driver at some point, even if it was just for debugging. I have yet to use any of the counters,
I wouldnt mind giving up half of them.·
In my current project I have one COG left to read and process GPS data, but all of the objects I have seen so far
need at least two COGs, one to read serial values and one to process the data.·
Is it possible to use the counters to read serial data and free the COG to process the data?
Any chance the next prop will have serial hardware?
I wish was included was hardware to handle serial coms.· I would rather have some SPI hardware
than a second timer in each COG.· Every project I have worked on so far has used the serial
driver at some point, even if it was just for debugging. I have yet to use any of the counters,
I wouldnt mind giving up half of them.·
In my current project I have one COG left to read and process GPS data, but all of the objects I have seen so far
need at least two COGs, one to read serial values and one to process the data.·
Is it possible to use the counters to read serial data and free the COG to process the data?
Any chance the next prop will have serial hardware?
Comments
More than one time I've moved some bit of code into another cog just to gain access to the spare counter.
As for GPS processing in a single COG ... That seems like it should be feasible. I haven't looked at the code personally, but I'd imagine that most implementations use 2 COGs just because its more convenient (the uart already exists)
The only complexity with a software UART is high-speed duplex operation (changing back and forth between send and receive while not missing any bits)
Since GPS is receive only (I'm assuming because most I've seen are just a constant stream of data) it definitely doesn't take a full cog to handle this.
So this could be easily integrated somewhere else in the system (assuming it can't fit in the GPS processing COG)
On the other hand, serial comms (async, SPI, I2C) are in every design I've every used the prop for. Its not hard to do in software, but unlike most other micro's the prop doesn't really have anything to help ... other than of course not requiring interrupts.
I write my software with 2 models in mind
1. High speed tight timing - dedicated cog - often pasm.
2. Low speed , lose timing - have a poll function
Then the main cog is a repeat loop calling all the low speed polling functions.
I find one of hte big advantage of the prop is the lack of dedicated hardware. I dont have to worry when I start a project whether I have picked a version of the micro that has enough serial ports/I2c/ PWM, etc. If I need another one of those its straightfoward to add.
Post Edited (Timmoore) : 6/26/2009 7:27:08 PM GMT
There's one async serial driver in the ObEx that provides up to 4 high speed full duplex serial ports with optional handshaking. There's an SPI driver in the ObEx that's pretty fast as well. The I2C drivers have not been optimized for speed, but for flexibility, and could easily be sped up significantly.
I agree GPS is primarily a read only application. Maybe I can come up with some ASM that will read the data and update some values in hub memory.
Thanks for the feedback
-JC
3 Cogs for OSD
1- Overlay Driver
1- Graphics Driver
1- Display Handler
2 Cogs for Attitude Estimations
1- ADC (Sensor Reading)
1- Attitude Calculations
1- Cog for Rc Control ( Read Reciever values / drive servos)
1- Cog for Navigation and Control
1- Cog for GPS parsing
If there was a way to combine the graphics + overlay driver into some LMM code and still keep the timing I would
be all for it. I tried to cut the floating point math and move everything to integer to save a cog.
I am really considering putting a second prop on the board to allow for any future expansion.
You also might be able to combine the GPS parsing with the serial I/O as long as you can get away with ignoring the GPS information while you're parsing the last line from the GPS.
which adc?
Are you connecting the output channels of the rc receiver to the prop and then working out the pulse length?
I would look at it this way. The time sensistive stuff you have are
1. Overlay driver
2. Graphics driver
3. Pulse length for rc receiver
4. Pulse length for servos
5. Serial read of gps
None of the rest sound time sensistive, so I would start with 5 cogs for the time sensistive functions, 1 cog doing the rest in a loop, with another cog for float if you need it but I would try with floatmath first. With care you can probably combine 3/4 since the timing constrains are similar.
http://obex.parallax.com/objects/180/
Yes each receiver input (6 total) has a separate pulse that needs to be measured then depending on mode of operation, re generated on 6 separate output pins. I am working on an ASM routine that will do the measuring and generating with one cog.
For example I have a sensor board
2 cogs reading 12 sensors, doing calculations on sensor values (including altitude calculation from pressure), 1 of the cogs is also outputs all the sensor readings to debug serial port for debuging. I could combine the 2 cogs together but means rewriting one of the sensor drivers and I haven't needed to do it yet
1 cog for debug serial port and gps serial port
1 cog for float maths (probably could be removed but haven't needed to yet)
1 cog for I2C slave
for a total of 5 cogs - 2 are time sensitive - serial and i2c slave, 2 polling loops cogs and 1 float cog
With yours I would guess that the altitude and nav calculations could be combined. I would do the gps processing (except serial port) on the same cog and use a standard serial port for gps input
I would also look at whether the display handler can be made a polling system and called from same cog.
With that I think you could have several spare cogs.
I guess there is no way to configure the counters to read serial data.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Links to other interesting threads:
· Home of the MultiBladeProps: TriBladeProp, RamBlade, TwinBlade,·SixBlade, website
· Single Board Computer:·3 Propeller ICs·and a·TriBladeProp board (ZiCog Z80 Emulator)
· Prop Tools under Development or Completed (Index)
· Emulators: Micros eg Altair, and Terminals eg VT100 (Index) ZiCog (Z80), MoCog (6809)
· Search the Propeller forums (via Google)
My cruising website is: ·www.bluemagic.biz·· MultiBladeProp is: www.bluemagic.biz/cluso.htm